Android devices

Control your trains
via smartphone

The Main Principle of the whole project is the minimum complexity and inexpensive components. Trains are moving by simply apply voltage to the rails, the loco speed change use PWM method. It's classical DC system – no DCC, no decoders.
This is a plain and clear system. You can even use the URB project for educational purposes.

Arduino sketches

Switch turnouts
from App

You make route selection via the App setting up routes using Servo, point motors, and Tortoise motors through Arduino sketches.

You make route selection via the App setting up routes using any devices – servo, point motors, solenoids, and Tortoise motors through Arduino sketches.

New apps

Smart signals
and tracks indication

Convenient direct connection of signals and sensors to the URB connectors provides easy installation. Together with the availability of information on the position of all junctions and the ease of programming Arduino all it is now easiest. Without any computers! Just turn layout power on and everything works!


Which model railroad sets can be used with the project

It is enough to have a any classic starter kit and even a schoolboy will build this scheme in a few minutes. You can use any railways scales, any manufacturers, and even old dusty boxes with railways from your childhood.

The main thing that the rails were metal and in the locomotive was a serviceable DC motor. If you already have automatic turnouts (usually they contain two solenoids), then the URB unit allow you to control them directly. Also on the main site there are detailed instructions and videos on how to build the motor-points yourself using servos. All examples shown on this site use servos.

Detailed instructions for beginners can be found here.
You can also watch a lot of interesting things on my YouTube channel.


Android app Arduino Train for Kids 2

Arduino Train
for Kids 2

It is enough to take any children's railway, the main thing is that the locomotive had a motor and a place for batteries. You can even buy a few simple sets with plastic rails, and manage several trains at the same times. Lego Trains, Big Thomas Coal Steam and so on is good example.

Method of installing a Arduino in the locomotive.

Android app Arduino Train Junior Lite

Arduino Train
Junior Lite

This application perfectly fits under the Starter Sets for Model Railroading. It not only replaces the wired remote from the kit, but also adds many new features, making the game more fun. This application controls turnouts and have the sound of horn. You can use several locomotives and add railway signals to your game.

Android app Arduino Train Junior Pro

Arduino Train
Junior PRO

More powerful application uses most of capabilities of URB units. Two players mode. Feedback between the application and your layout will allow you to implement the mechanism of automatic train stop before the deadlock. Also you can use any sensors for Arduino, since in the application there is a AWS mode.


New

Season 2019 / Episode 1

Free upgrade Arduino Train Junior to PRO

Railway modeling should be fun! Therefore, I added the ability to control trains by two players in the Arduino Train Junior PRO app. Previously, this feature was only available in the DUO and DNT versions.

Cooperative management of your railway layout allows you to come up with many new variants of the behavior of your trains. You can together manage one train at the same time (the most fun option), manage two sections of tracks with several trains separately, or use one application to switch between sections of layout paths, implementing multiple train control using one application. This control system is a bit like a classic from postwar style Lionel Trains layout.
The PRO version also provides full support for the sensor system for automatic control, similar to the AWS system in real railways. See description of the possibilities on a video.

I also received a lot of questions on the use of the URB unit. Guys, we can use it. Or can't use. Whatever!
Arduino will work without these units. But only with URBs construction of schemes becomes much more convenient and reliable.

Especially to clarify this, I came up with this example. You can build a circuit for Arduino in a variety of ways and using any Arduino model. In the pictures I gave three versions of the same scheme for NANO, UNO and URB.

I will be pleased to answer your questions and read your opinion on these experiments on Reddit.com

Players behavior

 


Experiment 0

The simplest scheme collected on the Arduino breadboard. Only the Arduino NANO board, a bluetooth module and a motor-driver needs.

Unfortunately, attempts to collect more complex schemes given below are often unsuccessful. There are too many connections, and people start to confuse wires and contacts. Accordingly, the problems begin. To avoid such a situation, I came up with a free URB unit. And as soon as you start using this unit, you will get a huge amount of advantages over similar devices.


Experiment 1

Make a circle of rails and add the branch track. Using pictures collect your first scheme. Prepare power supply adapters.

Upload the sketch into Arduino NANO and install it into the connector of the URB unit. Turn on the power, run the application on your smartphone, then connect on App via Bluetooth with your railway and start gaming.

Track plan 1

 

If something went wrong, then take a look a troubleshooting chapter. Do not worry, the URB unit is designed so that you can not break it.

Download sketch

Upload Sketch Upload sketch

 

Connect Power Connect Power

 

Connect Motor-Driver Connect L298

 

Wires to rails Wires to rails

 

Connect servo Connect servo

 

Plug Bluetooth and NANO Plug Bluetooth and NANO

 


Experiment 2

In this experiment you can control two locomotives. Insulating joiners on the lines A, B and C block current on these lines. Wires, unblocking this lines, are controlled by relays that automatically switch according to the position of junctions. Junctions 2 and 3 are controlled synchronously. Signals also are controlled by the junctions position. Try to change the algorithm for switching them in the sketch.

Motor-driver, servos and Bluetooth are connected to the URB unit as well as in the first experiment. Connect wires to the relay block according to the picture.

Relays connections

 

Download sketch

