Friends! I started this campaign to bring back the fun and simplicity of railroad modeling. I'm doing this project alone and on this site only my original content is posted. For the content of the site and purchase of details for testing new ideas, I need funds. Or comrades-in-arms!

Please support my project informationally – share them with your friends. Subscribe to my Rumble video channel.

Servo Point Motor

By this mechanism, I am proud as designer! The task was to make such a reliable turnouts switch-mechanism, which will simply and quickly manufactured, while ensuring accuracy of moving the rod to a tenth of a millimeter.

Given the large error in the position of the lever of the cheap servo when stopping after rotation, and the need of convenient adjustment without tools at the installation site, the task seemed to me unsolvable. However, I came up with, and even much more. Shoulders slingshot, as well the mechanism, made of thin galvanized sheet metal, this material is available almost everywhere. So, by bending them with your finger you can adjust the stroke of the rod and, accordingly, the accuracy of the switch position. In addition, these shoulders act as a damper, parrying the errors of the mechanical transmission and securely fix the switch mechanism in the extreme positions. But that is not all. If the servo arm is stop to a position of 90 degrees, the mechanism is unlocked and you can switch the turnout manually. Sketches and examples in this project are focused specifically on this mechanism.

Placing point-motor

Unlike other known servo point designs, this design does not require space under the layout. That is, you can place such a mechanism on a table or floor next to the rails.Or, as in the classic Tortoise switch machine, hide the mechanism under the layout.

In the video «Railway modelling for teens», I used a modified version of my mechanism with the addition of a Hall sensor. In this modification, the point motor generates a turnout position signal, as when using limit switches. Only it is more reliable, since it does not have mechanical contacts.

Modified point-motor
Three way turnout

The design of the servomechanism to control turnouts can be done almost any. I insist on using a servo, instead coil machines, for control levers of turnout. You can make a point motor for controlling a three way turnout using only one servo drive, or add a Hall sensor to the popular mechanism, as Tim Humphrey did.


Tim Humphrey's design point-motor with feedback


Supplies and instructions
  • Cut Aluminum channel about 2in or 5mm sections
  • Trombone Paperclip (Needs to be thin enough to fit in servo arm) cut in two pieces
  • Drill three holes, One for mounting paperclip for turnout, and two screw holes
  • Cut one end of Servo Mount tab off
  • Apply some Hot Glue to hold Servo in channel
  • Affix Magnet short paper clip arm until fixed over Hall sensor when swung
  • Apply Two sided foam tape to mount the Hall sensor to Mount the Digital Hall Sensor

Still fine tuning the degree rotation needed for the servo too swing the turnout and trigger the sensor.

Regards, Tim

Auto OFF power from the point-motor

The Arduino allows you to change the state of their pins by time, for example, by the DELAY operator. In the URB project, such delays are often applied in the sketch code. For point-motors, it is possible to turn off the power of the servo or electromagnetic coil after the time period you define. That is, after an interval of time sufficient to switch the turnout, the electrical voltage is disconnected from the entire mechanism. Thus, you ensure the duration and reliability working of the servo and insure against overheating of the electromagnetic coil.

Design of a Signal

The URB project allows you to monitoring and independently create any types of signals and algorithms for their operation. You can make the blinking light signaling for railway crossings and big semaphore traffic complexes ramified control systems trains. Even in comparison with a very well-designed proprietary signaling Z21 system – the URB project has the advantage of being open. Again, this is a very exciting process for you, you can independently invent and implement exactly what you need, and not to collect from the finished firm "cubes" approximately working solution. Even if you are projecting a MAGLEV trains layout, the URB project will allow you to create a futuristic signaling system.


I tried to make the most informative video about the production of signals for my layout. But you can use ready-made signals, and they most often use a three- or more-wire connection system. In this case, simply use the GND contact on the URB unit, you do not need to make any changes to the sketches. Also, you may need to change the resistance in the finished signals to a lower nominal, usually they are rated at 12V.


