I got bored with Bluetooth and decided it just wasn’t going to give me what I wanted in terms of a control network. So I figured I would go back to one of my favorite wireless control devices, Xbee. I love those little blue boards. Since Xbee offers the Digimesh option for it’s devices I upgraded all my modules to the latest firmware and started designing some stuff.

 

Above is the basic Airwire to Xbee breadboard. The ‘translator’ is a PCB that contains an Xbee in one socket and a CC1101 radio modem module in the other. The Airwire modem is mounted to an ‘Xbee blank’ that I cut out on my Probotix Router, this will be a PCB at some point. All of this is controlled by my favorite microcontroller, the Atmega328, the same chip in the Ardunio Pro Mini. I clocked it at 16Mhz and implemented a priority scheduled bare bones RTOS to handle the various control tasks.

What I am doing is intercepting the DCC data streaming from the Airwire Throttle (many thanks to Eric Reuter for his radio init data) and breaking out the DCC messages into individual packets. This lets me filter out the constant barrage of redundant messages and encapsulate them into Xbee message payloads. Only when the data changes is an Xbee packet sent out.

This is the basic network layout. ‘Translators’ intercept the various control packets from handheld controllers, translate those control messages into a standard list of Xbee payloads and ship them off to the destination. Since there really isn’t a ‘master’ or ‘slave’ on a mesh network, these messages can also go to multiple recipients. There are all sorts of possibilities here using a single standard wireless message transport system like Digimesh.

 

Above are the pertinent observations – logic trace and reception of the Xbee packet on the PC via XCTU. Top trace is the DCC from the Airwire Throttle, second is one of the RT clocks, the 10ms one, the bottom is the async data frame to the xbee. There is still much work to be done but the basics are now in place. I can convert all of my various control methods, Airwire, DCM2, Bluetooth, etc into a single, point to multipoint Industrial IoT mesh network. Xbee digimesh is very well document and pretty much an industry standard.

Xbee Digimesh Documentation

 

While I like Bluetooth ok, it’s not really meant to do control sorts of things. I mean, it will do them and all that and the phone I’m using has a decent range but it’s not really happy with multiple nodes. I also don’t like the phone for driving trains. I mean, it’s great for programming decoders, way way better than obscure CVs as shown below:

And if you are doing just general train driving its fine. But for switching or live steam on grades, it’s not so great to run a slider with your thumb. The live steam one was particularly difficult, you have to keep your eyes on the locomotive and also keep track of the slider. I found that to be quite difficult at times – I need a knob I can feel under my thumb. So I decided to start with Airwire since its very popular and they make a nice handheld unit with a knob.

Going with Xbee Digimesh also frees up the phone side of things – I don’t need specific Android Apps anymore, a web app on my $10 raspberry pi zero will do everything I want from any platform, Android, Apple, PC, etc. Anything that can run a web browser will now be able to control things and more importantly, configure decoders and other things with nice descriptions and such. It also lets me implement the entire Rpi setup with Python. Everything is python, I’m using Flask and Apache on the RpiZW. There is a bit of Javascript in the pages but very little is needed, most everything is python. It’s very cool, you can log into the Rpi like any server from your PC to goof with code.

The Rpi Zero W, with the right configuration, can operate as a standalone Wifi Access Point with it’s own dedicated web server. (in this case, flask and python along with a little SVG for the web page interface). Just add the access point wifi to your phone or (his pic) your PC, and you can then display and configure any node on the digimesh network. Very cool. Here is a quick page I made up that does a network query on all Digimesh nodes it can find and displays a small box of info about each.

 

If you have a Raspberry Pi Zero W, I have a 16G disk image you can try out. It sets up the Pi as a standalone Wifi Network with it’s own web server and MySQL database and a few other options. I started on a page for it, not sure if I ever finished but I do know the RpiZW disk image is up there, you can download it and flash a 16G card for your RPIZW if you would like to do some poking about. It doesn’t display the above page but it has some basic handlers you can play with (its all Python)

Raspberry Pi Zero W Disk Image Info

 

Anyhow, this is just the beginning but it gives me a new set of toys to play with if nothing else. I’ll try to put together some sort of open source project for this once I get it working. The airwire modem is like $10, an Xbee is about $17 and the Raspberry Pi Zero W is $10 so this should be a relatively low cost control system.

I originally built this as an office for the RV Park but it doesn’t seem quite right in the role, so I made it a Post Office in my new town of Proffit VA. I’ve got it installed and wired into the solar grid.

We brought the new puppy home this weekend. She is an 8 week old German Shepherd and spends most of her time in two states, sleeping or bouncing off the walls. Rinse, repeat at hour intervals. Sophia is her name.

More Progress on the Android Bluetooth Throttle App. I’ve been working on this for several months as time permits. I’m very close to an initial release of it. Below are screen shots of each of the pages. This is what I call the base level app- I also have several special screens I’ll add later that will allow the configuration of the SoundTraxx and TCS Decoders using plain text selections instead of having to punch in CV numbers. I also have some battery only sorts of screens that I’ll add later on.

–> Download App Here <-

This is the first screen. Use the plus/minus buttons to view which paired device (locomotive) you want to control, the press select. Once selected, the app will remember the last setup you made with it and set all of the buttons, function codes and screen configurations.

These are what I call the ‘main’ screens. They have the most used functions, horn, bell, direction, grade crossing, etc. Each of these icons is programmable, you can set the picture as well as the DCC function code it sends out. (see below)

The above two are ‘generic’ DCC command screens. These are not programmable but you can show or hide them. These send the corresponding DCC function code.

This is the CV programing screen. Use this to set CV address and data for a particular function.

This is the page configuration screen. You can set each of the above pages to display or not here. The ‘Cancel’ button will clear the current configuration and set everything back to defaults. Cancel requires that you press it 5 times in order to clear to prevent hitting the key by mistake.

Tapping the ‘Main Screen’ entry will take you to a screen that allows you to set the icon and function code for each of the buttons. You can also tap the ‘Board Control’ entry to configure that screen as well. See below.

The above are the two screen configurations. Use the plus minus to change the icon picture. Press the icon and the number turns green so you can enter the associated function code for that button.


Don’t have her quite yet. She is only 4 weeks old in this picture so another 4 to go, but this is the one. She will join our other two shepherds, Zack and Molly.

Blu Phone Sends Bluetooth to control Aristo U25B with Soundtraxx TSU-4400. 2200 mAh Lipo battery, Full range TangBang speaker with passive radiator. Rewired the lights for LEDs. Good speed and power on the U25 at 14.8v.