I think there has been a bit of confusion as to what my board is and what it can do. I’ve probably not been as clear as I should have been so I’ll try to clarify that here.

First, the ‘widget’ is a design I have been working on for several years now. It’s gone through a couple of iterations of hardware but for the most part this is a final design. It is meant to be a generic ‘Internet of Things’ device. That itself is a bit confusing as IoT means different things to different people. However, since my application is controlling large scale model trains, I’ll describe it in those terms.

This board will drive motor controllers (ESCs), external serial devices (sound cards, for example), servos, relays and provides a logic level Digital Command Control (DCC) output. It will also accept inputs such as digital and analog devices, sensors, etc.

That is the physical side of the board. On the network side it will accept Bluetooth modules, Xbee, Wifi and SNAP mesh. This means you can run it with your phone, your raspberry Pi or your PC. I also have a couple of proprietary handheld controller designs I’ve been playing with but for now I’m concentrating on Android Phones since they are cheap and available.

My main concentration now, since I am interested in all the cool things DCC decoders will do for you (including saving a lot of wiring inside the locomotive) is to support the three main Large Scale DCC decoders- QSI, SoundTraxx and TCS WOW. I am writing android apps for this with the first one being for Bluetooth. Others will follow as time permits.

Got my new boards in for the latest widget design. On the left is the DCC Amplifier, it turns the logic level signal from the widget into a 15v DCC signal. The board on the right is the new Megawidget.

I have moved away from SOIC components as they are hard as heck to solder by hand. So this one sports an Atmega328 28 pin thru-hole microcontroller. I still have one SOIC component, the 3.3v regulator for the network module but it’s a pretty easy hand solder and the thru-hole version is ridiculously large.

Another advantage to this microcontroller is I can run it at 16mhz using an external crystal. It’s a pretty speedy little sucker at that clock rate.

The boards came out perfect in terms of electrical connections, I didn’t have to cut any traces or add any jumper wires. However I do have a bit of a spacing problem on both the controller and the DCC amp that I will have to address on the next pass. The ISP programmer port is too close to the bluetooth module and the logic input on the AMP requires that I wire it instead of putting a pin header – but for now they are ok.

The plan is to refactor all of my existing code on the firmware side and get it all squeaky clean- bluetooth network, servo control and the DCC output. Hope to have that done this weekend. Eventually it will drive a TCS WOW Sound 5A DCC controller that I will probably put in my Aristo U25B.

I pulled another project off the back burner and got the basics working. This is a Android Phone App I wrote in Python that interfaces to my control widget but with Bluetooth instead of 802.15.4. It uses the same DCC output code as all my other widgets but with a Bluetooth Network interface instead of Xbee. I seem to be late to the party all the time but I found this unit- it’s a pin Xbee compatible unit so it will fit right into my Control Widget design with no problems, just some different software. In the picture above, the unit on the left is my Asus 7″ tablet and the one on the right is a cheapo smart phone I got off of Amazon. Both work quite well. Not sure on the range yet, once I get the boards built I’ll be installing it all in my Aristo U25B for some real world testing.

I don’t have all the function codes working quite yet, but the throttle works great. This is all done with a BT board I’ve had laying around for a while- I have one of the above Xbee type units coming so I will be refactoring the code a bit for that anyhow. I should have boards for testing in about a week.

Here is an expansion of my R/C to DCC circuit. I now have all six channels of a cheap 2.4Ghz Radio Control System driving a 2Amp Economi DCC decoder. Throttle stick drives the speed, the other sticks trigger the bell, horn and other sounds. I have one of the switches doing the direction. The DCC amp can drive a 4A load with peak to 5A so more than enough for most G scale Here I’m driving a single USAT motor block. Still have a couple of small issues in the firmware but for the most part it works quite well. I am going to try to finish this off over the next few days and design a PCB for it.

Here is a diagram of the transmitter controls

A video of everything working. Can’t quite see the blue LED that is the backup light, but the Headlamp LED is quite bright. I still have channel 5 open, not sure what to do with that one at the moment. Basically, you can do throttle, direction and 8 functions with a six channel system.

Got my prototype to run first pass. This is a motor driver chip that I have wired to convert logic level DCC to 14v 5A DCC. I was working with the LMD18200 but that sucker was $16 from mouser! Ouch. And it only did 3A. This is the L298N which is only 3 bucks from Sparkfun. Big difference! Now I just need to layout a PCB and get it off this breadboard. Sometimes rainy days are not so bad…

