What is it about the holidays that makes me think about model trains?
I’ve got a week off before crunch time really begins at work, so I’m home enjoying the company of the missus and just relaxing. And, for some reason, I’m thinking about model trains.
Mind you, I’ve always been pretty interested in model trains (and model making in general) although it never really rose to be a real hobby of mine. But something tickled my brain recently about it, and I’ve been doing some reading and watching of YouTube videos, and thought I’d write down some thoughts here.
I think that part of what got me thinking about this was realizing that unlike the old DC/rheostat control that was typical when I was a kid is no longer the only game in town. Traditional DC control had no intelligence whatsoever in the train. The tracks basically form a DC power supply for trains. Higher voltage on the rails makes the train go faster. But this means that you can’t really run two trains at the same time: they would both get the same voltage and would have to move in tandem. But even that doesn’t really work out, as the two locomotives likely respond to voltage differently and one would rapidly catch up to the the other.
Thus, if you are going to make large layouts, you end up dividing your track into zones, with complicated switching and separate power supplies and throttles to help you move trains between zones without creating a short circuit. Indeed, making such complex networks is part of the attraction for some in the model train hobby.
But advances in electronic control mean that it’s possible to do things a different way, by embedding some intelligence in the trains, and using the track not just as a simple power supply, but as an actual communication and power bus that can send control signals to individually addressed locomotives. The most popular of these seems to be DCC, or Digital Command Control.
The basic idea of DCC is that instead of using the rails as a simple power wire, the wires now encode a digital signal which can be used to transmit data packets to locomotives or other accessories like switches. Let’s call the two rails A and B. In a normal DC train, the difference between the two voltages on A and B would be considered the control signal. More voltage makes the train go faster. Reversing the polarity makes the train reverse direction. But in DCC, rail A and rail B are always of opposite polarity. The trains work by rectifying this essentially AC signal to provide a DC power voltage that they can then adjust (via a buck converter, essentially) to power the motor. But in addition to providing power, the signals convey digital information to the locomotive by flipping polarity. If the polarity switches in around 58us, then a 1 bit is being sent, where if the polarity shifts on something more like 100us, then it’s a 0 bit. The DCC specification tells you how you can form data packets. Decoders built into locomotives or track accessories have addresses, and so you can send data to individual items on your network. This means that you can have two locomotives (or more) sharing the same section of track, but getting independent control signals to tell them to move independently.
Neat.
But frankly, kind of expensive. Instead of just a transformer with a knob, commercially produced “command controllers” are significantly expensive, running well over $100 and up to several hundred dollars. That seems pretty steep.
But then I started reading about some clever guys who decided to use Arduino controllers to build their own command stations. The basic realization is that an Arduino combined with a Motor Shield (which is really just an H-bridge) can (with the addition of proper software) generate the necessary signals onto the track to control DCC ready locomotives. And luckily, someone has already gone to the trouble of writing the software. The basic details are described pretty well here:
It should be noted that in reality you can probably build the system for about $10 by ordering parts from China.
But I don’t have a fancy DCC equipped locomotive, and don’t think that spending money to get one is the best way to start working in a hobby I’m not sure is going to stick. But I got to thinking about it, and realized that I could use the same hardware to make a simple DC controller too. I’m not the first to think of that, in fact, the same guy who made the video above suggested it:
In a binge of thinking about this, I signed up for a couple of Facebook groups on budget model railroading, and someone asked the question “why aren’t people using wireless/bluetooth for this kind of stuff?” And that is actually a very good question. It coalesced with some thinking that I had been doing, which basically fall into the “why aren’t people homebrewing more control electronics for model trains?” After all, services like JLCPCB enable you to make professional circuit boards for very cheap. Arduino Nanos cost about $3 each, and a similar cost for LM398 H bridge modules. And sensors of all types are actually easy to get.
Projects like DCC++ are great because they allow interoperability with commercial modules and locomotives, but what if you didn’t actually care about that? One thing that I thought was pretty antiquated was that while it is pretty straightforward to send signals to locomotives, DCC doesn’t do a lot to help you get signals back from sensors around the layout.
I began to wonder if someone else had gone down this path. And a gentleman by the name of Steve Massiker has. He has the website arduinorailwaycontrol.com which is pretty nifty. He has a board he calls the URB (Universal Railway Board) which is basically just a motherboard for an Arduino Nano and a Darlington driver chip (the ULN2003, which is common and cheap), and communicates with other such boards via the I2C bus and with your phone via Bluetooth. Very neat. What’s super cool is that he also has the Gerber files available for free download, so you can have them made up with your favorite PCB board manufacturer. I was sufficiently intrigued that I ordered 5 from JLCPCB for $18 with DHL shipping. I should get them next week.
All this pondering may result in nothing. In particular, my job is taking up a lot of my time, and I think about far more projects than I actually start, and start far more than I finish. But I am going to keep this in the back of my head.
Any of my readers actual model railroad enthusiasts? Feel free to get to me via twitter or leave a comment below.
I suspect the world would be better if that percentage were even greater.
Apparently 15% of all web traffic is cat related. There's no reason for Brainwagon be any different.
Thanks Mal! I'm trying to reclaim the time that I was using doom scrolling and writing pointless political diatribes on…
Brainwagons back! I can't help you with a job, not least because I'm on the other side of our little…
Congrats, glad to hear all is well.