Testing from computer

Running and troubleshooting

To examples on this site are hard to go wrong, but shit happens :) If you have collected wires and a circuit, have included, but it does not work – we will look for the reason. At the same time you will understand how to act in such situations.

The hardware of the URB project consists of modules that can operate autonomously. Therefore, troubleshooting is a simple checking of the modules by one. You can always connect the URB unit to the computer and add test commands to sketch from the Protocol for check it.

...nothing working!

That's a quote from real users message. The problem is that it is impossible to guess what went wrong. Therefore, the first thing to do: Don't Panic – you can't do something fatal with voltage of 5V. The biggest mistake: creating a short circuit or overload pins of the chip will only lead to the fact that you need a new Arduino. In most cases, problems are associated with improper installation of the device in the slot. To avoid this, all connectors of the URB unit have special marks.

If you turned ON the power (or plug USB cable) and the LEDs on the Arduino did not light up, or blinked and went out, then you incorrectly connected wires. Or you have a broken Arduino or problems with the power source.


Disconnect all wires except power wires and turn on the circuit again. If the problem persists, replace the Arduino, check the power supply with a tester and, most importantly, carefully look at the correctness of your wired connections.

The verification algorithm is simple, you need to divide your scheme into parts. And consistently add to it your items. So you localize first, and then fix the problem. Therefore, first of all, testing begins with the power supply.

Train don't move

Produced are a lot of different variants for Motor-drivers modules. There are even a few dozen modules based on the chip L298, and they differ not only in location but also in the number of pins. Most importantly, there are two standard ways to connect Arduino to dual channel drivers: by six and by four wires. My sketches provide a six-wire connection. If you have another module, change the code according to your module.

The most common two problem situations:

  • when you forgot to connect your circuit with a COMMON WIRE
  • when the Driver A is controlled from the application, and the locomotive is on rails connected to outs B, or voltage measurements are taken on the Motor-driver outputs B

Please check your wires circuit connections carefully.


First check out the Arduino pins with unplugged the Motor-Driver. When you moving the thrust slider in the application on the corresponding to the ENA and ENB of Motor-Driver pins the voltage should be change from very close to zero to the Arduino's supply voltage. When you pushing buttons for changing the direction of motion should be changed the state of the corresponding pins IN1 IN2 and IN3 IN4 from a high level to a low level and vice versa.

If all the previous steps are completed, but the locomotive still does not move, then with digital multimeter checking the condition Motor-Driver and the locomotive.

I can't connect via Bluetooth

You can use any Bluetooth modules in your project. These modules are often very similar to the HC-06(05) I recommend. Unfortunately, many people like the beautiful name of BLE and Bluetooth 4, but this standard is designed for minimum power consumption, so a level converter is needed. In addition, the assignment of pins on other modules may be completely different. Consult the documentation for your modules if you want to use them.

My applications are connected over an Android Bluetooth. The rule of verification is as follows: if you could pair the Bluetooth module with the phone, then connection is works.

Test BT connection

To finally test the connection, upload a simple sketch to your COMM unit. Open the Serial Terminal Arduino IDE. If you are not mistaken with the wires, you will see Protocol 2 commands transmitted to your COMM unit from the application.

Serial RX TX crossing

The most common mistake is the wrong connection of data wires RX TX between the Bluetooth module and the Arduino. I highly recommend using the URB unit, it solves most of the problems of this kind. In my applications, the connection between the Android phone and Arduino via bluetooth is a virtual analogue of a serial connection.

Test BT sketch

Unlock screen


I received several complaints from users of my applications on turning off the screen of the Android device. Firstly, this is not a problem – as soon as you unlock your phone or tablet, the functionality of the application will recover. But you can also increase the sleep time of the screen when idle, or even turn off this power saving function of the Android operating system.

I have this parameter set to NEVER. Compared to the constantly on Wi-Fi, this has virtually no effect on the discharge of the battery.

Buyers guide — How to cheap buy details of Arduino

I did not want to write this guide for a long time, because I thought in Internet the information was enough to indicate that this is a very cheap project. I am the same buyer of these goods as you are. That is, I do not produce, sell or advertise the producers of these details. And I do not have any benefit from such activities.
But I was wrong, it turned out that this is very important. I will give my method of buying these goods and the approximate prices.

The first advice

Is to take several identical parts at once, it is not only cheaper, but also relieves you of the need to re-order. Be greedy! For example, for my project you need a few Arduino NANO, when buying five pieces on the trade portals such as aliexpress.com or alibaba.com one piece will cost only $3.2 (2.7€). On Ebay 5 pieces of Arduino NANO will cost 3.3€ for one, but the delivery will be much faster.

Prices compare

The second advice

Be very careful when choosing a product on these trading portals – the product description is often very brief and uninformative. For example, you can buy cheaper the same Arduino Nano Atmega168P, but with another CPU (need 328P) which will very restrict you in writing sketches and applying in the project. Also apply this recomandations to modules of Bluetooth and Motor-drivers, compare the picture on my site and on the sites of sellers, they should be identical (in part because of this I bring pictures instead of diagrams).

Find details

The third advice

Buy from local vendors consumables (wires, connectors, etc.). Shops such as Radioshack are almost everywhere. If you look a little you will find that very often next to you there are private sellers of details of Arduino, it is slightly more expensive than on sites, but at times faster. Plus there will be communication, often people trade Arduino not for profit, but for the sake of a hobby (just like me).

All items for one URB unit bought in this way are for me a less than $4 or approximately 3€.

Local vendors

Comparison URB project with manufactured solutions

Now let's just count. I will compare the price of electronics, without wires and power supply blocks, for Example of a Symmetrical layout presented on it site. I'm not so sure about real prices, but approximately in out June 2018 so:


I took the simplest set of parts for installation the electronics for "Symmetrical track plan" from the site of Horby. And it's not even a wireless console. The price difference with the same functionality eightfolded, this despite the fact that the expansion options for my project is much greater. The attempt to calculate the price of the necessary components from the Pro series from the company ROCO led to a difference of 25 times!

And for me it was a bit surprising that I did not find on these sites a classic set for DC control.

URB Project
Detail Quantity Price $ Price €
URB unit 2 4.00 x 2 3.40 x 2
Arduino NANO 2 3.50 x 2 3.00 x 2
Arduino Train Junior App 1 9.99 9.99
Servo SG-90 4 1.40 x 4 1.20 x 4
Relay 2ch 2 1.20 x 2 1.10 x 2
Bluetooth HC-05 1 2.80 2.60
Motor-driver L298 1 1.50 1.30
Total 37 34
DC control

All well-known manufacturers have ceased production DС control systems.

DCC control
Detail Quantity Price $ Price €
Hornby DCC Select Controller 1 139.99 121.99
Digital Locomotive Decoder 2 25.99 x 2 22.50 x 2
Hornby Accessory Decoder 1 52.00 48.99
Surface Mounted Point Motor 4 12.99 x 4 9.99 x 4
Total 296 256