I’ve been working with the series 1 Xbee for several years in order to control large scale model trains. For those not familiar with this device, the Xbee 1 is an integrated package that communicates on the 802.15.4 IEEE wireless network. This is the base level network, only the MAC layer, no mesh or other high level network layers. I have the device configured in ‘API’ mode, which means it accepts standard format messages with a header and checksum and passes those out to the network. It’s actually very simple- all of the nodes are on the network and any node (via a 16 bit address) can talk to any other node. So this means I can do anything with this from controlling trains to controlling turnouts or animations or sending back telemetry from the locomotives, etc, etc.

Well, it turns out that the 802.15.4 protocol is rapidly becoming one of the standards used in IoT, Internet of Things. From what I have read, it has about 65% or so of the wireless IoT market share. So I’ve been working on ways to control large scale trains with this in mind. I’ve had quite a bit of success with this and now one of the outputs of my control widget board can generate DCC messages to directly drive DCC decoders (up to 3Amps for now, I have a 5amp version I’m working on).

This is an open-ended algorithm, it can generate the proper DCC bit stream from any input of hex bytes. This lets me keep the network traffic down as the widget generates all the timing for the DCC signal. I only have to pass the basic commands over the network which keeps everything nice and small and fast.

Anyhow, here is the latest incarnation of the DCC 802.15.4 Widget driving a QSI decoder. This one is installed in an Ariso Dash9. Unlike previous designs this one has only one connection- the DCC output from the widget. This is fed to a ‘DCC amplifier’ that then drives the QSI DCC decoder. A 14.8v 5000mah battery provides the power.

This was an interesting install for a couple of reasons. First, the decoder is ‘plug and play’, I disconnected the track pickups and plugged the decoder into the socket- everything just works, no rewire of the motor blocks or LEDs! Very cool. The outputs of the DCC amplifier then drive the decoder directly, no motor controllers or relays or anything.

The second reason was the software. I’m not sure about the vintage of the QSI firmware but it was not happy with the extended DCC packet format for the throttle messages. So I branched the software and made a version that only sends the base DCC packets. I put the QSI into ’28’ step mode and all was good. I wasn’t particularly pleased by this but what can you do eh? I still need to do some CV tweaking for the momentum and braking but it’s working well.

At some point I will be trying out the new WOW large scale decoder and the Economi 400 to see how they react to the extended packets. I’ve played with the Econami 100 and 200 decoders so I assume the 400 will behave in a similar way. Nevertheless, I’m thinking I will need to re-work my firmware to include both the extended and the base level DCC packet generation. That is the official standard according to the DCC docs so I should support it.

Above is the basic circuit. On the left is the DCC driver, then next assembly is the 14v to 5v stepdown power supply which can deliver 2.5 amps of 5v (for servos, etc) to the IoT Widget. In the middle with the Xbee is (obviously) the Control Widget. On the right is speaker #2, I’ll be routing most of the horn and bell sounds to this one with the big sub in the engine compartment handling all of the prime mover sounds.

A picture of the main speaker driver. This is a tangbang full range speaker with passive radiator. Really nice bass from this unit. Here is link to it: tang-bang-speaker

Here is a shot of the ‘terminal’ (Hand held controller) I’ve developed for interacting with the IoT 802.15.4 network. This one is a back-lit alpha numeric display which works great- I can see it out on the layout as it gets dark at night.

Above is a new design I’m trying out- This is a full color graphic touch screen that has tons of features. It incorporates a usb programmer port, a speaker and a built in lipo charger circuit. I just can squeeze it into the same case as the alpha display so we shall see how it goes. Work in progress.

This is the widget driving an Econami 200. Since it’s only 2 amps, I will probably be using this in a critter or railcar of some type. Right now all I have it hooked to in this video is the speaker.

Here is a video of the widget controlling the QSI. I think all the firmware changes are in so I’ll be buttoning up the unit and taking it out to the layout soon for some real world testing. I may go ahead and run the servo lines out just so I don’t have to open it back up when I put servos on the couplers.

I continue to refine my control widgets. Here is the latest incarnation. I’ve shrunk the footprint down and boosted the clock speed to 12Mhz. This module ties into the 802.15.4 network via Xbee. I’m using the Series 1 not the Pro and Zigbee. I’m not real hip on the Pro Zigbee Mesh, it seems overly complex compared to say the Synapse SNAP mesh network.

