Electronics:
Myths and Realities

Thanks to the feedback from users of my project, I found out a rather unpleasant thing: a lot of people got their knowledge about electronics from rather dubious sources. The number of incorrect myths about voltage, current, using of microcontrollers and railway electronics connection circuits is huge. If it comes to DCC systems, then the number of inadequate experts seems to violate the very laws of physics.

Therefore, before giving examples of the application of my project, a small introduction.

Servo Point

Basis

Arduino logo

Introducing Arduino

Servo

Using of Arduino

Adjustments DC Motors

Fits to your scale

DC current, Neutral, Ground and Common wire

My control system is called Modern DC URB which means that only direct current (DC) is used and it is supplied directly to rails. The speed of trains is provided by a change in the duty cycle of the PWM, and a change in direction, respectively, by a change in the polarity of the direct current. There are no decoders in locomotives – the only difference from the classic DC control system: PWM instead of voltage changes.

The first statement: As mentioned above, only direct current is used, so the term neutral – referring to alternating current (AC) is simply not needed.

The following misconception relates to the concept of plus and minus. In fact, the electrical current itself always flows from high voltage potential to less, like water flowing from the top of a mountain into a valley. Kirchhoff’s physical law explains this very simply. The concepts of plus and minus are absolutely synthetic, for a primitive explanation. For example, determine which sign you put on the black wire in a system of two batteries.

Polarity expalnation

This example is also important for measuring voltage with a voltmeter. It is important to understand which the potential difference between points in the circuit you get. If you touch the voltmeter to nodes A and C, you will see 1.5 V, if A and B you will see 3V.

The second statement: in any electrical circuit there is a point with the least potential and it is called ground (GND). It is from her that most voltage measurements are making.

In the drawings of electronic circuits, usually such conclusions of circuit devices are indicated with a special sign, this simplifies the drawing and means that there is a electrical connection between all these signes. In most cases, the negative wire of the power supply is directly connected to GND, that is, it is "–" the wire of the power supply. There can be several power supply units, or one power supply unit can generate several voltage values, but it is important to know that there is only one GND wire within a single electrical circuit.

GND expalnation

If you try measure the voltage between points A and B, then you make sure that its value is 13 V. This is the second proof that the plus of a lower voltage is a minus for a higher one.

Last statement: ground and common wire may differ! In most cases, this is the same thing, but, for example, a positive common wire is used to turn on the LEDs. In my project, a "booster" based on a Darlington transistor array (ULN2003) is used for powerful current devices and it also connects the load through a positive common wire.

COMMON WIRE expalnation

The LED, unlike the bulb lamp, has a polarity connection rule. If the LED does not light, then in most cases the error is precisely this – just turn the LED around.

Ohm's law

It's very simple law! He explains the very simple relationship that the more devices you connect at constant voltage (for example 5V for Arduino), the more current you will need. And this is directly related to another physical quantity – electrical power, which is the product of the electrical current value by the voltage value.

So many people cannot understand the equation with three variables, and they are right, such equations do not have a solution! But Ohm's law is not a hugly mathematical equation, you definitely need to know two of the three values, either voltage and resistance, or current and voltage, or resistance and current.

Ohm's law

This law is valid for all electronics. Each electric element in your railroad has resistance to the flow of electric current. But since you (or automation) during the game constantly turn on and off the drives, mechanisms, relays, lighting, etc. on the railway layout, change the speed and number of trains, the total resistance of your circuit also constantly changes. Therefore, the power supply is calculated on the largest current that all devices on your layout can consume, or a power network is created from many power supplies connected by a common wire.

Ohm's law

You can rightly point out that in the last scheme a common wire is not needed. But if you control the bulbs using remote switches, then if you have a common wire, you will need fewer wires. There are even more important points about applying a common wire about which below.

 

 

Series and Parallel circuits

If you have only two electrical devices, such as a battery and a light bulb lamp, then you can connect them to an electrical circuit in only one way, and this is a serial connection. If there are more elements, then another option appears, and this is a parallel connection (but in a closed electrical circuit there is always at least one series connection).

