Playing with trains is fun. Coding with Meteor is also fun. So, why not control a toy train through the browser using Meteor?

What it does

The Meteor Train is a toy train, controlled by a Meteor application.

After booting the Raspberry and starting the Meteor application, you can connect to the UI using ip-adress:3000. If no one else is in charge of controlling the engine, you can take control of the train. Sliders allow you to set the driving direction and the desired speed. A big speed-indicator shows the current speed.

Other visitors of the application are considered as passenger, which are carried by the train, probably waiting for the chance to take over the engine. The count of the passengers is also shown in the cockpit.

How we built it

The project consists of several parts:

  • Hardware
    • A Playmobil toy train
    • A Raspberry Pi 2
    • An H-bridge to control the motor of the train
    • A 12V NiMH battery pack
    • A step-down voltage regulator to provide the 5V for Raspberry Pi
    • A WLAN adapter for the Raspberry
  • Software
    • Meteor running on the Raspberry
    • node-wiringpi to access the GPIO pins from Node.js

A toy railroad engine from Playmobil was taken to start from. It provides the chassis and the motor.

One team member created all the hardware stuff, soldered the H-bridge as well as other interfaces to the existing railroad engine. He had to drill holes in the plastic chassis for the cables and provide tons of experience to solve the voltage issues.

In the meantime, a second team member took care of the Meteor application, which provides the user interface as well as a logic to allow only one engineer at the same time.

The third team member was responsible for installing Meteor and the application on the Raspberry Pi hardware. He implemented the engine control, the control of the lights and parts of the UI.

Challenges we ran into

The first H-bridge (SN754410 Quadruple Half-H Driver) wasn't suitable for the planned operating voltage of 5V. So we had to change to another one: L6203 DMOS Full Bridge Driver. Furthermore, we changed the motor voltage to 12V.

Furthermore, we found out that developing for different Meteor versions is nearly impossible.

Accomplishments that we're proud of

We're proud of implementing all the stuff within the 24 hours, even we suffered several setbacks. We're happy that especially the hardware part was so well prepared that we could resolve the issues. We saw smoking electronic parts, but luckily they still work. And we really like the speed indicator.

What we learned

Use a boilerplate, only if you need the features within

First, we chose Base to start the project, but it contained so much stuff, that we actually don't need. So, we got back to simple Meteor templates.

Use the same Meteor version on all devices

We started with an older Meteor version (< 1.2) on the Raspberry Pi, but the desktop PCs were already updated. After struggling around with the different versions, we decided to update Node and Meteor on the Raspberry Pi – thanks to Nodesource and Meteor Universal it took less than the suspected five hours (on the Raspberry Pi 2).

Have a second hardware option available

It's easy to change a software decision during such a hackathon, but having a second option regarding the hardware really saved the project for us. Even careful reading the data sheets before ordering the parts didn't prevent us from using a non-suitable component in the first run.

What's next for The Meteor Train

A camera showing the actual view from the driver's seat would be fine, as well as playing the engine sounds – we already bought a USB sound card for this reason.

Meteor packages used in the project

  • twbs:bootstrap
  • meteorhacks:npm (for wiring-pi)
  • dpid:user-presence

Built With

+ 17 more
Share this project: