Instead of a long and not always successful making of a real console with buttons and throttle rudders, Arduino Train Apps immediately gives you many advantages:
— Works right out of the box – you just need to run the app on a smartphone or tablet
— Wirelessly. Bluetooth is integrated into any modern Android device
— You can use several Android devices for controls the one layout, that is, you can play together
— Useful app UI specially for railway modellers
— Free upgrade to new features

Arduino Train apps

Arduino Train DEMO

For testing system try the app with the simplest set of hardware, without using separate modules and URB boards. I still believe that using Arduino NANO is the most effective, and you can use ready-made sketches for UNO, MEGA and ЕSP32. All examples from the Entry level section are suitable for this application.

The sample offered here is very simple. You can use ANY model train kit with metal rails (for example, an old version of LEGO TRAINS with metal rails). Probably, if you are interested in my project, you already have such a kit or a set of rails and trains in a storage box.


Arduino Train Junior

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.

  1. Basic level of URB project
  2. Dependent behavior of the loco's states control elements
  3. Slider Algorithm™ (improved Slider Control)
  4. 12x speed control
  5. Switching two turnouts
  6. Universal button
  7. Whistle sound button
  8. Odometer
Arduino Train Junior Lite

Arduino Train Pro

It's multiuser app allow players interaction with other individuals in collborate control a railway. Another way to use it feature mode for single player is to switch controls between independent sections of tracks.

  1. All features of Train Junior
  2. Multiplayer control from two Android devices
  3. 24x speed control
  4. Inertia Mode Drive™
  5. Button for set turnouts to default position
  6. Switching four turnouts
  7. Interactive button AWS (Feedback mode)
  8. Support Extended Reverse Loop (Protocol 2.3)
  9. Native support extended automate and interlocking moving trains
Arduino Train Junior Pro

How use Bluetooth

The reason of using Bluetooth in URB project described on the Railworks page. According to reviews of modellers using my applications, there is often a confusing situation with the connection of several Bluetooth modules. The problem is not in the connection itself, it works very reliably, but in naming matching the multitude of devices paired with the phone with Bluetooth. Therefore, initially in my applications, the MAC-address of the connected device is displayed. In addition, on start each video about my applications, it begins with a video instruction on pairing Bluetooth module HC-06.

Since the project can use several Android devices, here I post the step-by-step instructions on how to connect in this situation.

Pairing a new HC-06

Power ON HC-05

Power ON

Search new BT devices

Search new BT devices

Select HC-06

Select HC-06

Enter pairing code

Enter pairing code

Repeat for other HC-06

Repeat for other HC-06


Connect HC-06 to the App

Push Bluetooth Icon

Push Bluetooth Icon

Choose HC-06 you need

Choose HC-06 you need

Connect established

Connect established

If you try to connect to the HC-06 module that is turned off or already connected to another phone, you will receive an error message. So just repeat the procedure with the another module.

Wrong selected BT device

Wrong selected BT device

Break BT connection

Repeated pressing to Icon breaks connection


More convenient trick

Another way to create a clear match between several identical bluetooth modules is set the individual name of each of them.

This is a very simple procedure. You only need to load the sketch into the URB unit and come up with a unique name. After changing the module name, turn off and then turn on the URB unit again. The name of the module in the Bluetooth network will changed.

More information about HC Bluetooth modules see here.

Set unique name to HC-06

The effect of connecting a USB cable together a Serial RX TX pins

I used a software serial port that can be connected to any GPIO pins of Arduino. It's solution add the independence of the Bluetooth channel from the USB. Thus it was possible without disabling Bluetooth upload the sketch from your computer via USB to Arduino, which was very convenient for experiments with sketches reprogramming. For two Drivers needs two Bluetooth channels, so if you forget to disconnect the second Bluetooth module connected to pins D0 and D1 from the Arduino then when you upload the sketch from the computer, you may will get an error or endless uploading in to Arduino.

Problem between Serial and USB

Arduino Train DUO

App with advanced settings and features. The foremost program from collection of Arduino Train. Implements ALL FEATURES of the URB project.

You can use several Android devices for manage your layout. Appeal for few inertial control modes, manage 16 turnouts, 3-way turnout, double-slip switch and 12 channels for lighting and mechanisms. Native support sensors.


