Electronics


The production boards are in test now. They came out very well. Very small and compact, no errors or blemishes. As mentioned in previous posts, this is an Airwire Compatible Receiver that uses the Anaren Chipset and matching antenna. It gets a good 100ft range and can be programmed to listen to any of the 16 Airwire Channels.

The second picture above is my Protothrottle to Airwire interface. This is still a quasi-pre-production sort of board as I don’t have the funds to re-design it at the moment but the circuit design and firmware are in good shape. It has some expensive parts but I’m getting very good results so far and have enough boards to build six or so.

The idea here is to get everything to play together. The Protothrottle on dedicated receiver boards and also allowing Airwire compatible boards to work as well. I’d add Revo to this but I don’t have one and they seem to be quite proprietary so would have to be reverse-engineered.

Anyhow, as far as the AirRx is concerned, in addition to passing the DCC signal from the Airwire T5000 (or my Translator) out to a power amp, it can also control two servos and two digital outputs. In the photos above, I don’t use DCC, instead I have it configured to use the servo output to drive a Pololu electronic speed controller (ESC). I have also configured one of the digital outputs to control a relay for the lights. Everything is mounted in a 3D printed ‘oil tank’ on my home made critter thing for testing.

Some more info can be found here: AirRx Receiver


This is a project I actually started about 2 years ago. I put it on the back burner when I got involved with Protothrottle development and it has languished in my electronics stash until the last few weeks. This is an Attiny driven Airwire Compatible Receiver. The board in the photos above is a development board, and as such has a few jumpers and mods on the underside. The production board will be quite a bit smaller and more compact (and no cuts or jumpers!).

I’m using an Anaren daughterboard for the radio modem, this is made by my colleague, Darrell Lamm, who has done a tremendous amount of R & D on these CC1101 radio modems and chipsets. These are really nice boards. They are also quite small and so perfect for this design.

I have taken the functionality of my Protothrottle and original AirMini Receiver designs, optimized the code and squeezed it down to a very small footprint. Although this is still in the test phase, I am quite happy with the results.

This board has the following features:

  • Compatible with the T5000 Airwire Transmitter
  • Compact size – 26mm x 34mm
  • Programmable using CVs
  • DCC Output up to 10A (with optional motor drivers)
  • Two digital output lines that can drive relays, etc, assignable to any function code 0-28
  • Two Servo Outputs that can be used in three ways:
    • Live Steam Mode – servo one follows the throttle, servo two is direction
    • Electronic Speed Control Mode – Servo one controls a ‘center off’ ESC
    • Coupler Mode – Trigger two servo controlled couplers

Here is a list of all of the programmable options for this receiver:

/*
 * Decode message packets here and do servos and config variables
 *
 *   CV 200 - Radio Channel 0-15
 *   CV 201 - Radio Power Code
 *   CV 202 - DCC Address lo
 *   CV 203 - DCC Address hi
 *   CV 204 - Servo Mode 0=Steam, 1=couplers, 2=ESC
 *   CV 205 - Servo0 LowLimit Lo
 *   CV 206 - Servo0 LowLimit Hi
 *   CV 207 - Servo0 HighLimit Lo
 *   CV 208 - Servo0 HighLimit Hi
 *   CV 209 - Servo1 LowLimit Lo
 *   CV 210 - Servo1 LowLimit Hi
 *   CV 211 - Servo1 HighLimit Lo
 *   CV 212 - Servo1 HighLimit Hi
 *   CV 213 - Function Code for Output x
 *   CV 214 - Function Code for Output y
 *   CV 215 - On/Off Code for Output x
 *   CV 216 - On/Off Code for Output y
 */

In the pictures and video, I’m controlling a Pololu 18v7 ESC motor controller. The Pololu has an option for a 3.3v BEC (battery elimination circuit) so it only takes two boards and a 2 cell lipo (7.4v) battery to drive my little test critter. I took it out to the layout to do some range testing and was quite impressed. With the T5000 set to transmit power ’10’ (full) I am getting a good solid 100ft. It may actually be a bit more but this is as far as I could go easily. Below is a video of the range test:

And a more close up video:

