I’ve gotten both the client and master widgets working in terms of downloading and testing code. The display on the throttle is working great, the keyboard, not so much. Spent half a day before I realized I had wired the switch matrix sideways. Software comes up short when the h/w is hooked up wrong, eh?

The client node is simple, not much there other than the xbee interface via a dedicated serial link.

I have one more set of parts for the computer node, have not put them together yet. Really don’t need them that much now that I think about it, the Parallax xbee usb board I have should do it- but not sure yet.

9-12-2013: Have not had much time to finish up the keyboard but hopefully that will be done by the weekend. Other household repairs and refurbishments are taking up my time but they need to be finished up over the next few months as we move toward the cooler weather.

newradio

Spent most of the Holiday weekend finishing up the soldering on my various train widgets.

On the left is the Pololu 18v7 7 amp DC motor controller. This is a commercial board. It works great in my Aristo RS3 and allows bi-directional control without a reversing switch. It’s very configurable. You can run it bi-directional or single direction and it has configuration items for acceleration and braking although I have not tried those yet.

To the right of that is my ‘helper r/c’ design. This board reads r/c channels and converts the servo pulses to flip a relay (for reverse) and turn on up to three MOSFETs (for lights) using standard R/C airplane sorts of radios (one channel per). I noticed some people who use cheaper airplane ESCs are dedicating a servo to flipping a toggle switch onboard the locomotive, this eliminates that. (Personally, I like having a reverse switch so I configure my Pololu that way anyhow). This is a very inexpensive board based on the ATTiny84 micro-controller.

Not shown is an R/C sound board, it allows you to play any mp3 sound, triggered by a channel on the radio. Stick all the way to the left, play sound 1, all the way to the right, trigger sound 2, in the middle, silence. So horns, bells, or music even if you are so inclined. I’m thinking 1-4 channels of sound depending but I have not finalized that yet.

Next on the left, below the motor controller is my Xbee widget. This is going to be the basis of all of my new wireless designs. I can re-use the basice design and populate the board with different s/w only, no need to change the h/w to have several different ‘widgets’.

Depending on the s/w, I’ll be able to control servos, DC motor controllers, MOSFETS (on/off power switches) and drive my 4 channel mp3 sound card. I’d also like to provide the option of DCC outputs to feed various decoders but that s/w hasn’t been developed yet.

It will also provide serial inputs for things like RFID readers, speed and distance counters, current sensors and other things like that. Note that this doesn’t have to be a locomotive unit, this node could go anywhere to control turnouts or animatronics, etc.

With another set of firmware, it will act as a hand-held controller. A rather large prototype of that is in the center of the picture. (This should fit down into a nice sized handheld unit once it’s put on a PCB)

Yet another incarnation of s/w will produce a widget that will interface to your computer, allowing control of any other widget.

The radio for the wireless is the Xbee series 1. These are low cost radio nodes, come ALREADY FCC certified and have a range of 300ft. They also provide a set of firmware called digimesh that turns your network of nodes into a self-healing mesh network. VERY COOL. The proctocol is also open source so no more proprietary radio communications! Love that.

zigbee

This is the client node. Three servo outputs, five mosfet outputs, serial out for sound card (up to 4 channels), serial in for RFID reader. Two inputs left over for speed sensor and/or current sensor. If I can come up with the proper code, I can drive DCC out of one of the Mosfets. There is some open source DCC code floating around but I wasn’t impressed with what I saw so that will probably have to be developed from scratch if I decide to.

masterslave

More work on my prototypes. I have most of the boiler plate soldering done on the breadboards, the ground and power is all done for both. Signal paths are not, I plan to wire-wrap those. For the hand-held, I have a reasonable parts layout so that I can actually use this thing. I’m going to have to lay all this out on a PCB before I can design the actual hand-held enclosure but for now this will let me do all my development.

The ‘slave’ node on the right is super simple. Xbee and a micro-controller. All the work will be in the code. I’m planning 3 servo outputs, 5 mosfet digital outputs, a serial out for a two/four channel sound card and a serial input for the RFID transponder. If I can get the DCC protocol figured out and coded I’m going to put that in there as well. All this will leave one pin free for a possible distance/speed sensor. Anyhow, it should be a good development platform.