Railway signals are rarely found on layout, and their availability is a sign of professionalism. Not this the modelers do not want to install them, but that not a trivial task – the algorithm for switching many signals needs to corrected for each railway line. So you need a large computer with software or branded digital sets from manufacturers. Or soldering their own boards on logic chips.
But with the Arduino everything becomes much better. Convenient direct connection of signals and sensors to the URB connectors provides easy installation. Together with the availability of information on the position of all turnouts and the ease of programming Arduino all it is now easiest. Without any computers! Just turn layout power on and everything works!

For a greater reality of the brightness of the signals, I recommend individually to pick up the resistor – brightness and spectrum of LEDs of different manufacturers is very different. If you need to apply a LEDs array control system on one channel, you can overcome by the current limitations using the powerful PD outputs (see URB Documentation). Also very convenient the solution to use for connecting many signals via several very cheap boards with chip PCF8574.

When developing my signals, I took into account first of all the maximum manufacturability and the cost of their manufacture. This design assumes a mass production of signals by the modeler. In addition, the signals are very strong and maintainable.

URB signal system

Unique Crossing

This really working design was developed a two year ago, and reliably works to this day. The actuators of the barriers is independent, since each barrier is driven by a separate servo. Since barriers can be moved asynchronously and at different speeds, it's more like the real world in which it happens that way. Also in the module use classical flashing lights.

All crossing rail electronics made on the one autonomous URB unit with the possibility of connecting to the URB bus. The mechanism is made in such a way as to fit completely into the space under the crossing of the move and not to leave its dimensions.

To automatically lower the barriers when passing a train, the original algorithm given below and two conventional infrared sensors Arduino are used. The design of these sensors is modified and described in the Sensors chapter.


The sources of the train signal about the approach and the departure from the wide railway crossing area will be infrared sensors located at a distance from the crossing. I suggest that you will establish the distance between them experimentally.

The normal servo always rotates at its maximum speed. For different models of servo drives speed is different, there are fast and slow servos, but the speed of rotation is always constant. That is, we can not make the rotation faster than the installed by the servo manufacturer with the help of electronic control (though we can increase the speed mechanically using the reduction gear). But we can lower this speed by rotating the servo shaft to a small angle with a delay, and repeat this process again and again until the servo turns to the desired position.

For this I propose to use the alternate library for Arduino VarSpeedServo, very similar in function to the standard Servo library. You will read instruction how install the third-party library in the Arduino IDE environment on the author's page. As a result, you get another setting for controlling the rotation of the servo. Changing the command myservo.write (angle, speed, true); the second parameter you can set the speed from very slow: 10-50, to maximum: 255.

Just in case, I will explain, under all the processes when using Arduino it is easier to manage with the help of variables. And servo control is no exception. In the sketch for the motor-point for the junction, it is more convenient to specify directly the angle of rotation of the servo, but in other cases it is better to use the type variables INT (integer). Variables can be calculated mathematically when the program is running. Among other things, this allows create realistic behavior of moving objects on the layout, for example, when the position of the descending barrier is closer to stopping at the lowest point, it can be slowed down or a small rebound can be realized when the barrier reaches the extreme positions.

URB signal system

It's design based of the simplest Auhagen 41582 Level crossing kit. Since there are many similar sets, you may use any. And of course, this module work both in automatic mode and in manual controlled mode.

The mechanism is made in such a way as to fit completely into the space under the crossing of the move and not to leave its dimensions. This mechanism converts the translational motion of the thrust from the servo to the rotation of the barrier and at the same time has a damper. The horizontal angle of the thrust vector can be set by you in a wide range.

This level crossing module has advanced settings: you can raise barriers synchronously, or with time-sharing – for example the barrier starts to go down (or go up) on one side of the crossing, and on the other side the same thing happens, but with a half-second delay. Also you independently regulate the speed of lifting or lowering barriers on both sides of the crossing. All light effects are regulated – the frequency of flashing of the signals, the sequence and delay of the light signaling. You can for even joke to raise one barrier and lower the other.

Crossing Sketch

Algorithm and sketch of railway crossing