Rail map 2

Railway signals are rarely found on layout, and their availability is a sign of professionalism. Not this the modelers do not want to install them, but that not a trivial task – the algorithm for switching many signals needs to corrected for each railway line. So you need a large computer with software or branded digital sets from manufacturers.

But with the Arduino everything becomes much better. Convenient direct connection of signals and sensors to the URB connectors provides easy installation. Together with the availability of information on the position of all junctions and the ease of programming Arduino all it is now easiest.

 

Variant the sketch for Electromagnetic Coil Point Machines

I prefer to use servos to switch junctions, but in the URB project you can use any type of point-motors. The most common types of such devices are drives with two electromagnetic coils.
This is a very simple mechanism consisting of two electromagnetic coils with mechanical current interruption contacts at the extreme positions of the drive.

Typical Coil Point-motor

This design has one advantage – it is compact. The disadvantages are much more: you need a separate power source with a voltage of 15 to 25 volts, as opposed to a servo drive, you need two wires to control and so on. The last remark is important, since if we try to connect the three electromagnetic drives to the Arduino in our experiment, then we will not have enough GPIO pins.

There are no limitations on the number of pins in the URB project, so just add one more unit. This way of expanding the number of outputs provides several more advantages – you do not need to write a complex sketch for one unit and you can move the local unit nearest to the devices it controls.

Attention

Booster for a high current load in a unit is Darlington array (ULN 2003). It is connected to pins PD2-PD8, it is also designed for dempfing inductive load with reverse current. But for cases of incorrect triggering of the terminating switches in the point-motor, the signal is automatically disabled in the sketch by time-out (see milliss function). You can even exclude terminators from the scheme, simplifying it, and everything will work correctly.
Also note that this chip is installed only in a Local unit.

Point-motors heritage

Experiment 3

My project works as DC mode, which means that if you add a second train at rails of circle, then both trains will start moving. And further events depend only on your skill in management. And it already looks like a computer game, but only in reality.

To add fun, I came up with the following track plan. One of the option of the game is that you release the second train from the station at a certain point in time, trying to avoid a collision with the first train moving in a circle. To do this, you switch the junction number one. Then you can stop both trains, change the direction of movement and send the first train to the station. Or think up your own way of dispatching train traffic :)

As in previous experiments, Arduino will perform all the switching of electrical connections. A feature of this sketch is a algorithm of separately relay switching, similar to that shown in the video (see behavior of junction A).

Another change in the sketch is the introduction of a serial software port. This gives new features: updating the sketch without unplug the bluetooth module and show messages for debugging on the Arduino IDE serial monitor.

 

Download sketch


Soon more experiments!


Hardware set

It's just the way of the world, that without hardware, any program on Smart Phones and Tablets can not influence the reality. You may use any Arduino's platform (UNO, MEGA etc.) and any shields. But I recommend making several URB units.

Universal Railway Bus unit is first and foremost a convenient and reliable connector, replacing the breadbord and a bunch of wires. A more important feature of URB is the integration of several blocks into a chain, and on this basis the construction of any electronics for layout and control. In other words, it is a universal controller for railway modeling electronics.

Details for project

The figure shows the minimum set of parts for creating electrical circuits in these experiments. All these parts are widely available in online stores and electronics stores. You can supplement this set with any modules for Arduino: sensors, stepper motors, LEDs and other things.

Also, you will need wires and two power supplies for 5 and 12 volts with a current of at least 1 A

 

Railway details

 

Traffic Signals HO Scale

LED signals

Use ready-made LED signals at 5V or create them yourself.

Insulating rail joiners

Insulating joiners

Rail joiners are small clips used to join two sections of track mechanically. They come in metal (nickel silver) which also connects the rails electrically, and plastic which are insulated to isolate the two sections of track electrically.

URB27

The URB unit

To connect details of Arduino with each other using a Breadboard and wires it is possible, but it is very inconvenient and unreliable. And to avoid this, I came up with a URB PCB.


Bluetooth HC-05

Bluetooth

HC‐05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup. Add a level converter 3.3V -> 5V to this module.


L298

Motor-driver

The L298N is a dual H-Bridge motor driver which allows speed and direction control of two DC motors at the same time. The module can drive DC motors that have voltages between 5 and 35V, with a peak current up to 2A.

Arduino NANO

Arduino NANO V.3

The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328P (Arduino Nano 3.x). It has more the same functionality of the Arduino UNO, but in a smaller sizes. It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one. Purchase at least three Arduino NANO.


Relay module

Relay module

A Relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate the switch and provide electrical isolation between two circuits.


Servo HG-90

Servo

A servo motor is a motor whose shaft turns to position something based off a control signal. They can be used to position or adjust almost anything you can think of. They consist of a plastic housing which contains a DC motor, a control circuit and a few gears for torque.


Commands from Arduino Trains Apps

All my Apps based on open system of commands for interaction between the management console and all the devices of your layout. Full description these commands see at chapter Protocol 2. You can change and add to the protocol new commands, like everything else in the project at your discretion.

The figures show the correspondence between the buttons in the application and the protocol commands.

Android commands Arduino Train Junior Lite
Android commands Arduino Train Junior PRO