Series and parallel circuits

OK! These are well-known circuits and formulas, but they are directly related to reality, and here's how. Take a regular 12V LED strip and you will see an example of a series-parallel connection. The voltage drop on each LED is about 2V, the remaining voltage eliminate the resistance. That is, with a serial connection, VOLTAGE FALLS (current remains constant), and with a parallel connection, CURRENT RISES (voltage remains constant). This is a very important information.

LEDs - series and parallel circuits
Stupid man

This man on picture to me, he's just like the epitome of the "expert". One of these guys proto recently baffled me with the following claim: "Your system is not working! I assembled the circuit and measured the resistance at the contacts of the power supply before switching it on! And I saw 4 Ohm, it's being almost a zero! It's good that I did measurement before turn on this circuit, otherwise a short circuit burned all my electronics!!! Steve, you are a bad, bad person."

After that, I received the following message: "I turned on your system and it works, but there is clearly something wrong with your circuit."

 

Firstly, link especially for "expert". Please read this and reread Ohm's law.

Secondly, impulse AC/DC power supplies (all modern supplies) and batteries have very small internal resistance. Therefore, if you begin to check the connections and wires of the circuit of your layout with a tester with a dimmer sound signal, disconnect output contacts of power supplies from the circuit.

 

Linear and nonlinear electrical elements. Time. Frequency

The examples with bulbs are clear, but in the real world everything is different. The processes of changing the voltage and current on the elements of your control system dynamically change depending on temperature, external electrical signals, the state of contacts, fluctuations in the power circuit, load changes and time. Even environmental humidity affects your electrical circuit. And these processes are relevant to any electronics, especially for old analog systems with relays, transformers and switches. For their reliable operation, higher voltages and currents are needed, and this is primarily heating and large pulses of currents. That is why they are much larger sizes and heavily heat up compared to digital devices.

Even more complex is that, with the exception of the resistor device (the light bulb is also such a device), all other electrical devices react differently to changes in current and voltage depending on input values. To explain these confusing concepts, engineers came up with a drawing called the current-voltage characteristic of an electrical device.

Current-voltage characteristic

And this pictures hadn't made anything clearer :) The only benefit from this is that it became called clear why some electrical devices are linear (direct graph) and others nonlinear. It's joke. Using the I – V characteristic as an example, you can see the electrical operation of a DC motor that moves your train (electrical motor is a nonlinear device).

But if you replace the value of one of the axes on these graphs, for example, with the time or speed of the motor, you get a very convenient tool for applying electrical appliances in practice.

The videos explain all the concepts and principles described in this chapter much better. My goal was only to clarify the practical application of this.

And a final note on the concepts of time and frequency. It's same thing! Time is measured in seconds and frequency in hertz, isn't it? Now look at the picture!

time vs frequency

 

Introducing Arduino

Microcontrollers (MCU) – the main electronic device on Arduino boards is precisely MCU, making the control system radically simplified. Instead of connecting multiple electronic components into a common circuit, you can use a universal device. Moreover, unlike specialized devices, you can independently change the appointment of Arduino, turning it into a timer, and at the same time a controller for many servos and much more.. And you don’t even have to think about matching currents and voltages, digital devices does not operate with voltage, but with two states – HIGH and LOW. They are 0 and 1, or "false" and "true".

Formally a microcontroller is a small computer on a single integrated circuit. In fact, microcontrollers are a very cheap and convenient electronic component and they surround you from all sides. They are inside the TV remote control, your cars, household appliances and even DCC railroad control systems and decoders work exclusively on them.
However, up to now microcontrollers have been associated with terrible words – programming and firmware. I hasten to reassure you, Arduino is no more difficult than connecting the wires between DC motor and the battery.

Many modelers are conservative, and very wary of novelties. So, Arduino is not a new invention, it is a well-established platform with a 15-year history. The most important thing is to understand how it works and why it is needed.

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board.