Here is my latest project – Protothrottle Dead Rail for a USA Trains NW2. Somehow I managed to squeeze everything into this little fellow but I did have to skimp just a little on the battery, it’s only 1300mah. But that’s fine for a switcher in my tiny little industrial yard.

It has a SoundTraxx TSU4400 in it, which is a good 5A sized DCC decoder. I don’t think it sounds quite as good as the TCSWow but it’s ease of programming and the function outputs make up for that. It also has some neat sound features in it including a 7 band EQ and reverb effects. One other thing it lets you do is ‘detune’ the engine sounds some- I took it down 100 ‘cents’, adjusted the EQ a bit and now have a good solid bass ‘thrum’ sort of effect. Pretty cool.

For this install I also did some software development to finish off the coupler mode for the servos. I have these set up on the Protothrottle so that the Aux button controls them. If the direction is set to forward, the aux button controls the back coupler, if it’s in reverse, it controls the front one.

Above are a couple of shots of the interior, I had to build a special little ‘cradle’ to get everything to fit. On one side is the Soundtraxx Decoder, on the other is the 10A motor driver. In the center is the Xbee Receiver. The battery is a 1300Mah 14.8v Lipo. There is also a small buck converter to power the Receiver and Servos at 5v but it’s under the battery so out of view here.


This one shows the servo and couplers. I 3d printed a servo/coupler sort of mount that came out quite well.

Good shot of it out on the layout with my 3d printed guy on the front.

Above is a quick video of everything all setup and running. Took me a while to tweak all of the parameters and sounds and assign them to the PT buttons but I really like the result. I have the acceleration and deceleration dialed in and enabled the brake. The couplers are triggered by the aux button and I’m using F12 for that so it already has the coupler sounds paired with the servo movement (more or less). I forget the actual horn sample I’m using but I watched a couple of youtube videos of NW2s and this one was pretty close. I mapped the engine start (F5) to the bottom LCD button and ‘radio chatter’ (F22) to the top one. It still needs a bit of tweaking but I’m very happy with how it came out.

Latest version of the Protothrottle Receiver. This is driving a TCSWow 501 Decoder with a USAT Smoke Unit. This one is getting sent to the West Coast but an identical unit will be going into my USAT GP38-2 Chessie.

Above is my latest Protothrottle Receiver. There are some features I would like to add but for the most part, it is code complete. I have more info on it here: Protothrottle Receiver

This is an Airwire Receiver (or transmitter if you wish) that interfaces to the popular Airwire System of Model Train Controls. I picked an Ardunio with this one as it is probably more familiar to the many computer hobbyists out there than a naked Atmega328. I wanted to keep this one accessible and as open source as I can. The Github Repository is available here: Github AirMini
More info on it is here: Airwire Mini

I got all of the firmware straightened out and this works pretty well now. This particular software build only handles DCC addresses 0-99 but I’ll be fixing that on the next firmware upgrade.

You only need this one board and it will enable the Protothrottle to control all of your Airwire Locomotives. It still needs another pass on the PCB and an enclosure but I’m pretty happy with the innards. I’m going to build up a few and see if anyone wants to do some beta testing for me.

UPDATE 3/11/19- Now in Beta, I have the full 4 digit addressing working.

I thought I would post an update on my system progress. Above is a shot of the Protothrottle and the node configuration screen. I’ve got this almost finished, I only need to add some refinements for the servos in order to do live steam or in the case of diesel DCC locomotives, control the front and back couplers.

Anyhow, to recap some of what I said in previous posts- the configuration web app runs on a Raspberry Pi Zero W which is configured as a stand alone Linux server. I did this so it will work on any display device using a browser- phones, tablets and computers, regardless of brand (IoS, Android, Windows, Mac). The hardware is very similar to the ISE ESU hardware, in fact, it’s almost identical. (a pic is in one of the posts below)

The Zero is configured as a Wifi access point with DCHP and DNS. Backend services are provided using Flask (python) with an html and javascript front end. I’ve added MySql and Redis to keep track of things and there is a background process that runs all the time to handle the root access to the Xbee board. It sounds complicated and the software was a bit of a challenge but once its configured properly, it just works.

