Universal Railway Bus Project
is a Open set of formal rules allowing to combine multiple Arduino among themselves, plug external control consoles, including wireless ones, and connectiong any railway devices
An interesting point, there are a lot of good materials on the Internet about the design on the basis of Arduino. Much smaller programs for Android using Bluetooth for control. And, apart from simple examples, there are practically no posts how to tie together Android and Arduino.
The problem in the rules of data transmission. For this purpose, a number of good protocols have been invented, for example the FIRMATA, which is included in the Arduino IDE collection of examples. But it is for this project that it is possible to make the protocol simpler and more flexible. In railway model, there is not a lot of data flow and the speed of passing the team is also not very important. Therefore, you can use a very simpliest protocol for data exchange. This is the URB Protocol developed by me.
The basic principles remain unchanged, only a simple, understandable code, no more complex than examples Arduino IDE.
Arduino IDE have a unique system of combining a common sketch from several individual files. As you have already noticed, the Arduino IDE software always creates a folder in which the sketch file of the same name is contained. This is done because all the files in this folder, when you upload sketch (firmware) to the Arduino board, are combined into a single. Thus, you can break the sketch into functions in separate files. Protocol version 2 now supports this principle.
Protocol 2, as well whole URB project, does not limit you in choosing equipment. You can use any Arduino boards and combine them with each other.
Full description of Protocol 2 you will read on Orange Book or URB Club.Orange Book
Free URB unit
The I2C bus needs resistors pulling the data line to a high potential. You can install resistors of any type on the board. I recommend 10K resistors. I also recommend the use of a smoothing capasitor 1000mf x 25V, when a URB connected to relay or servos, to avoid voltage drop when they turn on.
It's just the way of the world, that without hardware, any program on Smart Phones and Tablets can not influence the reality. As you have already read about my applications, you know those it use the Arduino platform to control train models and layout devices. 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 board.
This board uses Arduino NANO. Therefore, the dimensions of URBs are only 60x70 mm, which makes it possible to hide it even inside model building. This solution provides excellent flexibility, maintainability, simple mass production and low cost. The board is designed to avoid incorrect connection of Bluetooth modules and Arduino NANO.
To the functions of Arduino, the board (URB unit) adds the following capability:
- Connectors for two Bluetooth HC-05 (HC-06) modules
- Direct plug 3 servos
- Direct plug relay block
- Direct plug motor-driver aka L298 or similar
- Screw plug stepper motor
- Convenient screw connections
- 6 (7) High-Current outputs (Up to 0.4A per channel)
- High-Voltage Outputs up to 50 V
- Reliable data exchange between the MCU (like Raspberry Pi) using 3.3 volt logic and Arduino
- Built-in I2C bus
Optional: install I2C pull-up resistors and smoothing capacitor for power supply
URB unit details
- PBS-15 (HO27): 2.54mm pitch PCB female single row 15 pin – 4 pieces (or 15 pin – 2, 6 pin – 2, 4 pin – 2).
- PLS-40: 2.54mm 40 pin male single row pin header connector – 1 piece.
- DIP IC Sockets 16P – 1 piece.
- 2 Pin screw PCB terminal block connector 5mm pitch – 11 pieces.
- ULN2003A (DIP16 package): High-Voltage, High-Current Darlington transistor arrays – 1 piece.
URB unit accessories
Arduino NANO and optional 3.3 to 5V level converter and 2 bluetooth modules HC-06(05).
HC-05 and HC-06, in fact it, is absolutely identical Bluetooth modules with identical chips. One of the chips of these modules is a microcontroller. On the HC-05 there are two additional pins for its programming. There are no such pins on HC-06 and its module is easier to use for my project.
How get URB unit
Other versions of the URB unit are available for Club members
Soon wireless URB 3.3
History of a model trains control
Trains before appearance of the DCC were driven by miniature electric motors to which electricity was supplied direct via rails. Almost all modern models of locomotives can work in this mode. The principle is very simple and understandable even for children – it is enough to press a 9 volt battery to the rails and the train moves. If you change the polarity (unfold) the batteries, the train will start moving in the opposite direction. If a controlled transformer or rheostat is used instead of a battery, it becomes possible to adjust the speed by changing the voltage on the rails. In this way, have been made most of the obsolete control panels that are still very popular.
This principle of management had a significant disadvantage: if you put several locomotives on the rails, they start moving simultaneously. This was overcome by isolating individual sections of the rail and blocking them using a relay or by installing separate consoles for each section. What caused the following problem, the complexity of the electrical wiring has greatly increased. And even now you can see well-made analog railroad models with a very large number of wires. On the other hand, despite the number of wires, the principle itself is very obvious and understandable.
With the beginning of the 1980s, the concept of DCC was introduced. The voltage on the rails will constanted, and the control signals uses of time modulation were transmitted along the same rails. Accordingly, the consoles changed, now they broadcast a control signal. The decoder installed on the locomotive converted these commands into voltage and polarity to the motor. The decoder on the locomotive also added new features – motion sounds, headlight lighting effects and cockpit lighting. Now this is the main principle in railway modeling.
DCC consoles also elegantly solve the problem of switching junctions and light signalling, there is no need to separately pull the wires to motor points – there too there are decoders. But this in theory, in practice DCC has generated many new problems: when building several lines and using several locomotives, it is necessary to install boosters that distribute the load. Because of the difference in the supply voltage of the drives and locomotives, the wires again need to be pulled through the entire layout. Each manufacturer has a different command system and compatibility is still a very narrow place. Features programming of consoles and locomotives – the main part of the discussions in profile forums. And most importantly, DCC is closed, very incomprehensible and very the cumbersome solution compared to the classical one. For example, troubleshooting in decoders, boosters or in the console itself is very difficult.
Since the beginning of the mass distribution of computers and modern electronics, the modelers have created several universal DCC standards, but in my opinion this all now looks like a giant zoo of disparate and very over-complicated devices.
Modern digital consoles are very good and similar to a specialized computer with a lot of blocks, and it seems to me that they contradict the principle of Occam's razor. Also the price of such a set is simply fantastic.
If you look at these solutions from the side – it's obvious that the DCC is just a data bus and microcontrollers installed in the console and decoders. And if you try to use Arduino, and this is a microcontroller Atmega, you can use both the classic control option and the DCC.
Combinations of DCC and Arduino designed out a lot, and they work well. But I'm of the opinion that this way is too complicated. Therefore, I returned to DC concept, only instead of the transformer I apply the ready-made block L298 with Pulse-width modulation PWM) to control locos. Also for Arduino there are a lot of reliable cheap modules. The Arduino programming language is very simple and flexible. Reprogramming Arduino gives you almost infinite possibilities for updating the layout. It's like updating the firmware of modern electronic gadgets. As the site is being updated, I will publish new ideas on automation and drawing of railway devices. Now on the site you will find all the necessary details for creating switching motors, light signals, consoles and many others. Using this information, any fashion designer can, step by step, realize his own projects.