Você está na página 1de 23

Automated Model Railroad

Author: David De Luna


Group Members: Syed Ahmed
Texas Tech University
March 2016

Abstract
This report describes the development of a command station and power booster for a
model railroad HO scale track and train. The system will be powered using 120 VAC source that
will be stepped down and converted to 15 VDC signal. The 16 VDC signal will be delivered to
the power booster and the power booster will power the command station using a voltage
regulator. The power booster will then deliver a bipolar 30 V Pk-Pk signal to the track. The
command station will communicate with the train and control what station(s) it stops at, and for
how long it will stop.

Table of Contents
1

List of Figures ..........3


1. Introduction ..............................4
2. Implementation 4
2.1 Power Booster....6
2.2 Command Station.10
2.3 Servo Motors .......15
3. Conclusion...16
References ......17
Appendix A ....19

List of Figures
Figure 1: Block Diagram of the System....6

Figure 2 Power Booster System Block Diagram...7


Figure 3: Graph of Minimum Voltages for Train Tracks..8
Figure 4: Locked Anti-Phase PWM Control.9
Figure 5: Topology of Power Booster....10
Figure 6: Voltage Characterization.11
Figure 7: Command Station Block Diagram...12
Figure 8: Example of a Transmitted Packet.13
Figure 9: System Railroad ..14
Figure 10: Active High IR Sensor ..15
Figure 11: Low Output Voltage IR Sensor .15
Figure 12: General Code Flow Chart.......16
Figure 13: Servo Motor17
Figure 14: Budget18

1. Introduction
In the last few years model railroading has become more advanced due to the advances in
technology. This includes having power boosters built into a wireless DCC Command Station.
These interfaces also have the ability to easily switch between different trains seamlessly. These
systems can be expensive if anything goes wrong with them. Approaching the issue of price, a
system was built that separates the command station from the power booster into two different
components, and then integrating them together to be able to control the model train. One
advantage that the system has is being able to know when to stop at the designated stations by
reading data from a spreadsheet.
A second advantage that the system built has over the markets equivalent, is that it is
cost efficient and very easy to reproduce. One final advantage of building this system is that
there is several resources to help construct the power booster or what the command station must
do to communicate with the train. Although this approach is cheaper it is imperative that the
results can match that of a different system controlling the same train.
2. Implementation
The system will be powered by the power provided by a 120 VAC and the systems
power supply will step down the AC voltage to approximately 16 V and convert the voltage from
AC to DC. The 16 V from the systems power supply will then be sent to the power booster
circuit. The power booster is a circuit that will take a unipolar signal as an input and create a
bipolar signal across two outputs. The 16 V sent to the power booster will be used to power the
H-Bridge in the circuit. The H-Bridge will boost the received signal and create a bipolar signal. A

bipolar signal is taken from the power booster to deliver power to the tracks which will then
power the train used in the system.
The 16 V used to power the power booster circuit will be regulated to approximately 3.3
V. The regulated voltage will be used to power the command station. The command station that
is used in the system is the MSP430 LaunchPad board. The MSP430 will be adapted to fit
Digital Command Control (DCC) standards. DCC means we are powering the train with a digital
signal and using a set of standards set by the National Railroad Model Association (NMRA). The
standards that have been set by the NMRA range from the voltage that is needed to power the
train to the timing of bits used to communicate with the train. The MSP430 will transmit a data
packet of 1s and 0s that will be sent to the power booster that will then be sent to the track.
Once the signal has been sent to the track, the train will either go forward or backward.
The train will be able to go forward or backwards because of a decoder in the top part of the train
itself. The train is effectively told to listen when the decoder receives a correct preamble from the
command station, which will be talked about in depth below, and then the train will move
depending on the bits that are being sent to the track. After the preamble the decoder will
continue to listen to the bits that are being transmitted by the command station because the order
of 1s and 0s will determine the speed and direction the train will travel. Before DCC systems
were introduced, a trains speed and direction was determined by the amplitude of the voltage
signal and the polarity that was seen by the track/train. The system has stations set up along the
track fitted with IR sensors that send feedback to the MSP430 that will tell the servo motors to
run. The purpose of the servo motors is to control the railway switch on the track so that the train
may traverse the entirety of the track that is set up.

