Atlona + Bachmann
Bachmann Button module
[RS-232] (DB9)
The Bachmann button module uses the RS-232 protocol to communicate. Each button sends 2 commands, Pxx when a button is pressed and Rxx when the button is released. Each button can accept three commands to control the light of the button and those are: LONxx to turn the light ON, LOFxx to turn the light OFF and LBLxx to blink the light. every time there will be a feedback in form of: OKONxx, OKOFFxx and OKLBLxx. Where xx is the number of the button in the range of 01-64 if the max of 15 modules are used.
[RS-232] (RJ45)
The two RJ45 connections are used to daisy chain the modules up to 15 per chain. DIP switches are used on every module to determine its place in the chain.
Atlona VCC
[RS-232] (DB9)
Is used to connect to the Bachmann with communication params: 9600bps, no parity, 8 databits and 1 stopbit
[TCP] (RJ45)
Is used to connect the AT-VCC to Atlona Velocity.
Basic concept of the driver for Atlona Velocity
De concept is to use the feedback from the Bachmann and put that information in to a variable in Velocity. We are going to use the 2-way parsing capability of the AT-VCC. For each button we are going to use two variables one to determine if the button is pressed and another to track the state of the button, to know if it was pressed or not. Then we can use the two variables to trigger event macro’s in Velocity. So we can do things like: IF button is pressed AND the state is ON then turn OFF, and IF the button is pressed AND the state is OFF then turn ON.
Creating the Velocity driver
Step 1 :
Make a copy of the Builtin AT-VCC driver in velocity. search for the AT-VCC Serial. Now we can edit the just copied driver.
Step 2 :
Now we are going to program the commands for setting the light on each button. Go to the tab “commands” of your driver and add a new command with these settings:
Run On Connect “OFF”, Interval “0”, Command Name “button 1 light off”, Command Syntax (TCP) “LOF01”, input or default command “no selection”, Termination “CRLF” and no parameters. Do this for every button you have and 3 commands per button LOFxx,LONxx and LBLxx. Like this:
Step 3 :
Now we go to the variables tab so we can create the necessary variables. Click on “ADD NEW VARIABLE” and give it the name “BP01” (BP stands For Button Pressed) Now we see our first variable and we are going to enable “Two Way Paring” and as soon as we do that we get way more options. First we are going to disable the “Has response delimiter”, now we go to the “PAY LOAD MATCH” and set it with “P01%bP01” next step is “VARIABLE ASSIGNMENT” en choose “Assign Value” and set it to “1” (TIP: if you want to know more about 2-Way parsing driver…click here). Now we add a “FEEDBACK MATCH” for OKON and OKOFF. Like this:
Step 4:
We add another variable that will hold the state of the button, so we know if it’s pressed or not. Like this:
Repeat step 3 and 4 for each button that you have. Now the driver part is done (don’t forget to save!!) and we move to the “Event Macro“ part. We are going to use event macro’s to check changes on our variables and trigger events according.
Create Event Macro’s
Step 1:
Create a event macro with the option Variables - variable updated equals 1 and give it a name, like this:
Step 2:
Click on the diamond shapes icon to set the conditions for this event macro. Create 2 conditions one for the state of the button press(BPxx) and a second one to see the current state of the button(BPxxS). Like this:
The logic is like this: if BP01 NOT equals 0 and BP01S equals 0 then the conditions are met. The driver will update BP01S depending on the feedback of the Bachmann OKONN and OKOFF. So this example is when then button is in NOT pressed state and if you change the condition of BP01S to 1, it will only trigger if the button IS in pressed state. Now you can add as many commando’s to your event macro as you need. In this example the only command is LON01 to turn the light on button 1 of the Bachmann, and create a new event macro with the same setting except the value of BP01S to 1 and the command to LOF01.
Recap
What have we done..
If everything is done correct you have a new driver with a couple of event macro’s and if you press button 1 then it turns on and if you press it again it turns the light off.