Arduino NANO

Arduino NANO

Advanced users can use my project with any microcontrollers (ESP, Intel, PIC, STM and other), but I recommend the classic Arduino – MEGA, UNO and NANO based on Atmega MCU. Platform Arduino is constantly evolving, and now the site presents modern hardware. For the URB project, these opportunities are redundant, so I use equipment from chapter ENTRY LEVEL, and only Arduino NANO.

And here are the reasons for this:

  • they are cheap, very very cheap and very reliable.
  • the supply voltage (and, accordingly, a high level of a digital signal) is 5V, which means that compared to the 3.3-volt logic of other microcontrollers, you will not have problems transmitting signals over long distances. And the output current for each pin of the classic Arduino is greater.
  • the microcontroller frequency (16 MHz) is sufficient to control any systems for railway modeling, it makes no sense to use real-time high-speed microcontrollers with frequencies from 100 MHz and above.
  • Unlike more powerful models of microcontrollers which have an operating system, multitasking and more, Arduino on Atmel chips have only an infinite loop and they are very simple to program.

So, I prefer NANO because it is the smallest in size. And please purchase a minimum of three Arduino NANO boards.


LOOP

Returning to the concept of Arduino. After the introduction, it is already easier to explain: the Arduino board is a thing that will obediently carry out your commands that you asked her using the Arduino IDE. That is, the sketch that you wrote in the Arduino IDE, and then uploaded into the Arduino board such is a list of commands and actions.

Blink is the most famous sketch in Arduino environment – it simply flashes the LED once every second. But more importantly, it very simply explains what Arduino programming is and what a loop is.

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   
  // turn the LED on (HIGH is the voltage level)
  delay(1000);                       
  // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    
  // turn the LED off by making the voltage LOW
  delay(1000);                       
  // wait for a second
}
                        
Blink sketch

How run and stop Arduino board

This is a very unexpected question, and short answer: it can't be done :)

The fact is that the Arduino microcontroller runs constantly, without stopping scroll through the software loop described above. As soon as you turn on the power to the Arduino board or uploaded a new sketch, the program will start, when you turn off the power, the microcontroller will stop. The only thing you can do in the process of working is to press the RESET button, which will force the microcontroller to start performing your sketch from the beginning*.

I intentionally wrote the wrong word "program". The word sketch used in the Arduino environment has one more meaning: since the loop principle is used, unlike computers and microcontrollers with an embedded operating system, you can run ONLY ONE "program" and this is the sketch.

This is the advantage and disadvantage of the Entry Level Arduino. On the one hand, it is very simple, you will not go wrong in the code, since it is executed sequentially line by line and only the order of commands matters. On the other hand, in this system it is impossible to organize multitasking, that is, to simultaneously perform several actions.

* — see next chapter

For the URB project, this Arduino feature is a very convenient. You do not need to wait for programms running or establishing network connections, you just turn on the power switch and everything works right away. Since the project initially involves the use of multiple Arduino boards, multitasking is created by using multiple microcontrollers.

Arduino Reset button

 

The URB project also uses software reset.


GPIO and Setup

Such a picture immediately kills the desire to study Arduino :) But here, too, there is nothing complicated.

The first thing you need to believe, that most microcontrollers pins are universal. There are no rules for connecting this particular data wires from external device to this particular Arduino pin (with several restrictions). Continuing with a simple BLINK example, you can connect a real LED to any Arduino data pin, and it will flash just like the built-in one. But if you try to connect the LED, for example to the pin D2 of Arduino, and do not change the sketch, nothing will happen. The fact is that Arduino needs to explain what you have connected to it. And these explanations you you must do at the beginning of the code of the sketch. Such a section is void setup() called. And this code is executed once after turning on the power or resetting the microcontroller, then the main loop void loop() is executed endlessly.

It is enough to change this code:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}                       
                        

on that:

void setup() {
  // initialize digital pin D2 as an output.
  pinMode(2, OUTPUT);
}                       
                        

