Thanks to Craig Townsend and Iowa Scaled Engineering, I now have one of these to play with for a bit. First look and it’s doing Xbee pretty much like I thought- I’m already seeing traffic from it. I’ll be integrating this into my own receivers plus working on a translator to drive Airwire devices. However, tomorrow (1/1/2019) is my last day of break so it will take me a bit to get everything refactored. I have the basic framework up and running on my development boards but now I have to interface the Protothrottle packets into my message handlers. Should be fun!
Santa brought me a bunch of circuit boards and other electronic goodies, so I decided to try some quick porting of existing code and protocols. I really like the knob on the Airwire Handheld but I much prefer changing the parameters of the DCC decoder with my phone. So for fun I refactored some code from my bluetooth receiver, added a CC1101 radio modem and now my phone can talk Airwire. Way more fun! So now I get the best of both- the big knob on the Airwire throttle and the nice color UI on the phone to change the DCC parameters. (Notice the big knob on the Airwire Throttle- I had a really nice Aluminum antique knob from another project so I mounted it instead of the plastic one that comes with it. Much better feel.)
The phone will do it all now, I can also drive the train with the phone if I wish (probably not) plus I can setup all the other DCC parameters like the engine choice, the acceleration/decel, brakes, etc. All with plain text and pretty colors. Can’t beat that. I do have to add some parameter entries to the phone like the Airwire Channel number and the DCC address, but I’ll get to that soon.
Above is the bluetooth/airwire transmitter side. For the most part, this is a complete design. The PC Boards require just a couple of tweaks but they are in good shape. I’m using the Bluetooth chip to intercept commands from the phone and then translating those into a logic level DCC stream. That feeds directly into the CC1101 radio modem which then talks to the Airwire receiver.
This is the receiver side. At the moment it’s just adhoc on the breadboard but I’m also working on a couple of smaller receivers. The DCC amp at the end combines the Battery voltage (or in this case, wall wart for testing) and changes the logic level signal into ‘real’ DCC. This drives an Economi (Soundtraxx) 2amp Decoder. The soundtraxx is just for testing, this will eventually be going into a GP38 with a TCSWOW 5 Amp decoder and 3300mah Lipo.
Anyhow, below are two of the receivers, one is the ‘deluxe’ version which contains a complete Arduino ProMini board, and the ‘minimal’ which is an Attiny24 design. These also are complete boards. The Promini design can be altered with Arduino Studio, the smaller one is not programmable, you use the jumpers to set the Airwire Channel.
Here are a few images of the logic analyzer and what’s going on between the devices. The top four traces are the SPI line to and from the modem on teh transmitter side. The bottom two lines are the transmit side DCC signal and the receiver side- they line up perfectly. Just blasting DCC over the air is a pretty brute force way to do things but it does work quite well and is fairly east to duplicate.
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.
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.
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.
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.
Since my Python Apps do not work on any Android Version greater than 6, I am working on re-writing them in Android Studio. At first I was not particularly thrilled that I had to re-write everything but now I’m starting to really like Android Studio. I’ve decided to add additional functionality so that I only need one App. The name of the bluetooth device (the locomotive name) will now allow the app to ‘configure itself’ when the locomotive is chosen on the phone. If the locomotive uses a TSU-4400 SoundTraxx decoder, the appropriate screens will come up for that. I am also going to allow the main screen to be programmed, change the icons and what function codes are associated with them.
I’m getting great backwards motor drive but forward is not good. Not sure why that is. Taken apart on the bench I get a solid torque but out in the real world, not so much. More investigation required.
I already had this locomotive hooked up for the most part, I was driving it with my Xbee Board so I swapped that out with the Bluetooth version. I also replaced a tiny speaker I had in the front with the one in the picture (on the left). Much Much cleaner sound mix. Bells and horns out of the front and the prime mover going to the back speaker with the passive radiator.
Here it is out on the layout, ready for a test run.
Here is a video of some basic testing. It still needs some tweaking on momentum and motor voltages. Please forgive the poor video and sound quality- my nice camera died and this is my backup.
I also ran my latest version of the Generic DCC Phone app. Works quite well now. The QSI is a tad on the finicky side however so I made a very small mod to the firmware in the Bluetooth Widget. Once I back test that on the other decoders I’ll roll it into the firmware release.
You can find all of my Android Train Control Apps on Google Play.
Something different, a gadget for the airplane. This is my incarnation of the Stratux open source ADS-B unit. It uses a Raspberry Pi3 along with a couple of high gain antennas, two radio receivers and a GPS unit to snatch weather and traffic data out of the air. For free! Can’t beat that. I think I spent a little over $100 on it, but I already had the Raspberry Pi3.
I also have an AHRS module plugged into it which should give me a basic Synthetic Vision system. Now I just have to figure out how to mount it ‘semi-permanent’ into the airplane. It has to be removable and used for ‘situational awareness only’ to be legal.
But one thing at a time. I’ve tried it with my two BLU phones and also my ASUS 7 inch tablet. So far so good. Works really well. Just plugged all the parts together, flashed the SD card with the free software and it comes up and runs. I’m trying out a couple of Android Apps that will work with it- they overlay the weather and traffic data on a current FAA sectional moving map plus let you do other cool stuff like plot out your file plan, get airport info and such. Neat.
Got all the parts and pieces together (well almost) and did some testing outside on the layout. I was very impressed with the range, I have a new $50 BLU Studio phone and I’m getting a good 100ft. So far I have not seen any of the problems mentioned by other users of the TCS Wow 5amp. I did talk to tech support at TCS and they indicated that there had been some hardware changes to the 5amp since it was first released. He didn’t go into what they were and was not clear if the firmware changed or not. Mine is pretty new, I got it from RP about a month ago. He said there was no way to read the s/w version so I don’t know exactly what rev of firmware is in there. That is obviously on purpose for whatever reason.
But so far, I really like this decoder. Crisp sounds and I like the brake feature. Very cool that it ‘coasts’ when you shut down the throttle.