Figure 1: Block Diagram of the System

The system is divided into three primary components as shown in the figure above. There
is the power booster which supplies power to the the command station and will amplify the
signal sent from the command station to the track. The next component is the command station
which sends a stream of bits that will communicate to the decoder inside of the train. The
decoder is a receiver that is in the top of train that controls all of the trains functions from lights
to speed and direction. The stream of bits that are sent will tell the train to either go forward, go
backwards, or stop. The final component is the servo motor control which lets us switch which
track the train will take. This system functions by receiving inputs from several IR sensors that
communicate to the command station and lets the MSP430 know which station the train is at.

2.1 Power Booster

Figure 2: Power Booster System Block Diagram


As shown in figure 2, the power booster system requires two inputs to operate: a data
stream from the command station and power from the power supply that is denoted as 16 V. The
output is a digital waveform that is supplied to the track. The power booster functions as an
amplifier taking digital inputs from the command station and boosting them to the appropriate
track level voltage. [1]
The Power Station must accept a valid input of a bipolar or a unipolar signal that is
supplied from the command station with an amplitude of at least 2.5 V and should be able to of
accept signals with an amplitude of 12V without taking damage. [2]
7

Figure 3: Graph of Minimum Voltages for Train Tracks [3]


The NMRA has minimum voltage standards for different types of tracks. The system is
built around HO tracks. It is shown in the figure above that HO tracks are required to have a
minimum of approximately 15 V. The tracks do not require a minimum current, but the current
needed depends on how many trains are going to be running at the same time. This system will
not need more than approximately 1 A, because there is not many extra features on the train that
will be running and there will only be one train on the track at a time. Other trains have horns,
lights, and other things that draws more current from the power booster, but the system is
designed for a train with minimal features.
The power booster will accept a unipolar data stream from the command station and then
it will amplify the voltage of the data stream and turn the unipolar signal into a bipolar signal.
The power booster is able to make a bipolar signal by taking advantage of the locked anti-phase
PWM control of the H-Bridge. The locked anti-phase PWM control is initiated by setting the
8

PWM In pin HIGH and setting the BRAKE pin LOW. The power booster circuit receives the
command station signal, and that is sent into the DIRECTION pin and that changes the output
from VO1 to VO2 depending on the state of the signal being received.

Figure 4: Locked Anti-Phase PWM Control [4]

As shown in the figure above, the Anti-Phase PWM Control feature of the H-Bridge is
used to create the bipolar signal, which is achieved by subtracting VO1 from VO2. To achieve this
subtraction of voltages when sending the signal to the track VO1 will be used as the reference
voltage and VO2 will be used as the ground. This effectively subtracts the voltages and sends a
bipolar signal into the track.
One important aspect of the power booster is that the power booster will supply power to
the command station. This system uses a L78L33 3.3 volt Linear Regulator, because the max
voltage rating for the MSP430 is 3.6 V. The figure below shows the topology of the power
booster circuit. There is a 1000 F capacitor in this circuit to smoothen out the output waveform
of the H-Bridge. There are two safety features built into the power booster that are shown in the
figure below. There is an internal current limiting feature built into the H-Bridge and if the
9

current goes above 10 Amps, then the power device will shut off as quickly as possible. An LED
is placed in line with PIN 9, which is the thermal flag output that will set when the temperature
of the power device gets to 145C and will turn off the device when the temperature reaches

170C.
Figure 5: Topology of Power Booster [5]
The power supply for the power booster is a universal AC Adapter that can supply a DC
voltage from 15 V-24 V with a power rating of 70 W. The current that this adapter can supply to
the system is approximately 4.667 Amps. For this system, a power supply was needed that could
supply the current that the power booster can deliver and that is about 3 Amps.
10