Anyhow, according to what I’ve been following on the IoT blogs and sites, 802.15.4 has about 65% of the IOT market so I’ve decided to concentrate in that direction.

Basically, this module allows you to control things like servos and digital outputs, plus it gives you a DCC logic level signal output as well. Feed that into a motor driver like the ones from Pololu and you have a nice robust DCC implementation that is network based, rather than the point to point of Bluetooth or R/C.

I’m also looking into another implementation, via the Synapse RF266 SNAP module. I had initially though I could somehow make the RF266 work with the Xbee Series 1. While I think it’s technically possible to do this, the effort involved is quite extensive. Instead, I think a minor hardware platform will make things easier and actually, more flexible, so I’ve started down that road. Essentially, I’ll use the two serial ports on the Attiny to link the two modules together. With the right firmware I should be able to hang a Xbee Series 1 network off of the SNAP network for all sorts of diabolical mesh network fun. 🙂

P1050050

P1050053P1050049

One thing that I have not been real happy with as I build out my control network, is the hand held controller implementation. I had hoped this design would change that but after I’ve played with it a bit I don’t think so.

It features a uLCD-32 smart touch screen display unit, a large aluminum knob and four tactile hardware buttons. The display unit is a very full featured device including a Lipo battery charging circuit! Very cool. The custom graphics chip and language are very powerful and more importantly FAST. This will take all the UI load off the Xbee/Widget device. More info is here – Serial TFT Color LCD

So, I think I don’t like this one either. I’m going to scavenge the LCD and try to fit it in the case I’ve found for the alpha numeric monochrome unit. It’s a tight fit but the quality of this display is just too good to let it go to waste. I’m finding I like the off the shelf case I have (I bought two) better than I thought. I have somewhat large hands so I can hold it in my left and turn the knob with my thumb.

So this one is defunct now. More to come on this project later.

synapse

Well, I can’t believe I have not seen this module before. I may have but discounted it because it is about $11 more than an Xbee Series 1. However, the features in this module are very compelling, you really get a LOT of extra power and features for that $11.

This Synapse RF module-in-an-XBee-Pro-form-factor features OTA (Over-The-Air) speeds up to 2Mbps, maximum 1.2km (4000) range and a chip antenna for compact installation.

This particular RF module includes a user programmable (via python-based scripts), embedded ATmega128RFA1 microcontroller that can be programmed for all kinds of applications including remote sensor monitoring, remote control, or peripheral activation.

Features:

  • XBee Pro pin and footprint compatibility
  • Very high communication speeds (250kbps to 2Mbps)
  • Up to 1.2km (4000′) foot range (line-of-sight)
  • Built-in Python interpreter (Who needs additional microcontroller? This one has one built-in!)
  • Wide low voltage TTL operating range (2.7 – 3.6V)
  • Ultra low power consumption mode (1.18µA. Not mA, but µA!)
  • 15 GPIO, featuring
    • 4 10-bit A/D inputs
    • 4 PWM Outputs
    • 7 Interrupt capable pins
  • 128k flash, with 58k free for over-the-air loaded user programs
  • Communication options include I2C (TWI) master mode, SPI (3 & 4 wire, master mode), 1 UART
  • Low power capabilities (2.3uA sleep current)

More:

  • Embedded ATmega128RFA1 on-board
  • 1 UART port (pin 2, 3) for LVTTL (3.3V) serial control or transparent data
  • Able to be configured to wirelessly program Arduino Uno & Mega 2560
  • Socket-able (2mm spacing) or solder-able
  • SNAP, instant-on, self-healing, mesh network operating system
  • 802.15.4 Protocol at 2.4GHz
  • I2C communication (Pins 9, 13)
  • SPI communication (Pins 18, 19, 20)
  • 128k flash memory (56k available for user applications)
  • Can be used stand-alone (no additional microcontroller required)
  • Low power mode of 2.3uA with internal timer running
  • Supply voltage: 2.7V~3.6V
  • Transmit current: 130mA (Typ)
  • Receive current: 25mA
  • Sleep current: 2.3uA
  • Operating temperature:-40°C ~ 85°C
  • Power output: 20dBm for best-in-class range
  • FCC certified on all 16 channels (2.4GHz)
  • Spread spectrum (DSSS) technology resists noisy environments