and it will work.

If, on the contrary, you need to receive data, for example, a signal from a sensor, then simply change the D2 pin assignment: pinMode(2, INPUT);

In the URB project, a more understandable way of assigning Arduino pins is used. Before the Setup() block, the pinout is described using the #define construction code. In it, you write the names of the pins that you understand, and then use them in the main code. For example, you assign Motor-Driver pins as follows:

// Motor-Driver pins L298 | Arduino pins
#define L298_INA             3
#define L298_IN1             2
#define L298_EN2             4
#define L298_IN3             5
#define L298_IN4             7
#define L298_ENB             6

void setup() {
// Initializing Motor-Driver
  pinMode(L298_ENA, OUTPUT); pinMode(L298_IN1, OUTPUT); pinMode(L298_IN2, OUTPUT);
  pinMode(L298_IN3, OUTPUT); pinMode(L298_IN4, OUTPUT); pinMode(L298_ENB, OUTPUT);  
}
                        

Thus, in the code, you always know what you are using. And if you want to connect the Motor-Driver otherwise, you simply change the pin numbers in the header, and you don’t have to edit anything in the main code.

Arduino NANO pinout

 

Pins restrictions

Each type of microcontroller has its own characteristics, and above all in the use of pins (they are also called GPIO – a General-Purpose Input/Output is an uncommitted digital signal pin). Arduino NANO and UNO use the same MCU: Atmega 328, and, accordingly, the number and capabilities of GPIO are the same.

In the picture you can see that pins D3, D5, D6, D9, D10, D11 can output a PWM control signal. Pins A0-A7 have enhanced capabilities for processing the incoming analog signal and so on. We will use all these features later.

Start

If this is your first time using Arduino, the video provides detailed instructions. In short, you need to connect the USB cable between the computer and the Arduino board, open the Arduino IDE program, open the sketch file in it (the program on which the microcontroller will work). If necessary, change the sketch code for your ideas, and by clicking the Upload button, upload it to Arduino. And that’s all, you don’t need any programmers, adapters, a soldering iron, additional parts – very quickly!

Your Arduino is ready to do its job, but you can always change all the properties of Arduino by changing the sketch. You can change sketches almost endlessly, that is, your Arduino will always be like new.

First sketch

Ok! You blinked the built-in LED and it works. And of course you have already found many ready-made examples and sketches, and it is certainly worth trying to apply them. But my site is dedicated to railway modeling and it is better to make an example for this hobby.

Therefore, in this example, we will rotate the servo, at any angle, with various delays. And then we will add control of the servo with the help of letter commands from the Arduino IDE terminal in real time. I will not specifically provide the sketch code here for you to write it yourself.

Assemble the circuit as in the figure, connect the USB cable to the computer and open the Arduino IDE.

Next, open the Sweep sketch from the examples folder (File → Examples → Servo → Sweep) and replace line: myservo.attach(9);
to: myservo.attach(2);
This is the pin number to which you connected the servo control wire. That is, changing the sketch, you can connect devices to Arduino in any order and to any pins (there are some restrictions about which below).

 

Try changing the angles and delays and uploading the sketch again. And one more time. Really very simple.

Second sketch

We need a control system, not an autonomous servo rotation. Let's correct it by leaving the same circuit. For this, we will also use a ready-made Serial Event sketch (File → Examples → Communiction → SerialEvent), adding to it the code from the previous example.

I changed and expanded the capabilities of the sketch a bit, leading it to the rules for writing code for my project. But it's still SerialEvent.


#include <Servo.h>

// GPIO
#define SERVO 2

Servo myservo;

// VARIABLES 
bool stringComplete = false;
String inputString = ""; 
int angle = 0;

void setup() {
  Serial.begin(9600);
  inputString.reserve(4);
  Serial.print("Start");
}

