Arduino Train Junior Lite

Arduino Junior Train Lite App is remote control for URB train control system. Requires a any Arduino board, a Bluetooth module and any motor-driver (or shields) to operate. You have control under 2 turnouts, traffic signals and trains of your railway. The custom button adding manage to the railway crossing or lighting of houses and streets of your layout. Encouraging creativity and learning electronics is a very simple and clear control system. By changing the sketches you can get new controls and adopt it to your layout.

This application has the following features:
  • Dependent behavior of the loco's states control elements
  • Slider Algorithmâ„¢ (improved Slider Control)
  • 12x speed control
  • Switching two turnouts any types
  • Version 3.0 now supports Protocol 2.3
  • Universal button
  • Whistle sound button
  • Odometer
Android app Arduino Train Junior Lite
Railway starter sets

This application perfectly fits for manage under the Starter Set. 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.

The first example of using URB control system dedicated to beginner railway modellers, shows how to just start playing with your railroad using Arduino and a smartphone. It is enough to have a any classic starter railway model kit and even a schoolboy will build this scheme in a few minutes.

All details presented on video will also be used later for the URB project. You need the Arduino NANO board, the Bluetooth-module HC-06 and the motor-driver L298n is connected to the rails. All arduino's details for this experiment cost less than $ 10 on AliExpress and similar online stores. If you already have any Arduino's board (like UNO, MEGA and etc.) and shields, you can also use them.

Simple start

An example in this video is a typical version of robot control based on Arduino. Similar schemes you will easily find on the Internet. The only difference is that the output of the motor driver is connected to the rails, and not directly to the motor.

Before the assembly of the circuit, you need to upload to Arduino program called a sketch.

Sketch for this experiment is based on the example SerialEvent from Arduino IDE. In general, all the sketches of this project are written at such a level so that they can be easily converted for to your needs. Their complexity at level a examples Arduino IDE.

First sketch

What is Arduino

Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's intended for anyone making interactive projects. Over the years Arduino has been the brain of thousands of projects, from everyday objects to complex scientific instruments. A worldwide community of makers – students, hobbyists, artists, programmers, and professionals – has gathered around this open-source platform, their contributions have added up to an incredible amount of accessible knowledge that can be of great help to novices and experts alike.

Platform Arduino is constantly evolving, and now the site presents modern hardware based on chips from Intel, ARM and ESP. For the URB project, these opportunities are redundant, so I use equipment from chapter ENTRY LEVEL, and only Arduino NANO.

Power supply

The power divided into two branches, one for moving trains, the second for electronics and devices on the layout. Thus, with short circuits on rails and other troubles with trains, the layout control will not be affected.

To turn 5V power on your Arduino, use any charger for modern smartphones with a USB connector. The current of such chargers should be about 1 A. For the movement of trains, you can use the transformer you already have from the starter set or any DC power supply with 12V. Please note that the output current also should be about 1 A or more.

It is convenient to carry out the connection of wires between the power supply unit and the motor-driver through the power plug-screw terminals.

USB charger
Analog controls transformer
Power plug-screw terminals

Second example | More trains

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 number two. 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 :)

Track-plan for second example

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 turnouts. Turnouts 2 and 3 are controlled synchronously. Signals also are controlled by the turnouts position. Try to change the algorithm for switching them in the sketch.

Train wires connections
Power train and relay connections
Electric Switch Machines

In the project URB you can apply any types point-motors for switching turnouts – servo, electromagnetic and having a stepper motor. Features of the use of different types, see the section of the URB project.

But in this example for beginners, I will show how to use the classic electromagnetic motor. The sketch is written for this type of device. To connect an electromagnetic drive, you will need either a ULN2003 Motor Driver Board, or a breadboard plate with wires and a ULN2003 chip.

Electromagnetic coils Switch Machines

This design has one advantage – it is compact. The disadvantages are much more: you need a separate power source with a voltage of 14 to 17 volts, as opposed to a servo drive, you need two wires to control and so on. Therefore, you need have a separate 16V DC output on your power supply terminal block of or have a separate source of this voltage.

Compatible apps:

  Arduino Train Junior Lite

  Arduino Train Junior PRO

  Arduino Train DUO

Requires OS Android 5 or higher

Second sketch


Insulated rail joiners

Insulated rail 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.

Arduino 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.

Model railway signals


You can use purchased signals with two LEDs or make them yourself. Please note that the voltage for switching on LEDs in Arduino is 5V.

Electric circuit
Example 2 Arduino circuit

There are several ways to connect LEDs in model railway signals. If you have a signal with a common plus, as opposed to the one shown in the picture, then simply change the commands for controlling signals to opposite ones in the sketch.

Often there is a situation: you have assembled your system and its elements work the other way around, that is, instead of the red signal, the green signal turns on, the turnouts switches to the wrong position, moving direction the train doesn't correspond of arrows sign on buttons in the application, and so on. You can invert the behavior of your control system by the classic method: swapping the wires connected to the device. But it is much easier and faster to simply update the sketch – not need hard working with the wires.

Small Interlocking system

This is the same system that is presented in the video. The only change is that for the Junior Light application, the arrival's traffic signal of the station area is reset to GREEN 15 seconds after the train passes, since this application does not have the AWS function (Timer Mode). You can change this delay, as well as all other parameters of trains movement in the sketch for the COMM unit.

This system involves the use of two URB units. The following hardware is also required:

  • 2 Motor-Driver L298
  • 7 any type sensors
  • Relay
  • 2 Servos
  • 6 LED signals
Small Interlocking System

When turned on, the control system operates in classic DC mode and is no different from the examples described above. The sketch code is also similar to these examples. When the CUSTOM TOOLS button is pressed, the interlocking variable is set to TRUE and sections A, B and C go into automatic control mode with one-way traffic. You can turn OFF or ON this mode at any time.

By changing the values of the variables speedBlock (1-3) you can set individual speed modes in each of blocks. You can choose the length of the braking distance by changing numbers on the code block:
if (speedBlock1 > 40) speedBlock1 = speedBlock1 - 25;
else speedBlock1 = 0;


Small Interlocking sketches (ZIP)


The site will gradually appear new examples adapted to your requests. If you have a desire to see your track plan on the site, then send me message.

Any sketches or circuits presented on this site is not a dogma. For example, you can see that the wiring between the Arduino and the Motor-driver is different in these examples. That is, you can always change your project just by modificate the sketches.

Project documentation is available to advanced project participants in the URB Club.

Free URB Final

URB unit

As you see, that asembling of the circuit by connection wires over the breadboard is a very inconvenient task. As the circuit becomes more complicated and the components added, problems are added with the correctness and reliability of connecting the wires and blocks. Therefore, I suggest you make a free URB unit that solves not only these problems but also adds new tremendous functions. You can collect a similar scheme on the breadboard, but URB is much more convenient!