I have already described the use of Arduino sensors for use in railway electronics and problems with their interaction with trains. To overcome these problems, several methods should be used at once: physicals and algorithmics.

Here I use infrared sensors my module with a separated emitter and receiver deployed relative to the rails by 45 degrees and spaced apart in height. Thus, I remove problems with different reflective ability of painting cars and false sensor triggering when changing moving cars of a train in the sensor operating zone. That is, there is an inverse algorithm, unlike the usual one – while the train does not exist we have a sensor active, when the train crosses the sensor, and until it completely leaves its area of operation, the sensor is blocked. Therefore, the setting of the variable resistor on IR sensor housing should be set to the minimum position for its activation.

It is obvious that the minimum Trigger distance from the sensor zone before crossing point should be such that when the train approaches the maximum speed the barrier had time to descend. This distance should be established experimentally. But Arduino gives us a lot of extra features, for example, after triggering the sensor, we can turn on the blinking alarm light at crossing , and with a certain delay after that we lower the barrier, in this case the length of the Trigger distance needs to be increased.

The original algorithm for automate moving barriers uses two variables for each sensor, one of which acts as a latch. As a result, the time independence is ensured and the code becomes very simple.

if (latch_s1 && latch_s2 && !trigger_s1 && !trigger_s2) {
latch_s1 = false;
latch_s2 = false;

The algorithm correctly reacts to the stop of the train in the sensor area and even the train maneuvers at the rail crossing.

Blinking signals are collected on red LEDs of a two-cylindrical shape. Anodes and cathodes of these LEDs are cross-connected. As a result, with the opposite change in the state of the two outputs of Arduino from high to low levels, only one of the two LEDs will light.

Crossing plan

To configure the module, I made a separate sketch. By sending protocol commands 2 through the computer's serial terminal, you can adjust the angles of the barriers, their behavior and speed.

Adjustments Crossing Sketch

Relay Cabinet

Relay Box as sensor

As a development of the idea of an infrared sensor module, I propose a way to mask this system on your railway layout.

Glenn Lambert made 3D model for this design and it works really well to hold the sensor and emitter. Very thanks Glenn.

Windows lights

Lighting adds a realism to the model railway layout. But simple light bulbs are boring, it is better if every window of all houses will individually turn on the light. Even better, if there are fade-in effects, or flashing, like a broken fluorescent tube. Also, street lights should use dimming and station buildings should also be included in lights groups. This means we need a lot of control channels and it's expensive and complica-a-a-a-ted.

And here not! With the URB it's easy, and even more so, you can add a random algorithm for lighting windows, you can also still put an ambient light sensor and your railway world will react to begin the night. You can control this and the real buttons on the control of the layout, and from the phone using my application. And you will periodically change lighting rules by simply uploading a new sketch! My layout on assembled on a shelf, and there are 48 light channels, and this is far no limit.

Connecting LED Lighting

Each URB has 6 skrew outputs D2-D7 with a current of up to 500 mA (7 if you do not use servos). Outputs D3, D5 and D6 in the middle can be operated in PWM mode and you will use them for dimming. All pins have a voltage of 5 volts, so you can easily calculate the maximum number of LEDs possible to connect to one pin. For example, if you use cylindrically LED of white light, then its current with a serial current-limiting resistor of 150 Ohm is about 25 mA, then their total numbers will be 20 per channel. Numbers more powerful SMD LEDs, like 3528, assembling will be less per channel. Pay attention to the non-standard connection scheme with a common plus. Just in case instead of LEDs it is possible to include usual bulb lamps, only at them very much big a current.

ULN2003 DIP-16 is a cheap and widely available chip. In my experience, part of the copies of this chip (depending on the manufacturer) starts to get very hot at currents of more than 350 mA per channel. But even if it broke, you can easily replace it.

Starting with the version of URB 2.6 it is possible to connect a 12 V load. You can connect 12V LED-tapes direct to the pins.

Local URB control and effects

It is not difficult to control such a number of channels if you adhere to the main rule: all LEDs from a particular building (for example, a house) should be connected to the nearest URB. Do not use long wires! Everything will work, but you will get confused when you start to write sketches. If you have a multi-window structure, or a houses group, use PCF8574. Thanks to this rules, most of the management of the lighting channels is performed by a local URB. Only the general command comes from the communication station.

After such a long introduction, I'll explain why there are so many channels. In the real world, people turn the light on and off randomly. The simplest way to simulate this is to introduce delays, for example at station: first lights are switched on in the cafeteria and the cashier's area, after the light is on the entire first floor, then on the second and finally the platform lighting turns on.

You can see how it works on the general video of the project. The light on the platform can also flash several times, and only after then constantly glow. That is, you can do it programmatically yourself, and then how convenient it is for you to change the behavior of the layout. And of course, you can apply fade-in fade-out effects, it is especially suitable for street lights. I installed on my layout a separate URB with a photodetector, and now when the room gets dark, if the power of the layout is turned on, he turns on the evening lights. The Arduino platform also allows you to use the function random() for this.

Blinking and Fading effects

I've been looking for ready-made sketches on the Internet for a long time and as a result I was forced to reinvent the wheel. In most sketches implementing the illumination effects there is a problem – they use, often implicitly at the library level, the DELAY command. This results in data loss on I2C bus and other synchronization difficulties when executing the Arduino code. In addition, the realistic fade-in effect in my opinion can be realized only by applying trigonometric mathematical formulas. Therefore I will give here two variants of effects. The first is very good for mutually flickering lights on the railway crossing and the realization of several flashes for the effect of incorporating fluorescent lamps. The second for the ignition of street lights and the like.

The sketch is given for the test platform published below. You can control and adjustment the effects directly from the serial terminal Arduino IDE. Then the code for this sketch can be directly transferred to the local URB on layout. I remind you that on URB 2 FINAL there are only five high-current outputs with PWM control, on which such effects operate: PD3, PD5, PD6, PD9 and PD10.

Lighting test stuff Blink and Fade Effects

By sending a command "la1z/la0z" Protocol command through the Serial Terminal on computer, a flashing mode is activated. The commands "lb1z/lb0z" start fading effects. Also, you can use wireless control using the Arduino Train applications sending the same commands to the URB unit.

LEDs track Layout panel

The COMM unit stores the state of all lines and turnouts on your layout. You can display this information using the LEDs and you get a classic indicate panel. In the same way, you can use the TFT or LCD screen or any other information display device.

The Indicate Panel of the state of railway lines is the final stage of building the layout. And there are many options for creating such structures. I offer you two options for managing such a panel. You can use Arduino for this, or, as in my test layout, apply several PCF8576 chips.

It is very easy to make such a system for URB project, as it is integrated into the system. Since the project was invented for quick and effective implementation, I also came up with an interesting design for this device. The bottom line is that you just need to print it on a printer. And then connecting it to the COMM URB unit.

SmartTrack for panel

Turntable under URB control

In the fifth version of the Arduino Train DUO, I added turntable's control buttons. To demonstrate this feature, I decided to put together a turntable. My friend Erik did send to me a set KIBRI and my adventures began. You can program Arduino for just about anything. But I ran into problems with positioning the rotation circle mechanism. I have not made so many mistakes. Three times I changed the stepper motor, and three times it was the wrong decision. You can watch the details of this process in the video.

Now I already have a guaranteed working solution. This week I received a package with new coggears and hopefully complete this design.

But thanks to this experience, I decided to create a new section of my project. The tools that I used before imposed a very large limitation on the precision of the manufacture of parts of mechanisms. In addition, it was often necessary to make several identical parts, and I realized that I wasted my time inefficiently.

The new section is called Stuff, and in this section I will be demonstrate the use of CNC and, possibly 3D printer, for creating details railway modeling. For example, the most complex part of the turntable, the turntable with sliding contacts and rails, I am going to cut out of copper clad laminate on my CNC 1310.

Railway portal

For the railway layout there is always little space in the home. Therefore, my layout is assembled on a large shelf. But I want more tracks, trains... And one of the solutions for this is a hidden elevator with rails. The portal can be made vertical, horizontal and even a drum structure..

The URB unit has a ULN2003 chip on board, and you can directly connect a powerful stepper motor to it. It is only necessary to assemble such a design and write a sketch. The application already has buttons for controlling this device.

Since sensors and relays can be direct connected to the URB unit, an automated portal will be consist on several tracks and, accordingly, trains.

I can even write an algorithm in which one train will enter the portal, and another train will leave it.

Portal prototype

Wireless URB

This is not an idea, this is a working prototype. Even two working prototypes..

This is a continuation of the URB project, but with the use of units connected to the railway network not via a wired I2C bus, but using wireless modules NRF24. This is not Wi-Fi, which is associated with a lot of problems, and not Bluetooth. NRF24 is a very interesting development using the 2.4 GHz (as Wi-Fi and Bluetooth) band, but with its own data transfer interface, which is very similar to SPI.

This method of data transfer allows you to build a duplex network, and you do not need software client-server technology or a permanent Internet connection (MQTT). NRF24 leaves the project at a minimum level of complexity compared to MQTT or the instance web-server solution.

I have 8 prototypes, and testing it now. More about this on URB Club.

Working wireless units

My dream project

I understand that this is corny, but... On the real railway, the locomotive is driven by the driver. Watching inside the cabin, he controls the thrust, brakes and direction of the train, but he also sees the situation along the route: traffic signals, approaching the station or controlpoint, and so on..

So, if control over the train in model railways was solved a long time ago, including on uses the DDC, the second part is now solved mainly by the visual control of the player – he sees the position of the train and regulates it from the controller's.

There are successful solutions for the automation of train traffic, but they are all based on the same paradigm of external control. It`s a very complex implementation and a very complex hardware devices. For example – the option with the camera in the cabin is strange and funny, but it solves the main task. There is also a solution based on determining the position using a beacon and three (four) receivers like Faller Car System Satellite Controlled DCC Vehicles, similar to GPS. But it is monstrously complicated and very very expensive!

The task boils down to the fact that the "virtual" driver in the cab should know his position on the line, signals of traffic lights, the length of the cars behind (or before) him, and preferably, the real speed the train. Not the PWM level on the motor, but directly speed along the way.

And the takes decision to start and stop train the "virtual" driver from the cab. That is, we have four parameters:

  1. Locomotive position on the layout
  2. Traveling speed
  3. Direction of movement
  4. Train Composition:
     a. Number of wagons
     b. Their location relative to the locomotive (left or right)
     c. Their type (we determine by the length of the car the total length of the train)
     d. Opportunities of wagons (passenger`s cars: opening doors, lighting, etc.)
     e. The virtual "weight" of the cars: we add inertia to the game (it is possible to change the locomotive traction curve)
  5. Then, from the side of the layout, we must transmit only the state of the road signaling and allow the junctions to be transferred from the "cabin". That is, as in reality.
Based on these parameters, it is possible to create a dynamic online route for several trains and manage them from a conventional home Wi-Fi router without any DDC devices.

I physically solved only the first three points, then I need had to build a layout or test line, for which I now simply do not have the resources. Three years ago I made a prototype, and it works.

Wi-Fi train protorype


Wi-Fi train details


Wi-Fi railway project Railway Wi-Fi network


Railway Wi-Fi network


Railway Wi-Fi network

The position of each locomotive on the layout

Actually this is the most important idea. A lot cheap RFID tags are used at 125 MHz, the more often they are placed under the rails, the more precisely the position of the locomotive. Tags do not require power and simply placed under the rails.

On the locomotive (it is possible and on the cars) is a DC-DC converter, RFID-reader, motor-driver L9110 and ESP-12 Wi-Fi controller.

All this I did three years ago, and then I did the tests. It worked perfectly. An attempt to raise money for the implementation of this project with the help of the site has not yet been successful. If you have other ideas or criticism of my site, what can be improved-change-add-remove, write your opinion.