A couple of pictures of my latest iteration of wireless DCC and train control. This one has been refactored a couple of times and I now have a nice compact executable that takes throttle and function commands from any controller (in this case, my new hand held design) and converts them to both servo pulses (for the motor controller) and DCC output commands to control the lights and sounds. The speaker is a 2 inch full range with a passive radiator, sounds nice and full. The lights are all surface mount LEDs driven by CL2Ns. I also have servos on the couplers, they are tied to the F6 and F7 functions on the handheld.
Here are the basic components that go into the locomotive:
Everything is now driven by a simple command structure- throttle commands and function commands. The throttle controls the servo 0 spot, I’m using a 20A ESC to drive the motors in the U25B. The throttle commands are also used to drive the DCC decoder for the engine sounds. Since this is an HO Economi decoder, it doesn’t have the current output directly. But it does have great sound and I also drive the lights with it.
Why Xbee everyone asks? Because this is true networking. Everyone is on the same network and can speak or be spoken too. True point to multipoint. This opens up all sorts of possibilities for automation, signals, detection blocks and computer control. Something Bluetooth cant’ do. It’s also ‘industrial strength’ in that Digi has been making Xbee modules for many years now. They are FCC approved out of the box and
This is the base design for my new hand-held controller. Along with a new case and display, I’m going to refactor the software to provide a cleaner interface into the clients (locomotives). Right now my ‘phase A’ handheld knows a little too much about the clients, I want a more disconnected sort of protocol. Anyhow, I’ve gotten everything to fit but the graphic interface required some new hardware so that has not been tested (other than a basic smoke test). I’ll need to write the code for that and then port parts of the old handheld code into it. The keyboard, knob and Xbee interface should not have to change much, I just need a calibration step on the kbd and store that into eeprom. I’m going to have a usb interface into this so I can write a tool on the PC to setup the function keys and display.
In addition to my own control system using Xbees, I also play around with standard radio control. I have one of the Hobby King systems shown above, I think it was like $25 for the TX and RX pair. In the second picture I’ve taken the TX out of the shell and replaced the joy sticks with pots. I’ve mounted it on a board so I can get to it’s innards.
Anyhow, what I’ve done is leverage my R/C signal software and my DCC generation software into one widget. I continuously sample the servo pulse coming out of the R/C RX and then translate that into DCC messages. In this case, throttle messages, although they could be anything.
It all fits into an 8 pin Attiny85, then feeds into my other new widget, the DCC output board.
With this board, one side goes to the battery connection, the other is the output. You can see the small R/C type connector which carries the signal from the Attiny to the board. The DCC output of this board then directly feeds the sound decoder.
Finally, here is a video showing it in action. You can hear the notches of the sound decoder increase as the output pot is twisted and the servo pulse width increases-
Above is the basic install I do on all my locomotives. The green RX box can be a regular R/C RX or it can be my Xbee Control Board. Same basic wiring.
And here is a really cool video of GE intermodal at work, with the Trip Optimizer of course.
I’ve borrowed some of the graphic layout ideas from this to make the GUI for my phone app- Not quite sure what I want yet but I like this minimalistic implementation.
Again, the idea here is that the phone sits in the cradle (see below) and communicates with the Xbee master in the cradle via bluetooth. The Xbee master reads the knob and the buttons and syncs up with the phone app to keep the display refreshed. The Xbee master controls the Xbee client in the locomotive and also can query the locomotive for speed (via a wheel encoder) and current draw (via a pololu current sensor). There are also hooks available for an RFID reader (I use a somewhat pricey one from Sparkfun – $33) for position information.
Latest incarnation of the Phone Throttle Contraption. The phone communicates with the Xbee Controller via bluetooth, a custom app runs on the phone. This is based on previous experiments with an android tablet, you can read about that here- Android, Bluetooth and Xbee
I’m trying to emulate a generic sort of DCC throttle ‘feel’ with this. I have all of the base code written and tested, it’s just a matter of pulling all the parts together. Slowly I’m getting everything working.
I have all the hardware installed and a basic smoke test done. So far so good. The firmware needs to be updated and my phone throttle is still not quite there but I’m close. By springtime I’ll have everything refactored. My Aristocraft U25B will be my development platform for this iteration.
Yet another project in the works. This one is intended to leverage my DCC circuit boards into a interrupt driven DCC I/O system for the Arduino Pro Mini. I actually have all of the software done and tested for both the input and output of DCC signals on my Attiny1634 board but I’ve never actually used a real ‘Arduino’. I’ve always built my own boards so this is a learning experience. I’m probably not going to make it compatible with the larger ‘Arduino’ universe, I’ll just optimize it for the Pro Mini. Anyhow, this project is actually number two on the list, the refurbish of my U25B locomotive is first so I can polish off the main widget code base.
I picked up a cheap Aristocraft U25B in Chessie paint the other day and have been taking it apart so I can rebuild it. The idea is to get from the toy like unit I have into at least a semi-scaled sort of model. The photo above is the closest prototype image I’ve found to what is depicted with this Aristocraft rendition. So I’m stripping it down to the base parts with the idea to install my control system, batteries and sound. And of course, a bit of paint and detail work- it is a bit cheezy with the cast color parts. Yuck. So anyhow, I’m getting there. Below is an image of the original model. More in a later post.
Today I got my order of printed circuit boards from Bay Area Circuits. I promptly populated them with components and powered them all up to see how they would do. Everything works! Very nice! Next step is to install these into one of my locomotives and replace all the breadboards with something clean and production quality.
Pictured, in order, is the 8Amp DPDT relay module, it’s used to reverse the direction of the locomotive. It can be triggered either with a logic one or zero, say from an Ardunio, or from an R/C signal via your generic radio control system. (The logic version is shown, the R/C version has an additional chip on the board, you can see the outline).
Second is the DCC output module. It is designed to be driven with a logic signal from a micro-controller such as the Ardunio. Logic input in, attach your choice of battery (or other) power to the input terminals and it provides up to 3Amps of DCC encoded power on the outputs.
Below that is the DCC input module, connect this to any DCC device like the MRC Prodigy or NCE DCC units and it converts the high voltage DCC signal down to what a micro-controller or Ardunio needs.
The last one is my Control Widget Node. This device is a micro controller wired to an industrial strength Xbee Series 1 802.15.4 Wireless Network Module. I use this for both my Control and Slave nodes. It allows high speed data delivered in an organized network infrastructure with a range of about 300 ft. I send both proprietary packets and DCC messages over this in real time. This is the latest PCB design.
I’ve been doing quite a bit of PCB design these days, here is a version of my controller board, the ‘microwidget’. It’s quite compact. I have not had any made yet but I thought it came out really sort of, well, neat. Like art kinda.
All total I have about five or six small circuits for doing control networks- specifically for large scale model trains. DCC input and output, servo control, DC brushed motor control, reversing relays- all via Industrial strength Xbee Network wireless.
I’m also thinking of making an apt-get debian package to install JMRI on a RPi 2 and gitlab for my code. Hmm.