The DUO application performs the functions of complete control of a model railway layout of any complexity and therefore, first, I will briefly introduce you to its capabilities.

  1. Cab interior UI
  2. One-handed operation
  3. High precision thrust rudder (24 speeds)
  4. Memorized state of Drivers control between their switching
  5. Classic and Inertia Drive modes
  6. Lite, middle, heavy and off inertia modes
  7. Extended Feedback
  8. Online indicate turnouts positions
  9. Sensors toggle (disable/enable layout sensors)
  10. Crossing and Turntable controls
  11. Extended layout control
  12. Automated Traffic Control (10 scripts)

Features

Switching turnouts

App DUO UI. Switches

The horizontal scroll contains 16 switches (Switch A … Switch P) for conventional turnouts and special switches for the three-position junction and the double-slip junction. For convenience, turnouts are grouped into four, marked with color marks.

Feedback indicator
Feedback switch

The URB system has two modes of online indication of turnouts status. Both of these modes are supported by the DUO application. To activate the feedback indication on the LAYOUT MANAGER tab, there is a FEEDBACK toggle. In this case, on the main LOCO CONTROL tab, the inscription FEEDBACK ON will light up.
There tab is now also a button to reset the position of all turnouts to the default state, it button was located in previous versions of the application on the main tab.

Extended train control

Extended control Train control

The application has the word DUO in the name, which means that you can use it on two Android devices at the same time. In this way, two people can control one railway layout. Possible, and most often used, the second method is separate control of two different segments of the common railway line (for example, separate control of the external and internal circles of rails). To switch between these segments, DRIVER SELECTOR is used.

The version of Protocol 2.3 added an inertial system for driving locomotives to the URB project and 24 speed control.
This led to a change in the state of the reverse lever, now it has only two positions and, by default, the direction of movement is assigned to the forward. At the same time, the lever has support feature of changes direction when passing the reverse loop.

The inertial selector has four positions. When selector off, the main traction lever looks like a classic control. If you select different inertial modes, the traction lever is automatically set to a central position and you control trains in acceleration and braking modes (I really like to use my new mode, as in a real train). You can change these modes during train control. For fun, to braking process of the locomotive I added a braking indicator, like in the real cab.

A CUSTOM button has been transformed into a switch CROSSING, for example, now you can control the railway crossing from the main menu.

Layout manager

Extended control

In the third version of the application, the way to control layouts devices is changed. All previous functions are preserved, but the channels controls switches are moved to the horizontal scroll.

Added turntable control. The first two buttons rotate the turntable to the next position clockwise and counterclockwise. The next button rotate the turntable 180 degrees, this is done to turn the locomotive with one cab (steam locomotive). The last switch turns on or off the voltage on the rails of the entire depots yard. For detailed commands for managing the turntable, see Protocol 2.4.

The functions of AWS and the interactive reverse function working only when the SENSOR switch is on.

For examples of use of the capabilities of this section, see Docs and URB Club.

Arduino Train Tablet

This application is made specifically for Tablets. All other Arduino Train apps can be installed on both the phone and tablet. The horizontal arrangement of the tablet screen has the advantage of a larger area for UI and allows you to otherwise arrange the control of trains.

In terms of functions, the Arduino Train Tablet is identical to the Pro application, but it has separate control for two Drivers. This application is intended only for controlling trains and 12 turnouts and have 2 layout's control features.


Arduino Train QUADRO

Under Development
The new version 2.4 of the URB Protocol up to four players may have control under railway layout . The application under development will support this option.

Garden Train

You can modify this system for any construction of locomotives or use it in your control system.

  1. Any number of controlled locomotives
  2. 20x speed control
  3. Whistle sound button
  4. Odometer
  5. Slider Algorithm™ (improved Slider Control)
  6. Extended lights and signals control
  7. Unique function – wireless decoupling system on loco
  8. Universal button for servicing loco devices
    (for example, cabin lighting, start / stop of the snow removal rotor or steam generator and other things)
  9. Simple protocol (API) with extensibility
  10. Online battery state indicator
Garden Train