Voltage Characterization
40
38
36
34
32

Output Peak-to-Peak Voltage (Volts)

30
28
26
24
22
20
10

11

12

13

14

15

16

17

18

Input Voltage (Volts)

Figure 6: Voltage Characterization


As shown in figure 3, to be in compliance with NMRA standards an HO scale train track
needs 14 V to operate. As shown in the figure above when we supply anything less than 10.5 V
to the power booster we will not get a signal out to the track. This is the case because of the
minimum voltage that is needed to operate the H-Bridge. The minimum voltage being supplied
to the track is approximately is 22 V which is approximately 11 V because we are measuring
across two outputs. The ideal supply voltage to the track would be between 12.5 V and 13 V,
which according to the figure above would give a track voltage of 14 V.

11

2.2 Command Station

The software that is used in the command station system was designed using the NMRA
standards for DCC systems. The figure below shows a block diagram of what the system is
doing. The command station will receive power from the power booster, then it will constantly
send commands to the train. As shown in the figure below the train will either be sending a
FWD, REV, or STOP command to the train.

Figure 7: Command Station Block Diagram


One condition that the NMRA has set for a command station is the data packet that the
command station sends to the train. There are four parts of the data packet that is shown in the
figure below. The first twelve bits of this word are dedicated to the preamble. If the train does not
12

hear a complete preamble, meaning it has to hear twelve 1s followed by a 0, it will not listen to
anything else that is being transmitted to the train. Every data packet after the preamble must
start with a 0 so that the train knows that the next 8 bits it receives is the next data byte in the
packet.

Figure 8: Example of a Transmitted Packet [6]

The next data byte that gets transmitted is the address byte. The next packet can have any

value from 0-256, but not all the values are used. Addresses 1-127 are used to communicate with
Multi-Function decoders with 7 bit addresses. Addresses 128-191 are used for Basic Accessory
Decoders with 9 bit addresses. Addresses 192-231 are reserved for Multi-Function Decoders
with 14 bit addresses, and addresses 232-254 are reserved for future use. [7]
The third data packet, as shown in the figure above, is the instruction byte. After the 0
bit that communicates to the decoder that the next eight bits are going to be a data packet, bit 7
and bit 6 contain the bit sequence "01" which is used to communicate to the trains decoder that
this next instruction data byte is for speed and direction. [6] The next six bits will instruct the
decoder on whether the train moves forward or backward and at what speed. If bit 5 is a 1, then
the train will go forward and if that bit is a 0 the train will go backward. Bit 4 through 0 is used
to determine what step the speed will be at. The train has twenty eight steps for its speed. Step 28
13

being the fastest the train can go and the step 1 being the slowest. The trains stop function is
communicated to the decoder by sending 0s for bit 4 through bit 0.

14

The last data byte that is transmitted for this system is the error detection data byte. The
error detection data byte is a byte that is used to detect transmission errors. The contents in the
data byte is the bitwise exclusive OR operator on the address data byte and the instruction data
byte. Additional data packets need to be sent to have trains to turn on lights, sounds or to turn on
or off any other additional features the train may have. Once the last data byte is transmitted to
the train, a 1 is transmitted to the train to signify that this is the end of the entire packet, and the
1 that is sent can also be part of the preamble packet. [6]

15

The command station will always be sending one of the three commands mentioned
1

above. The command station determines what command it will send by following the position of
the train on a spreadsheet. The stops that the train will have are shown in the figure below. Figure
9: System Railroad
The train will be able to effectively reach all the stops the system was designed for by
utilizing the main three commands that the command station transmits. The command station
will be reading the datasheet and following the train. Another way that the system was designed
to ensure the location of a stop is with the use of RPR-220 IR Sensor. In the figure below, the IR
sensor is shown as an active high, optical sensor and uses the reflectivity of a surface to decrease
the voltage output accordingly. When the train reaches one of the IR sensors it has to be close
because the range of the IR Sensor is about 5-18mm.

