Browse over 10,000 Electronics Projects using the Page Numbering provided at the bottom of each Page.

DIY Model Train controller project

DIY Model Train controller project

Model trains are fun toys which every one of us used to play with in our childhood. Many sophisticated and attractive model trains are available in the market now a days yet the basic principle in build a controller for it remains the same. I built a Model train controller which is equipped with Acceleration and deceleration control using the PWM technique. And also Forward reverse button to control the direction.







Please refer to Controller unit circuit for this discussion. The heart of the oscillator is U1A, R1-R5, and C2. R1and R3 divide the V1 supply voltage in half and their combined resistance is R1*R3/(R1+R3) = 50K. Since R2 = 100K, when the output of U1A switches from ground to 15 volts (+V1), the junction of U1A+, and R1, R2, R3, switches from 5 volts to 10 volts. R5 starts charging C2. When C2 charges above 10 volts, the input of U1A- is higher than U1A+. That causes the output of U1A to switch to 0 volts. In turn, the junction of U1A+, and R1, R2, R3, switches from 10 volts to 5 volts. R5 begins to discharge C2. When C2 discharges below 5 volts, the input of U1A- is lower than U1A+.

The output of U1A switches from 0 volts to 15 volts (+V1), the junction of U1A+, and R1, R2, R3, switches from 5 volts to 10 volts. R5 begins to charge C2 and the cycle keeps repeating. C2 is constantly ramping up and down between +V1*1/3 (5V) and +V1*2/3 (10V). The really cool thing is that this circuit oscillates at the same frequency even if the supply voltage +V1 changes! U1B acts as a comparator to provide the 0% to 100% PWM output. R6, R7, and R8 form a resistive divider.

Notice that R6 and R8 are 10% lower resistance than potentiometer R7. Doing the math 15*(R7+R8)/(R6+R7+R8) = 15*19.1K/(28.2K) = 10.16 volts at full clockwise (100% ON), and 15*R8/(R6+R7+R8) = 15*9.1/28.2 = 4.84 volts at full counter-clockwise (0% OFF). The U1B- input is connected to the junction of R5 and C2 which ramps up and down between 5 and 10 volts. U1B+ is connected to the wiper on potentiometer R7.

Whenever the oscillator ramp voltage is higher than the wiper reference voltage, the output of U1B goes high and whenever the oscillator ramp voltage is lower than the wiper reference voltage, the output of U1B is low. Since the wiper reference voltage can be set higher than the highest ramp voltage, 100% ON time is possible. Additionally, since the wiper reference voltage can be set lower than the lowest ramp voltage, 0% ON time (100% OFF) is possible. This cannot be done with a 555 timer. So OFF can really be OFF and ON can be full ON.


The output of U1B is connected to a switch to power the load. In Figure 1, the output is connected via R10 to the gate of Q1, which is an IRLZ44 MOSFET transistor. D3 and R11 protect the gate of Q1 from being over-driven with voltage. R12 provides a light resistive load to Q1, while D4 protects Q1 from inductive load, voltage spikes. S1, R9, and C3 provide the ACCEL/DECEL function for the train controller. When S1 is open, R9 and C3 cause the wiper reference voltage, at the input of U1B+, to change very slowly as R7 is adjusted up or down. This provides a slow acceleration or a momentum effect for a model railroad train. The ACCEL/DECAL time constant, set by R9 and C3, is around 30 seconds. That is the time needed to accelerate to full speed or decelerate to a stop. Switch S2 provides the Forward/Reverse polarity function.

The above circuit  which i have designed was meant for a single channel ,track or train control. However you can expand this circuit to control up to 3 channels. In order to do that Duplicate R6-R12, C3, U1B, D3-D4 and Q1, use IC LM324 quad Op-amp for 2 or 3 channels.Channel 2 designations = U1C, R6=R13, R7=R14, R8=15, R9=R16, C3=C4, R10=R17, R11=R18, D3=D5, R13=R19, D4=D6,Q1=Q2,S1=S3,S2=S4. Doing this you will get extra channels in your project.





Internal Circuit board of controller


Dual Channel Train controller


  1. Up to three total speed controls can be connected to U1A+, R5, C2 to run separate track loop functions.
  2. T1 may need more amp ratings to accommodate the multiple tracks and trains.

The post DIY Model Train controller project appeared first on Gadgetronicx.