I’ve been working on this Xbee DCC thing for quite some time now and have finally finished it off. Or more like, I’ve finally gotten to the point where I think I could ‘release’ the code and the hardware. I have created a version 2.0 release branch for the code and have most of the hardware in a PCB state so it’s getting pretty mature. And more importantly, it works pretty darn good now!

The basic problem I’m trying to solve is how to control my trains, both electric and live steam, with one network. This network would also control pretty much everything else- turnouts, lights in buildings, signals, whatever. Everything on the network- trains, towns, turnouts, signals, would be capable of talking to everyone else, in real time. This would then allow you to tap into the network with a standard interface to leverage whatever application you want on top of it.

This is the reason I went with the Xbee. Unlike simple R/C or even Bluetooth, the Xbee (and I am speaking specifically about the Series 1 Xbee, NOT the Pro Zigbee) is a low level point to multi-point network. It runs at 250Kbps and has a range outside of about 100 meters or 300 feet. Every node on the network has a 16 bit address and can talk or respond to any other node.

One thing that took quite a bit of time to develop and test was the DCC output. The widget generates 128 step DCC throttle messages and DCC Function Messages F0-F12. It’s a bit basic, you have to program your DCC decoder with an external DCC unit and (for now anyhow) you only get those specific DCC transaction but as you can see from the video, that gives you lights, sounds and throttle.

I also completely redesigned the Master side code as well. It’s now far more generic in terms of messages. So I designed a new hand-held controller for it to reside in:

handheld

Hand Held Controller 2.0

 

Here is a basic diagram of what is going on in the U25B in the video. These are the components and control and power flows. Red is power, orange is logic, blue is DCC. Also, it’s not on the diagram, but the economi is controlling the lights and the Widget is driving 2 servos to automate each coupler. The ‘other I/O’ is also hooked up, a current sensor monitors the amps flowing to the trucks and there is also a photo detector that gives a pulse on every wheel revolution (for speed and distance). (The software is not currently looking at these however)

xbeedcc

Basic Control Diagram

 

All of the components in the client are now on PCBs, no more proto or perf boards:

nano

Nano Widget

 

micro

Micro Widget

 

dccOut

DCC Output

 

relay8A

8Amp DPDT Relay

 

 

u25b

hh1

hh2

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:

xmaspcbSMAnnotate

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

saveway1

saveway2

P1040960P1040966P1040963

Finished off the grocery store. Well, almost. It’s hooked up to power out in Gilbert, but it sorely needs an interior with those big windows. Also the interior lighting is bulbs, way too yellow for my tastes so that will be replaced. The ‘neon’ sign came out ok but it was bitch to get together, lots of little fragments of EL wire.

railtruck2

railtruck1

I also got this little rail truck together. Made from an off the shelf kit and a little ‘robot’ transmission I got from pololu.com. Does ok, good speed but a bit noisy. The flanges on the wheels are not quite right, too square. It does well on straight runs but jumps off the track when going over a switch. Oh well, more engineering to get it tweaked right.

storeA

storeB

So here is the General Store/Grocery for Gilbert. This is from an older design I originally did in wood. Alas, the wooden one fell apart pretty quickly in the elements so I made this one from styrene sheet using the same patterns. More or less.

This is only the shell, I will need some detailed lighting and an interior with all that glass on the front, looks pretty ridiculous empty like that, eh? But I plan for this to be the centerpiece of Gilbert so it needs some work. A neon sign perhaps, lots of lights. A small parking area.

Here is a video of the router cutting out some of this:

P1040901

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.

two
three
one
shack1

shack2

My new building. Everything is cut from sheet styrene on my Probotix X90. I do love this machine and working with styrene. It cuts like butter and you only have to run the router at about 7600 rpm so it’s pretty quiet.

Anyhow, this is a tower sort of depot near the south end of my bridge. It’s on stilts, With all the windows I’m going to have to make a decent interior, frosting the windows is not really an option I don’t think. Work in Progress as is everything.

switchA

switchB

switchC

Need a few more switches, so rather than make them like the last, on foam boards, I decided I should make a jig so I can (in theory) make them a bit easier. So far so good, this one came out pretty well but it had one small high spot I had to grind out. Still needs the point control bar, whatever that’s called and a waterproof servo for a throw. Took me about 3 days off and on to make this one. Now for some more epoxy, stain and seal. Good thing I don’t care about track power 🙂