After tinkering all morning, I was able to get JMRI to control AirWire receivers. One of the hardware options for connecting JMRI to a wired layout is an open source Arduino-based controller known as DCC++. I had already written a library for the Arduino to talk to the TI CC1101 RF module that is used in the AirWire products, and was able to combine my library with DCC++ to get JMRI’s DCC stream out over RF.
It didn’t work right away for a couple of reasons.
-
JMRI and DCC++ use 128 speed steps, which requires formatting the DCC packet as an Advanced Operations Instruction rather than the basic speed/direction packet that AirWire uses. I modified the DCC++ library to truncate the 7-bit speed to 5-bit and do some basic manipulation to avoid step 1 (emergency stop), etc.
-
Still didn’t work. Comparing the signal generated by the T5000 to that generated by the Arduino, I found that the 0 bit duty cycle was about 16% longer coming from the T5000. I modified the prescaler, and my engine started rolling down the track. Both were within the NMRA spec, but the AirWire receiver seems to be fussy about it.
Here is a photo of the contraption.
The parts are:
- Arduino Mega Clone
- Breadboard Shield
- 5 V to 3.3 V bi-directional level converter (in the breadboard)
- CC1101 radio module
Total cost if you buy the parts on eBay from China would be under $20.
I used a Mega because the Arduino communicates with the radio module over SPI, and those pins overlap with the output pins used by DCC++. I haven’t explored whether the DCC output pins can be reassigned or if they were chosen because of some specific hardware capabilities.
Once I got the on-screen throttle working in JMRI, I downloaded WiThrottleLite on my iPhone, and connected it to the JMRI WiFi Throttle Server. It works very well. The response is not as fast as the T5000, which is to be expected, but good enough to hand to a visitor.
Next step is to tackle CV programming.