I’ve tried to keep this very simple, above is the main page when you connect to the RpiZero web server. You can click or touch the ‘scan’ button and all of the Xbee devices on the network will be queried and saved. You can then click any of the nodes to ‘zoom in’. Each node will support a DCC output and servo outputs. I run both diesels and live steam so I am building in servo control for both. ‘Diesel mode’ will be used to control the two couplers on a battery DCC locomotive. ‘Steam mode’ will allow the throttle and direction controls on the PT to move servos in a live steam locomotive.

Here is a shot of the main node configuration. There will be another screen when I get my ‘Airwire Translator’ working but that’s a whole other project. I do have the basics for that coded up and prototyped but it will be a while before I get that one together.

Anyhow, a few specifics on the parameters- the Protothrottle ID and the base ID are pretty much fixed unless you want to run multiple combinations of protothrottles- the Xbee DCC Node looks at both of these values and they have to match or the message is ignored.

The loco address is (obviously) the address of the locomotive you wish to control. Unlike normal DCC implementations, I don’t change the DCC address on the decoder- it’s always set to the default- 3. Since the Xbee Node only talks to one DCC decoder (internal to the locomotive), it just makes things more complicated if you change it so I require it to be fixed. The Xbee addressing and messages take the place of the DCC ‘network’ (ie, the ‘track’)

Below the Loco Address is the consisting setup. You can set consisting to OFF, FWD or REV and then enter the address of the lead locomotive. If anything other than ‘OFF’ is set here, the Xbee node will respond to the consist address and ignore it’s own address. Since the Xbee message is broadcast to all locomotives at the same time, this gives you unlimited consisting.

Below the Consist setup is the CV Programming parameters. Enter any CV Address and data into these windows and press ‘Prg’ to send a CV programming command to the locomotive. At some point I will expand this to include english language setups for both the Soundtraxx TSU-4400 and the TCS Wow 501, but for now this gets the job done.

Next is the servo setup. There are two servo modes, ‘Couplers’ and ‘Steam’. Couplers (servos) can be assigned to the DCC function codes to open and close them. This is not completely implemented yet, but the hooks are there. In ‘Steam’ mode, the Protothrottle throttle lever will be passed to servo 0 (taking into account the low and high limits) so that you can control the speed of a Live Steam Locomotive. The second servo will then be used for direction control. For both of the servos, regardless of the mode, you can set a reverse and a high and low limit.

So, that’s about it. I will be installing all of this in a couple of my locomotives to do some ‘real world testing’ once the weather improves a bit and spring rolls around.

I have two of these for the time being (one is a loaner from iowa scaled), so I am putting some cycles into developing a web app to handle the Xbee network these guys inhabit. It is way cool how the Protothrottle backend works. It sends out broadcast packets to every Xbee on the network but leaves a huge space for directed messages.

In light of that, I’ve come up with this minimalistic setup to send those directed messages. Super simple hardware. A Raspberry PiZero W, configured as a Wifi Access point with an Xbee as a USB device. It’s running Apache web server and Python Flask on the backend. I’ve thrown in MySQL and reddis (database apps) and created the basics for a web app. Because of the way linux works, I need a background process that runs as root that actually talks to the USB/Xbee. (the web app doesn’t have access to the hardware) I run two reddis queues so the web code can build the messages and then the root process can receive and send them. Took a while to get that working right but it’s doing quite well now. Everything starts at powerup. I like stuff to ‘just work’ when you turn it on.

Using this interface, I can scan for all the nodes on the xbee network and then direct specific message packets to each using a web based interface. Or in other words, I will be able to configure a DCC decoder in a locomotive with my smart phone while I control it with the Protothrottle. Way cool!

Above is how the Windows PC sees the RPiZeroW, it’s just another Wifi network. Once you join here, the RPiZW (linux) handles all of the DHCP and DNS stuff so you can use any browser to get to it. Below is the console login using windows 10 bash. You can just ssh into the Rpi, just like a big ole honkin web server box (even though its only as big as two postage stamps, ha) As you can see, all of this is over Wifi, I have no hardwired ethernet.