Figure 10: Active High IR Sensor [8]

16

Figure 11: Low Output Voltage IR Sensor [8]


The MSP430 is the command station for this system and must be able to transmit 1s and
0s to the power booster. The 1s have a specific timing and if the timing is off or if the preamble
is not sent correctly the decoder will not listen to the data packet being sent. The timing for a 1
to be transmitted is a 116 s pulse and it must be HIGH for 58 s and LOW for the same amount.
For a 0 to be transmitted a minimum pulse length of 200 s is required. The pulse must be
HIGH for 100 s and LOW for the same amount. [3] The software for the command station is
designed using the Timer Interrupts unique to the MSP430. The figure below shows a general
overview of what is going on. Three arrays are set up containing 38 values that are either a 1 or a
0 and each array belongs a command that is sent to the train.

17

Figure 12: General Code Flow Chart


The transmission will always start with a 1 because of the preamble that is being sent. As
shown in the figure above once the preamble is done a flag is set and the array will continue to
be stepped through. The system is designed so that the train will always start by going forwards,
and will send the other commands if the train needs to stop or go in reverse. The address byte is
sent until it sends 8 bits, then it will send a 0 to indicate a new data byte is being transmitted
and this happens continually.
2.3 Servo Motors
The system uses servo motors to control the railroad switches. The system is designed for
six railroad switch, so there will be six servo motors to control. The system currently runs all six
18

motors at the same time. The figure below shows the servo motors that are installed on the
railroad switching tracks. The system is designed such that the servo motors are powered by a
voltage (Vcc) pin on the MSP430.
Figure 13: Servo Motor [9]
The system for the servo motors is designed such that every time that the train stops at a
station and triggers one of the IR sensors we will activate the servo motors to turn the switch on
the railroad track.
3. Conclusion

The purpose of this system was to create a system that could power and automate a model
railroad train. This was accomplished by building a power booster circuit and using an
MSP430 as the command station and integrating these two components together.

19

References
1. "Booster." DCCWiki. N.p., 23 Mar. 2014. Web. Jan.-Feb. 2016.
2. "Overview." (2012): 1-6. NMRA Standards and Recommended Practices. July 2012. Web.
Feb.-Mar. 2016.
3. Associatio, National Model Railroad. "NMRA Standards." S T A N D A R D(2006): 13. NMRA Standards and Recommended Practices. 2006. Web. Feb.-Mar. 2016.
4. Texas Instruments Incorporated. LMD18200 3A, 55V H-Bridge (Rev. F)(n.d.): n. pag. Dec.
1999. Web. Feb.-Mar. 2016.
5. "MiniDCC - A Digital Command Control Do-It-Yourself Project!" MiniDCC Digital
Command Control. N.p., n.d. Web. Feb.-Mar. 2016.
6. "Communications Standards For Digital Command Control." General Packet Format (2004):
1-4. NMRA Standards and Recommended Practices. July 2004. Web. Feb.-Mar. 2016.
7. "Extended Packet Formats." Extended Packet Formats (2012): 1-12. NMRA Standards and
Recommended Practices. July 2012. Web. Feb.-Mar. 2016.
8. Ahmed, Syed. IR Sensor Test. 2016. Texas Tech Electrical Engineering Building, Lubbock.

20

9. "Turnigy TG9e Eco Micro Servo 1.5kg / 0.10sec / 9g." HobbyKing Store. N.p., n.d. Web.
24 Mar. 2016.

21

Appendix A: Budget
The budget comes out to approximately $6,693 including all the parts, lab equipment, and
labor costs. (see Figure 13 below)

Oscilloscope
Power
Supply
H Bridge
Bachmann EZ
command
Bachmann Bus Rail
Tracks
MSP430
AC Adapter
Jumper Wires

$101.9/we
ek
$10/week
$16
$120
$200
$30
$10
$13.87
$20

Figure 13: Budget

22

Você também pode gostar