void loop() {

// ---- START PARSING INCOMING APP COMMANDS
  if (stringComplete) {
    if (inputString.charAt(0) =='a') {

      if (inputString.charAt(1) =='0') {
        if (inputString.charAt(2) =='0') angle = 0;        
        if (inputString.charAt(2) =='1') angle = 10;
        if (inputString.charAt(2) =='2') angle = 20;
        if (inputString.charAt(2) =='3') angle = 30;
        if (inputString.charAt(2) =='4') angle = 40;
        if (inputString.charAt(2) =='5') angle = 50;
        if (inputString.charAt(2) =='6') angle = 60;        
        if (inputString.charAt(2) =='7') angle = 70;
        if (inputString.charAt(2) =='8') angle = 80;
        if (inputString.charAt(2) =='9') angle = 90;
      } 
      if (inputString.charAt(1) =='1') {
        if (inputString.charAt(2) =='0') angle = 100;        
        if (inputString.charAt(2) =='1') angle = 110;
        if (inputString.charAt(2) =='2') angle = 120;
        if (inputString.charAt(2) =='3') angle = 130;
        if (inputString.charAt(2) =='4') angle = 140;
        if (inputString.charAt(2) =='5') angle = 150;
        if (inputString.charAt(2) =='6') angle = 160;        
        if (inputString.charAt(2) =='7') angle = 170;
        if (inputString.charAt(2) =='8') angle = 180;
      }
    }

    myservo.write(angle); 
  }

  inputString = "";
  stringComplete = false;
}

// ARDUINO - COMPUTER COMMUNICATE FUNCTION 
void serialEvent() {
  if (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == 'z') { // Flag end of command
      stringComplete = true;
    }
  }
}                    
                    

 

How to use

To rotate the servo to the desired position, for example 120 degrees, write in the line of the terminal "a12z" and press Send. The "a05z" command will rotate the servo lever 50 degrees and so on.

Of course, you can send the desired position of the servo, for example 180, and make parsing arriving bytes into the rotation position of a servo. But the purpose of this example is to introduce you to the universal way to transfer any symbols commands to Arduino, and it performs the actions you programmed for on these commands.

In my URB project from an Android phone, the four-character commands are transmitted via the bluetooth, the last character is always "z". Next, Arduino accepts these commands, and when he receives the character "z", he starts parsing them in the PARSING INCOMING APP COMMANDS code block.

This example is key to understanding the whole project. Such commands can be transmitted not only from my applications, but also through a serial connection from another Arduino, a minicomputer, and, as in this example, from a computer.


Arduino Train DEMO 2

 

This example especially for the model railroad beginners, shows how to just start playing with your railroad using Arduino and a smartphone. It is enough to have a any classic starter railway model kit and even a schoolboy will build this scheme in a few minutes.

Minimal details set

All these details will also be used later for the URB project. In total you need the Arduino NANO board, the Bluetooth-module HC-06 and the motor-driver L298n connected to the rails. All arduino's details for this experiment cost less than $ 10 on AliExpress and similar online stores. If you already have any Arduino's board and shields, you can also use them.

Assemble the circuit, upload the sketch to Arduino. Install the application, connect your phone and Arduino via bluetooth and start playing.

Note that this example uses two serial ports, one of which is software. That is, you can control the train both from the phone and by entering the commands of Protocol 2.3 through the IDE Arduino terminal. This method is useful for debugging your code, which you will certainly write better than me. In addition, this is necessary, since the USB connection to computer uses the main hardware serial port of Arduino (Pins 0 and 1). And in this configuration, you can update sketches without blocking the bluetooth module connected to pins 12 and 13.

DEMO 2 sketch

Power supply

The power divided into two branches, one for moving trains, the second for electronics and devices on the layout. Thus, with short circuits on rails and other troubles with trains, the layout control will not be affected.

To turn 5V power on your Arduino, use any charger for modern smartphones with a USB connector. The current of such chargers should be about 1 A. For the movement of trains, you can use the transformer you already have from the starter set or any DC power supply with 12V. Please note that the output current also should be about 1 A or more.

It is convenient to carry out the connection of wires between the power supply unit and the motor-driver through the power plug-screw terminals.

