Plastic rails

This option assumes the installation of Arduino and its parts directly into the locomotive. At the same time, electricity comes from the battery pack installed in either the locomotive or the nearest wagon. From this it follows that the toy train is big enough to accommodate this equipment.

Metal rails

Metal rails and the management of the train by supplying electricity to the locomotive motor through them are a classic scheme of railway modeling. And this variant the first step to big world railway modeling. One of the differences is the failure of batteries in favor of a stationary power supply unit from the power grid. In this case, you can use the decision described on this page.

Arduino Train for Kids

The application is specially written for children. Your child can drive a toy locomotive directly from his tablet, you only need to help him once in establishing the bluetooth connection. The program manage to control the speed and direction of the train, ignite and quench the locomotive's searchlight and play several whistle sounds.

The program uses the command protocol common to the whole project, so it is also applicable to managing a "large" layout.

Installation Arduino hardware to the loco

In this example, I use the components listed in the right pane of this page, since they occupy the minimum space. Again, the toy train should be large enough to accommodate batteries and Arduino.

It is convenient to place all the electronics along with the battery pack on the platform car just behind the locomotive, and carry two wires to the locomotive motor. But I think that you will make a more interesting design, as this is just an example.

Example Arduino hardware

The connection scheme is no different from any robots controlled by the Arduino platform. You can use any components of the Arduino Starter Kit, or shields.

You can assemble the circuit simply by connecting the components with wires, or using a breadbord plate. You can also use the URB module.

Arduino sketch

Description of the sketch you can read here.

#define L9110S_AIA 10 
#define L9110S_AIB 9
#define LED 3 

String inputString = "";  
boolean stringComplete = false; 
boolean directionForward, directionCurrent;
int locoSpeed;
void setup() {
  	pinMode(L9110S_AIA, OUTPUT);
  	pinMode(L9110S_AIB, OUTPUT);
 	pinMode(LED, OUTPUT);

  	digitalWrite(L9110S_AIA, LOW);
  	digitalWrite(L9110S_AIB, LOW);


void loop() {
	if (stringComplete) {
		if (inputString.charAt(0) =='t') { 
			if (inputString.charAt(1) =='0') locoSpeed = 0; // Stop
			if (inputString.charAt(1) =='1') locoSpeed = 80;
			if (inputString.charAt(1) =='2') locoSpeed = 120;
			if (inputString.charAt(1) =='3') locoSpeed = 160;
			if (inputString.charAt(1) =='4') locoSpeed = 200;
			if (inputString.charAt(1) =='5') locoSpeed = 250;
		if (inputString.charAt(0) =='d') {
			if (inputString.charAt(1) =='f') directionForward = true;
			if (inputString.charAt(1) =='r') directionForward = false;
			if (inputString.charAt(1) =='s') {
				digitalWrite(L9110S_AIA, LOW);
				digitalWrite(L9110S_AIB, LOW);
				locoSpeed = 0;
		// LIGHT
		if (inputString.charAt(0) =='J') { 
			if (inputString.charAt(1) =='a') digitalWrite(LED, HIGH);
			if (inputString.charAt(1) =='b') digitalWrite(LED, LOW);

		inputString = "";
		stringComplete = false;

	if (directionForward != directionCurrent) { 
		digitalWrite(L9110S_AIA, LOW);
		digitalWrite(L9110S_AIB, LOW);
		locoSpeed = 0;		

  	else {
  		if (directionForward == true) {
  			analogWrite(L9110S_AIA, 0);
  			analogWrite(L9110S_AIB, locoSpeed);
  		else {
  			analogWrite(L9110S_AIA, locoSpeed);
  			analogWrite(L9110S_AIB, 0);

	directionCurrent = directionForward;

void serialEvent() {
	while (Serial.available()) {
		char inChar = (char);
		inputString += inChar;
		if (inChar == 'z') {
		stringComplete = true;


Start Arduino Train for Kids app

Before starting the App, you need to pair the bluetooth module HC-06 and your Android device. The default HC-06 module password is 1234.

After launching the application, touch on the bluetooth icon and touch your HC-06 module from the list that opens.