I'm trying to find a way to create a power/data coupling between train cars that can be connected/disconnected like the car coupling magnets. Has anyone done anything like this?

Background: This is so that I can supply power and control to LED lights (and maybe other devices) in the cars being pulled behind the engine, which will provide the power and control unit (Arduino based MCU)

I've tried using a micro USB magnetic connector, but they are too bulky and don't flex easily enough for this.

I'd love to find if anyone has engineered anything similar.


1 Answer 1


Power and Data

The classic solution to this for model trains is Digital Command Control (DCC). Basically, when you provide power over the rails, you also include a data signal riding on top of it. Each locomotive or car with a remote controlled function needs an electrical connection to the track and a modest microprocessor to decode DCC instructions. You can do something similar with LEGO trains, but it requires some customization.

For example, here's a modification that I made to one of my 9V motors to include a small microprocessor that controls the wheels instead of driving them directly:

9V motor mod

This solution requires that you are using either 9V or 12V powered rails, and is also very expensive as it requires a number of motors that are no longer in production and are expensive on the secondary market.

Data Only

Assuming that you are just powering a few LED lights in your cars or perhaps a small unloading mechanism that is used infrequently, you can probably get away with using a small lipo or similar battery for your cars. In that case, you just need to figure out a way to get access to control data.

If you just need one way data, you could use a very basic RF receiver/transmitter pair (e.g. receiver, transmitter). This gets tricky to scale up, as you need a separate frequency and transmitter for each car, but could work with a small number of controlled cars.

The solution that I would probably use if I were trying to do this would be to put an ESP8266 in each car:


These parts are quite cheap ($2 - $5) USD, can consume very little power if programmed properly, and provide a ton of flexibility. They provide and 80 MHz CPU and connect to Wifi networks, so you can control everything from a computer if you'd like. They also provide plenty of I/O pins and are more than fast enough for PWM, so you can have fine-grained control of everything and integrate sensors into locomotives and cars if desired.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.