If you want to increase or decrease the voltage for locomotives of your favorite scale (for example, up to 18 V), then connect the power supply with the voltage you need to the motor-driver.


PWM and DC Motor

The URB project has many unique and very convenient features, one of them is the independent adjustment of the traction characteristics of your locomotives.

In the headings of a sketch I entered an array named speedArray#. The numbers listed in it correspond to the output level of PWM. By changing these numbers you can change the characteristics of the locomotive, making it, for example, very quick, or on the contrary to achieve a smooth acceleration or braking at low speeds. By default, it is configured almost linearly:

// 24-speed
byte speedArray [] = {20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 255};

The latest versions of my application use 24 speeds (DEMO version limited to 9 speeds). This is more than enough for the smooth movement of any type of locomotive. Nevertheless, the project has the ability to customize traction modes.

 

The DC motors of the majority of locomotives, including those with DCC decoders, are controlled by the PWM method. In short, unlike a regulated transformer that changes its output voltage, in the PWM method the voltage always corresponds to the input voltage, but the number of pulses and their duration per unit of time varies. This method allows to reduce the size of the electronic DC motor controller to a small chip, and such a chip is installed, including in the DCC decoder. For the world of Arduino this method of management is native, you do not need to study the principles and subtleties of PWM work. There is a simple code that implements this method in one line: analogWrite(pin, value).

Since 2018, the PWM frequency in my project has been reduced to 122 Hz, which increased the traction of electric motors at low speeds and reduced noise. To do this, I had to use one of the three Arduino timers, and therefore only pins D9 and D10 can be outputs for connecting PWM signals.


 

 


Fits to your favorit scale

This experiment gives you the opportunity to adjust the control system to suit your scale and the characteristics of your locomotives. The order of the experiment is very simple: first, increasing the lower limit, get a starting to your locomotive from the spot, and then distribute the remaining range to get the dynamics you want.

A video showing locomotive tuning relates to an older version of protocol 2.1. In updated applications, the configuration method is the same, but the number of speeds has increased. For Train Lite and Train PRO – 12 speeds, for DUO – 24. Sketch changed for new protocol version.

This scheme is almost the same as the example for Junior PRO. But in this experiment, the power to the Arduino is fed directly from the computer via the USB cable. That is, you can change the digits of the array, then load the sketch and immediately test the changes in the dynamics of your locomotive from the DUO application, without making any re-switching with wires and cables. And repeat it again and again until the result of locomotive move dynamics suits you.

 

Note

For small collector DC motors (respectively, with a small weight of the motor armature) the minimum threshold of change in revolutions under load is about 0.3 V on the linear part of the graph, and about 1 V at low revs. Moreover, the higher the voltage for which the motor is designed, the greater this value.That is, it makes no sense to use 100 or even 50 speeds, it will not affect the feeling of driving the train.

The linearity parameter has a much greater meaning; it is a completely different way to enjoy your locomotive control. And this is exactly what is implemented in the project. You can individually configure each of your locomotives for the application; for this, the project provides a speed table with 255 speed levels. By changing this table, you can rearrange the curvilinear characteristic of your engine to linear (I will tell you a secret that such a table is used in DCC decoders).

When you quickly change the position of the knob on the control console, the amount of data grows exponentially. And if you use 100 speeds, in this case the data flow will become very large and the control system will simply stop responding to your commands. Therefore, professional systems and use the minimum required number of speeds.
Once again, the problem is not that there should be a lot of speeds, but their distribution over the control range.

Compatible apps:

  Arduino Train Train DEMO 2

  Arduino Train Junior Lite

  Arduino Train Junior PRO

  Arduino Train Train DUO

The sketch in this example is a modified version of the sketch for beginners, but It immediately allows you manage separate rail tracks. If you want to add a second player you need another Bluetooth module HC-06. The scheme is almost the same as the first example for begginers.

Adjustments thrust

History of a model trains control

Model railway consoles heritage

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.