This application and the Garden Train project itself were developed based on the results of the consultations with several owners of garden railways. Unfortunately, I do not have the capabilities and prototypes of locomotives for testing this project. Therefore, it was created as an experimental one, in the hope that the owners of these large locomotives themselves will create their own electronic circuits using a smartphone as a control console. With great gratitude I quote his note:

Wireless decoder for model loco
Octobers update by Phill

This is my new driver board using the nRF24 board. It really works great. The board is not track polarity sensitive and it has driver short circuit protection. It develops it’s own 5 volt supply and has room to add additional breadboard circuits. It currently drives 3 independent LED light sources. It has a 940nM phototransistor input for identification of track signals. I am still working on this feature. I currently use the Duo control software and think that if I had loco a-e I would be happy. Any other commands are sent to the layout using I2C.

What has really been great is to be able to power the comm unit off of one port and the train unit off of a second port for code development. Is very easy to see what works and doesn’t work. Corrections can be made and tested in minutes. What a fun time! Here is the test layout I am currently using. Comm unit, code, and Serial monitor on the top and Loco board on the right.

I'm thinking of making a special version of the Garden Train app that Phill will manage. He has a great project.

Wireless decoder for model loco
Steam loco under app control
Phill's big trains

Wanted to share my excitement with you about my first success. Hoping once I get it really put together, I might share it with other users.

Finished the prototype board which just fits in the tender. The board rectifies the track voltage and generates 5 VDC for the processor (Nano) and the lights. It also provides a filter to prevent power glitches which resets the Bluetooth. It has Bluetooth to communication with the cellphone app. Lights currently installed are White headlight, Red firebox light and White tender backlight. These are controlled by the individual light functions or the all on/all off light functions.

The motor was grounded to the frame which does not allow software selection of train travel. So the brush tension spring was isolated using a piece of Teflon insulation and attaching the motor wires directly to the brush holders. Initially I used regular wire, but found I needed high flex wire so as not to effect the tension on the brushes. The white wire picks up the track voltage and takes it to the tender for board operation.

An additional problem was shell clearance between the motor and the underside of the shell. I was able to mill a clearance slot in the casting to provide additional safety.

Motor and gearbox

It was now time to assemble the shell over the motor and check for clearance. At this point I was able to determine the proper operation of all motion, direction, and lights. What I find exciting about this project is exactly what you have said all along: Simple, Low Cost, Works everywhere. I can run this on a DCC setup, or a DC setup. It allows me to run several trains on the same track at different speeds. It prevents the need for additional blocking (almost). I don’t need expensive repeaters.

Thanks for all your great work. Next project is a nine stall roundhouse with interface to the nano and cellphone app. It will have stall lights, work lights, operating independent doors on each stall using solenoids.

Photos by Phill


Design of Garden Loco

The Arduino Garden Train app is a wireless remote control. You can use this application with any type of equipment placed on your locomotive. This can be not only a system based on classic Arduino boards. You only need to create a Bluetooth channel between the locomotive and the phone – simple four-character commands sent by the application can be processed by any microcontroller. For example, you can use ESP32, with integrated Bluetooth module and a large amount of memory. Or STM microcontrollers popular series of AVR.

Recommended system consists of Arduino NANO board, a Bluetooth module and any Motor-driver with a voltage corresponding to the battery and the current consumed by the DC motor. As an example, I will use the standard parts of the project's URB: Bluetooth module HC-05 and L298N.

Your locomotive battery may have any voltage, but for Arduino needs voltage between 9 and 12 volts. If you take voltage from the rails, then you need to add a step-down DC-DC converter to the Arduino's power supply circuit and a diode with a capacitor of significant capacitance (about 1000 μF).


Train on battery

Garden loco
Circuit of loco

Sketch for Arduino NANO

The sketch for Arduino is based on the example of Arduino IDE named SerialEvent. A four-character command parsing from the application is a block of code – if (stringComplete) { ... }. After which you can program any reaction of the microcontroller Atmega to these commands. Simple command protocol can be extended according to your requirements. Currently, the application has implemented 10 control commands and 20 commands for setting the motor rotation speed. Upload sketch to Arduino NANO.

After connecting via the Bluetooth, you can view these commands in serial terminal on the Arduino IDE of your computer with the USB cable connected.

Sketch for NANO
Garden Protocol