Here is the Prodigy DCC controlling a servo over my Xbee network. (the video is sped up 200%) This validates the network layer and the speed. However, this is just a raw implementation of the protocol. The DCC message is just sent as fast as possible, regardless if it has changed or not. I don’t want to keep it this fast, there are far far too many Xbee packets flying around. It is ‘thinned’ out a bit because only packets meant for address 8522 are sent to this Xbee but I will need to implement the proper algorithms so that only data that changes is on the network. The client can then maintain the DCC stream on it’s own. Also, with only 128 steps of speed control the precision is lacking controlling the servos smoothly. I’ll need to do some processing of the speed before it’s sent to the servos.
It has a ways to go before it’s a bonafide ‘wireless decoder’ but the basic wireless network works, and that’s the most important, everything else is just more firmware 🙂
So far, I’ve used less about a third of the flash and ram:
Program Memory Usage : 4908 bytes 30.0 % Full
Data Memory Usage : 215 bytes 21.0 % Full
Making good progress on this. What I’ve done here is connect my MRC Prodigy Express DCC system to my Control Widget Platform. The input from the DCC system is run through an optoisolator to get the voltage down to logic levels. I then wrote an IRQ routine to decode and assemble the DCC packets. These get queued, error checked and then passed to the Xbee transmit routine. I pull the DCC destination address (either 1 or 2 bytes) out of the packet and use that as the Xbee destination address.
In the Atmel Studio pic above, you can see the Xbee X-CTU utility displaying a stream of Xbee encoded DCC messages for address 8522. Anything addressed to 8522 flows out over the air and into this particular Xbee which will eventually be on the client controlwidget.
In the logic analyzer pic, you can see I’m blasting these out about every 7ms or so. Pretty fast! This is just for experimental purposes now, just to see how fast I can go over the air. This will eventually change so that the client is doing all the work maintaining the DCC output while the master only sends packets that have changed since the last scan. This will keep the network traffic down.
Next step is to get the client going, decode the packet and apply it to the various things. Servos, Motor Controllers, lights, etc. With a controlwidget as a ‘decoder’ there is not much off limits- drive servos for steam locomotives or large motor controllers for battery locomotives. Or, a little more esoteric, create a ‘router’ that divides the mobile and accessory traffic into different xbee streams? On different channels too. Hmm.
I particularly want to try a sound decoder to see how that works, I wonder if I can use an HO sound decoder. Intercept the motor control data to drive a servo and then pass the data stream to the sound decoder? Hmm. Don’t know. Sounds like a fun experiment however…
This is a fantastic unit for the price, I can’t tell you how wonderful it is for doing small scale digital h/w design and firmware. I can literally time my interrupt routines, I’m sporting 5us on a dcc decoder INT routine. Sweet. I also found a really bad firmware bottleneck, I love this thing!
Here it is all hooked up to my development system. Atmel Studio 7 drives everything. This is my favorite kind of software development. Right on the metal.
Since I’m putting together a new N scale layout, or at least I’m planning it out right now, I decided I should probably give DCC a go since it’s so popular. So I ordered an inexpensive DCC starter set, the MRC prodigy Express2. I am glad I did. Just on a test loop my little DCC switcher locomotive runs WAY better than it did on DC. And since I like the feel of the MRC Prodigy Express DCC controller (more or less), I figured, why not come up with a way to use that to control, via Xbee, for my G scale stuff too?
So after much scouring and searching via Google, I came up with an input and output circuit for my control widget board.
In the above picture you can see the DCC waveforms and the really simple input side of the circuit. I’ve also got my basic C framework built out and this looks like it will be a fun project if I can ever get the time to work on it!
Anyhow, the basic idea here is read the DCC out of the Prodigy output, transmit that via Xbee and decode it on the other end. Or pass it through, or both. That way you can use any DCC handheld you want to control battery powered locomotives or even live steam ones (via intercepts of DCC commands to servos and relays, etc)
So this should be neat if I can get it to work. Something new to learn anyhow, DCC as a message stream 🙂
I have a lot less time to work on my projects than I used to so here is another sort of work in progress post.
I have the new widget boards and will be assembling several soon. I am missing a part, an SMD 140 ohm resistor for the power LED. It’s ordered.
Along with that order is all the parts I will need to intercept the DCC stream with my control widget and then either process it internally (moving servos, motor controllers, outputs, etc) or send it out to other Xbee wireless nodes. Something fun to do anyhow.
I should have a MRC Prodigy Express DCC controller soon. I will put it to use with my N scale trains but the main focus will be intercepting the DCC signals and sending them out via wireless XBee as mentioned above.
Also, if you notice, there is the Raspberry Pi 2 there beside Mr Foreman, I’ve got that up and running, very nice board. Really sweet.
Hmm. Also making progress on the CNC styrene cutting, I have large parts of the depot finished, I’ll post some pics soon.
Been sort of busy with a new job so I have not posted anything recently. I am still working on a couple of things though.
First is the completion of my G scale outdoor railroad. I’ve gotten the last major infrastructure project for that constructed but it’s going to take a while to get it skinned in concrete. I do plan to order some track soon and with luck will at least have a simple loop to run trains on.
I’m also working on my widgets again, I should have new Phase B boards in a few days. These are not a radical change, just correct one small issue on the old board, add mounting holes and a power LED. In the future I have additional plans for this board, I intend to take the remaining real estate and add a DCC interface, both in and out (if possible, using an external booster) and probably a couple of LED drivers.
My MOW critter is also coming along, I am converting it to battery power and adding widget control. I am also thinking about building a real small bobber caboose, probably with a work platform to pull behind it.
Also on the horizon is planning for an indoor N scale shelf layout. I have most of that designed, just need some tweaks.
And of course, the styrene depot shown in the last post is also taking shape.
Here I’ve added the 1/8 inch square strips and the window trim, then I shot the thing with some light brown primer.
I’ve been doing some experiments with the CNC router, trying to cut styrene. I’ve messed up and melted a sheet or two but now I think I’m getting the hang of it. I’m working on a standard N&W depot, this one is at Winfall, VA. I found the pic on the Virginia Tech Photo Archive.
Anyhow, what I have found is that styrene needs to be cut with a slow RPM and a decent inches per minute feed rate. I’m using a 1/32 inch bit at 7500 RPM and a 25 IPM feed rate. You also have to cut shallow, anything more than say .030 or so will start the dreaded melt. So I do three passes to get through 1/8 inch styrene (.125 inches). This produces a big shower of nice plastic chips or ‘saw dust’. This is what you want to see.
I wired up my yellow critter with a control widget, a Turnigy 20A ESC and a 4.8v 2300mah nimh battery pack. Works quite well. I did have to add a relay to reverse the motor but that’s already supported by the software, it’s what I use in my RS3.
A pic from the video, out on the track at Gilbert Virginia.
Just can see the Xbee in the cab. The battery is in the engine compartment along with the Turnigy ESC. The relay to toggle the motor direction is also in the cab but you can’t see it from here.
The development platform for my Dash 9 whenever I get around to it. A close shot of the control board with the Xbee. This is the same control board in the Critter. There is just enough room (I think) in the critter to put in micro servos for the couplers but I have not gotten there yet…
And here is the critter with the handheld controller.
This is my newest critter design. A freelance sort of fantasy vehicle but it came out pretty good and was fun to build. A couple of 3D peoples and some resin cast details thrown in for good measure. Everything is cut out on the CNC machine except the fuel tank which is a piece of PVC pipe. (I cut those on the band saw). Anythow, I am planning on possibly selling these as kits or at least making the plans available, not sure how that’s going to work out quite yet…