I guess it’s a bit of a misnomer to call these Master and Slave. While I’m going to start off with that, the idea is to eventually flash the Xbee modules with the digimesh firmware. This will make these just two equal nodes on the network. In this case, a hand-held control unit node and a locomotive (or whatever) node. Not shown yet (because I haven’t started on it, duh) is the computer node that will plug into my Raspberry Pi and offer sensing and control over the whole net. Or that’s the plan…

xdiagram

So this is the basic diagram for the locomotive (client node) side. I personally don’t need the DCC but I think that would be a good thing to have for compatibility if I can make it work. The motor controller is going to be external, I am assuming a Pololu 18v7 on servo channel 1. The wireless is the Xbee, you select the distance, the cheap one is 300 ft or so and the expensive one is up to a mile outside. The idea is to use an open source communications protocol in a very small, wireless mesh network environment and then provide a very low cost but expandable series of h/w boards to implement that. The end node can drive servos, digital outputs, dcc and provide real-time feedback like current draw, speed and position. That’s the plan anyhow.

xbee

Probably time to re-think the communications layer- master/slave with the Wixel works well but only has a 50ft or so range. Xbee is actually cheaper and offers a point to multipoint network out of the box. Duh. Also, if you want to spend the money, the PRO will do a freaking MILE in range! Sounds almost too good to be true, eh? We shall see.

So with that in mind, I’m also thinking of switching to the AVR 1634. It has two built-in usarts and extra i/o pins, however it is only available in a SMD package. Not terrible but a little more difficult to breadboard than a PDIP package.

Also found a nice free schematic drawing package from these guys:
ExpressPCB.com

But their PCB software kinda sucks (I like autorouting) so I’ll be sticking with these fellows:
Pad2Pad.com

P1030596

Battery Pack all finished and mounted. Plenty of room. I’ve decided to go ahead and wire up everything since I have the thing torn apart like this. I’ll be adding a Wixel that will be able to share control with the 2.4Ghz radio via a Pololu R/C multiplexor. I’m also planning on adding a set of Kadee Couplers controlled by a microservo. The final touch will be a Sparkfun ID-20 RFID reader which will interface with the onboard Wixel. By placing tags around the layout, this will let the locomotive know where he is in real-time.

P1030597

Sound card is working, now have sounds playing via radio control but I need to revise the clips and control algorithms. The amplifier/mixer is also still in the construction phase, these boards do drive a headset quite well, but don’t have the power to drive the speaker in the locomotive. Plus, just wiring the output of the two boards together works ok for debugging purposes but you get a drop in db when both are playing so that needs to be evened out. Nevertheless, the sound is quite good, I’ve been running it through my sound system here and it has the dog looking around for the train when I trigger the airhorns 🙂

rs3

I’ve been working on a home-made set of widgets to convert this locomotive to R/C and battery power. It’s a chance to do some circuit design, soldering and a bit of embedded software engineering for fun. The idea is to completely replace the insides of the locomotive with inexpensive, off the shelf components. I will use those to drive the main motive power- a 15v 3500mah Nimh battery array, and tap off that to provide stereo sound and lighting control.

While the motor controller was easy- I’m using the Pololu 18v7, the sound and R/C switches for the lights and the reversing power relay was where the fun was so I designed my own board. It uses an Atmel Attiny84 microprocessor, two mp3 player cards, a 3A power relay and two power mosfets.

Anyhow, the innards of the Aristocraft RS3 were not impressive. Complicated rats nest if you ask me. I have no interest in track power nor DCC so I just gutted the entire thing down to the leads on the motor trucks. I did save the two small circuit boards that plug into those but everything else with the exception of the 7805 power regulator got tossed.

rs3-gut

I have the sound/relay card almost finished, as things progress I’ll post more details. Here it is stripped all the way down:

stripped

And a picture of the motor truck, the colored wires are the motor leads, the two black wires go to the track pickups:

motortruck