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

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

desktopS

Here is everything I’ve been playing with for the past few months in preparation for the RS3 battery conversion project. The hacked up R/C transmitter is in the back, note the pocket for my android tablet. The two buttons will be for sounds, the toggle switch is the reversing switch for the power relay.

The 3D print fellow is in front of that, I have a sitting version of him to replace the out of scale cartoon figure in the cab. The soundcard/relay/mosfet board is to the left and the pololu 18v7 motor controller is on the right in front of the switch harness. The power relay is wired and working off the intercepted servo signal of channel two.

The smoke generator is the black box at the far right, I think it needs its own hack. Sync’d to the motor control would be cool? I’m not sure about this one, not even sure it’s worth it to put it into the model at all. Obviously I need some testing on that first.

The Pololu USB AVR programmer/ttl serialport/sloscope widget is at the front with the red clip connected to the back. This is my ‘scope’ probe. An amazing board for the price! I tell you what, I am absolutely sold on the AVR series of chips and this programmer. The ATTiny84 does not have a serial port, yet I found a nice software uart for free at AVR freaks. I can hook one pin of the micro up to the serial input on the Pololu and that combined with an LED on one of the port pins gives me a decent set of debugging tools. Super cheap too, ATtiny84s are like $3 in singles, way less in qty.

Anyhow, the sound algorithms need to be fleshed out, the mounting of the boards is not right yet and I need to put together a solid battery pack. But I’m getting there 🙂

sound

I’m working on a new design, a sound card for a G scale diesel locomotive. Since I will be running this with R/C, I need a sound card that accepts servo pulses from a standard R/C receiver. I think I’ve finally settled on a design, so here is a pic as I’ve laid it out on a Radio Shack breadboard. On it are two stereo mp3 boards, an Atmel ATTiny84 microprocessor, a 4 channel mixer based on a LM3900 and a 8 pin power amp.

Here is a refactor of my rail editor experiments to make a more generic control interface for my wireless servo widgets. This one is ‘uncompiled’ (if that’s a word) so you can take a look at the source if you like. It’s mostly javascript controlling the html5 canvas with some PHP thrown in to do the file save/load. I’ve tried to make it relatively easy to modify so you can add your own tiles and symbols. Note that this is not meant to be a session based editing tool, it saves one file and is meant to do realtime control on a closed web system with tornado (Raspberry Pi)- so don’t try to hack on my server please. (note: I’ve disabled file saving and there is no tornado web socket server on this box so you will see some errors in the web console if you try that)

You can try out the actual program by clicking ON THIS LINK

editor

To use this, click a symbol from the palette on the right and then click where you want that symbol to be placed. To erase a symbol, left click on that spot. Since this is meant to be a control surface for a real time web implementation, the ‘wixel’ button at the top is used to set the number of the slave widget (0-63) and the r/c servo that widget controls (0-5). Note this is not implemented completely in this demo, however I will be using the tornado code base I’ve posted in my other posts here, realtime control of servos, see the side bar for a link to that post.