Welcome!
Currently, electrical model trains are controlled by a technology called DCC (Digital Command Control). The principle of this protocole is to modulate the voltage on the rails in order to encode messages. The central station encodes the message it wants to send and sends it through the rails to the train. No messages can be sent by the train to the central station. DCC imposes a unilateral communication, is very complicated to implement, pretty cumbersome (it requires a lot of wiring), and quite old.
RoseOnRails is the very first revolutionary product that replaces the DCC with a control based on Bluetooth Low Energy (BLE). Each element (train, turnout, LED) is provided with a PCB
(Printed Circuit Board) able to communicate using BLE. You can now:
- Control the train: change its speed and direction
- Control the turnouts: change their position
- Control the LEDs (we have drilled the rails and glued shiny LEDs underneath them, see photos): control the RGB color of each LED
simply by connecting throuhg BLE to the device you want.
THE GAME
Our
second goal is to let you use our system in the framework of a multi-player game.
The aim is to roll your train over as many as LEDs as you can, in
which case you light off the LED and make points (a bit like in Pacman). Thanks to our new BLE-based protocol, the central station not only gives orders to the circuit, but also receives information from it (mainly, the train can now notify its current position on its own).
Follow our step by step progress on the official ROSE 2014 website
Hardware - PCB schematics
Light up your rails with RoseOnLEDS!
Instead of the traditional "dull and joyless" rails, we decided to put some LED in the project by installing ledstrips beneath the rails. Your goal, as the player of our Pacman-based game, is to "eat" the LEDs by rolling on them and turning them off.
For this, we used WS2812b ledstrips, which consist of RGB LEDs each of which is controlled by a minuscule micronrontroller. We have a total of about 600 LEDs. We first drilled the rails, then cut the ledstrips in little pieces to put one LED beneath each whole on the rails. The little ledstrip pieces are soldered together. The photos describe the whole process.
Hardware - LEDs
Hardware - PCB of the locomotive
Hardware - PCB of the turnouts
RoseOnRails at night
RoseOnRails at night
Project presentations
RoseOnRails - Final presentation (FR)
Software - How it works (on the PC)
Everything in our system is handled by our so-called "Central Station". Concretely, it's an application (a series of programs) that runs on a computer and that does two main things:
- Receive commands from either the user directly, or the intelligence module (see below).
- Forward orders to the circuit through BLE.
For the first point, we have a program written in Python that receives commands through websockets.
For the second point, we use noble, a node.js module for BLE on Linux. This part is written in Javascript.
The two modules communicate using the AMQP protocol. The AMQP impelmentation we use is RabbitMQ.
See the image-widget below for a sum-up of our global architecture.
What is the intelligence module?
The (artifical) intelligence module is responsible for making the game work. It's the intermediate module between the user and the gateway module which forwards the messages to the circuit through BLE. The intelligence module is written in Python.
See the image-widget for the visual sum-up of it all.
Our code is open source. Check it out on our bitbucket repository.
Software - Architecture
Software - How it works (flashed on the PCBs)
The BLE communication is made possible thanks to the BLE programs that we have written and flashed on each of our PCBs. The BLE stack we use is called SoftDevice, it's provdied by Nordic Semiconductor.
There is no special architecture regarding the our BLE apps. They are pretty simple: there is one app per PCB type (locomotive, LED and turnout). Each app is a C program that deals with the BLE events (commands received, or notifications to send to the Central Station, etc.)
Here are the BLE service and charactersitic UUIDs we use for our custom survices.
Services UUIDs
Locomotive : 00001520-1212-efde-1523-785feabcd122
Turnouts : 00001200-1212-efde-1523-785feabcd123
LEDs : 6e400001-b5a3-f393-e0a9-e50e24dcca9e
Characteristics UUIDs
Locomotive - speed: 00001521-1212-efde-1523-785feabcd122
Locomotive - position: 00001522-1212-efde-1523-785feabcd122
Turnouts: 00001201-1212-efde-1523-785feabcd123
LEDs: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
Don't forget to check out our code on bitbucket.
Comments