The Arduino Hits The Rails

Certain hobbies come in clusters. It isn’t uncommon to see, for example, ham radio operators that are private pilots. Programmers who are musicians. Electronics people who build model trains. This last seems like a great fit since you can do lots of interesting things with simple electronics and small-scale trains. [Jimmy] at the aptly-named DIY and Digital Railroad channel has several videos on integrating railroad setups with Arduino. These range from building a DCC system for about $45 (see below) to a crossing signal.

There are actually quite a few basic Arduino videos on the channel, although most of them are aimed at beginners. However, the DCC — Digital Command and Control — might be new to you if you are a train neophyte. DCC is a standard defined by the National Model Railroad Association.

Continue reading “The Arduino Hits The Rails”

Decoupling Lego Trains Automatically

Lego train sets were introduced almost 50 years ago, and since then, one thing has been constant: the trains connected with magnets. While this is a supremely simple means of connecting locomotives to rolling stock, there is one big disadvantage. Building decouplers – devices that will separate one car from another – is difficult.

Now, with a clever combination of racks, gears, and wedges, trains can disassemble themselves. They can even do it with an Arduino.

wedgeThis decoupler works by effectively wedging cars apart from each other. With a motor from an old Lego Technic set, a few gears, shafts, and a rack, a device can be constructed that fits between the rails of a track that raises into the undercarriage of rolling stock.

Because this rolling stock is moved around with a locomotive, all that’s needed to separate two halves of a train is to move the locomotive forward. Yes, it does mean that the connection with the weakest magnet is disengaged – not necessarily the connection you want to decouple. However, with only one car and a locomotive, there’s only one connection to break. Simple enough.

This Lego decoupler can be further improved with an Arduino, a few ultrasonic sensors, and an IR detector to make a fully automatic decoupling siding for a Lego train layout. You can see all this below operating with a full state machine that perpetually switches rolling stock behind a locomotive.

A great use for Legos.

Continue reading “Decoupling Lego Trains Automatically”

IoT Enabled Thomas The Tank Engine

This month the popular “Thomas the Tank Engine” toy celebrated its 70 anniversary. As a fun project, [tinkermax] wanted to bring this traditional toy into the age of IoT, while preserving its physical appearance and simple charm.

He used a model called the “Diesel” which seemed big enough to house the electronics, but proved otherwise once he inspected the innards. He needed to fit in an ESP8266 module, an accelerometer breakout, some discrete parts, a nifty analog multiplexer, and a 14500 3.7V LiPo. Once done, he was able to control its speed remotely over WiFi, with an auto “throttle-boost” that kicks in when the accelerometer senses that the train is going uphill, and has remote monitoring of battery state, engine load, inclination and track vibration – all in real-time using MQTT over WiFi. It’s quite a demonstration of the power of these super-cheap WiFi modules that are powering the current wave of IoT innovation.

The train motor works off a single 1.5V battery, so [tinkermax] tried a couple of boost converters to get the ESP-12 to work. But the modules were a tad bigger, and couldn’t provide the high peak current needed by the ESP-12. So he used a 14500 3.7V LiPo battery instead. A series diode drops the LiPo voltage to a circuit friendly 2.9V ~ 3.6V range. The ADXL345 accelerometer is used to measure “pitch” to detect going up and down a hill, “roll” to check for tilt or tip over and vibration to identify track defects. It communicates with the ESP-12 using a special Lite-SPI library that he wrote.

Two analog measurements are performed. One uses a resistor in series with the PWM driven motor to measure its current, with a low pass filter to smooth out PWM noise. The other is a resistor divider network used to monitor battery voltage. But the ESP-12 has just one ADC channel. Instead of adding another ADC module, [tinkermax] used a neat device – the FSA3157 – which allows two analog inputs to be channeled to a single output much like a SPDT switch. One PWM output is used to control motor speed and a second one to pulse a LED.

The sensor data is streamed 5 times a second over the MQTT protocol to a Raspberry Pi based MQTT broker. Finally, a JavaScript webpage receives the MQTT messages and plots the data graphically. One upgrade he would like to implement is speed measurement, to allow constant speed drive. If you have any ideas on how to extract that information from an accelerometer, chip in with your comments below. Check out his build log in the short video below. And if you’d like to see how all of this can be used in the real world, check this other video where [tinkermax]’s colleague gives a run down about a commercial enterprise IoT cloud platform hooked up to Thomas the Tank Engine.

Continue reading “IoT Enabled Thomas The Tank Engine”

Hackaday Prize Entry: A Broke Hackers’ Model Train

Model railroads are the wellspring of hacker culture; the word itself comes from the MIT Tech Model Railroad Club sometime in the early 60s. These old timers at MIT had incredible resources available to them – multimillion dollar computers, vast amounts of plywood, and real metal tracks to run their trains on. [Szabolcs] doesn’t have any of this, so for his Hackaday Prize entry he’s building the Broke Hackers’ Model Train layout.

Nothing except for the most basic components in this train layout is pre-bought. The tracks are 3D printed, motor control is done through homebrew electronics, and the locomotives will be controlled through a custom protocol. It’s the apex of a hacker’s model train layout, and when you consider how much effort goes into building a normal train layout, [Szabolcs] is looking at a lot of work.

With all the work ahead of him, things haven’t exactly gone smoothly for [Szabolcs]. To print off all the parts for this project, he bought a Makibox, one of the biggest failures in the world of crowdfunded 3D printers ever. The company doesn’t exist anymore, so [Szabolcs] shelled out the cash for an i3 clone. The new printer works great and plastic parts are coming out. A little hiccup, but a great example of what it takes to put a project together for The Hackaday Prize.

The 2015 Hackaday Prize is sponsored by:

Because You Can’t Go To Germany Without Seeing Model Trains

As with all our extracurricular adventures, we needed to visit a few hackerspaces while in Munich. The first one was MCSM/Make Things Munich, formerly the Siemens Club for model engines. We’ve been to a few hackerspaces and have the passport stamps to prove it, and we can say without a doubt this space is unique.

MCSM was a hackerspace before the concept of hackerspaces existed. Originally, this was the Siemens Club for Model Engines, filled with engineers from the Siemens plant tinkering with model trains, model boats, and models of anything that moves. One of the members that guided us through the space, [Carlos Morra] told us when he joined, he alone dropped the average age of the space’s membership by a decade.

Inside the space, you’ll find the usual tools and equipment – lathes, CNC mills, an electronics workbench, and a bunch of old but still valuable equipment. Most of this equipment was salvaged from the Siemens plant. The organization for this space, though, cannot be compared to anything I’ve ever seen. There are floor to ceiling cabinets filled with everything you can imagine, all carefully indexed and sorted.

Of course, being formerly called the Model Engine club, there will be an immense train layout. I counted at least five gauges of track in two sprawling layouts, one of which was easily 15 square meters. It’s a true hackerspace built from a model train club, how can it get better than that?

Pictures below.

Continue reading “Because You Can’t Go To Germany Without Seeing Model Trains”