This is only a preview of the March 2017 issue of Silicon Chip. You can view 48 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "All-new Swimming Pool Lap Counter":
Items relevant to "The Stationmaster: walk-around PWM train control":
Articles in this series:
Items relevant to "New SC200 Audio Amplifier - Part 3":
Items relevant to "El Cheapo Modules, Part 5: LCD module with I²C":
Purchase a printed copy of this issue for $10.00. |
Build the
STATIONMASTER
Design by BOB SHERWOOD
Want to build a walk-around throttle for your model railway layout? This
design is easy to build yet provides useful features such as adjustable
inertia, emergency braking and PWM control. It features a separate
hand controller which you can plug into various sockets around your
layout. That way you can closely watch your favourite locomotives as
you drive them around your layout.
W
hile Digital Command Control
(DCC) is the bee's knees for large
model railway layouts, a simple walkaround throttle is all you need for
smaller layouts. And of course, there
is nothing to stop you using this controller on a large layout, as well.
The benefit of a speed controller
with a hand-held walk-around controller is that you can plug it into sockets at various points around your layout. This Stationmaster design by Bob
Sherwood uses cheap, readily available Telecom-style RJ sockets and plugs.
Your layout can have one socket or
many, depending on how many you
want and you can use standard flat or
curly leads.
Chances are you already have a
spare AC or DC power supply that
would be suitable to run the Stationmaster. Anything from 12V DC or
10VAC at 1A up to 25V DC or 18VAC
at 5A would do the job; 1A will be
plenty for a single locomotive while if
you're planning to run several on the
same tracks, you will need at least two
or three amps.
If you already have a train controller but it's a variable DC output
type, you will want to upgrade to the
Stationmaster because as you have
probably noticed, any time the
locomotive hits a dirty section of track
at a low DC voltage, it tends to slow
down, lurch or even stop. That's much
less of an issue with PWM (pulse
width modulation) drive because you
will be applying higher peak voltages
to the track.
Features & Specifications
•
•
•
•
•
•
•
•
Walkaround hand controller
Controls: forward/reverse, speed, inertia (momentum), emergency brake
Indicators: power on, forward/reverse drive, track voltage indicators
Short-circuit protection
Output current: up to 3.5A; adjustable current limit
Supply voltage: 12-25V DC, 10-18VAC
Quiescent current: 20mA
PWM frequency: ~8kHz
34 Silicon Chip
The PWM voltage is applied to the
track by an H-bridge IC. The operation of an H-bridge is shown in Fig.1
and four possible switch conditions
are shown. Here we are showing the
H-bridge as comprising four switches
although in the Stationmaster they are
N-channel Mosfets.
Fig.1(a) shows the default state with
all switches off. In this state the motor is not connected to anything and
so if the locomotive is moving, it will
continue to move but will slow down
naturally due to friction in the wheels,
gearing and motor. If the locomotive
is not moving, it would be possible to
push it along the track and it may roll
down a steep grade on its own.
In Fig.1(b), switches S1a and S2b
are closed. One end of the motor is
connected to the positive supply and
the other end to ground, so the motor
is driven in one direction. In Fig.1(c),
the opposite pair of switches is closed
and so the motor drive polarity is reversed and the motor will rotate in the
opposite direction.
In Fig.1(d), switches S1b and S2b are
closed and so the motor is effectively
shorted out. This will provide significant braking. If the locomotive is moving, it will quickly come to a halt and
if it is stationary, it will be difficult to
move and will not roll down a steep
siliconchip.com.au
Walkaround Throttle for Model Railways
grade. If the opposite set of switches
were closed (ie, S1a and S2a), the effect would be the same.
All four switches plus the control
logic and gate drive circuitry in the Stationmaster are integrated into a single
IC, a Texas Instruments DRV8871 Hbridge. One important feature of this
IC is that it contains protection logic
to prevent the wrong pair of switches
from being closed whereby the power
supply would be shorted out.
Speed control is achieved by switching rapidly between the configuration
of Fig.1(a) and either of Fig.1(b) or
Fig.1(c), depending on the direction
of travel.
The more time the H-bridge spends
in the state of Fig.1(a), the lower the
locomotive speed. With a PWM control
Fig.1: four of the five possible
configurations of an H-bridge
(the fifth is not used in our
application). The voltage across
the motor and the current flow
path is shown, assuming a
nominal 12V DC supply. In case
(d), the current flow direction
depends on the direction of motor
rotation at the time of braking.
The switches are usually discrete
Mosfets (they may also be internal
to an IC) as in the Stationmaster.
siliconchip.com.au
scheme, the rate at which the H-bridge
alternates between these configurations is fixed and speed is controlled
by how much time it spends in the
two states. The percentage of the time
where voltage is applied to the tracks
is known as the duty cycle; a higher
duty cycle results in a higher speed.
Circuit description
The complete Stationmaster circuit
is shown in Fig.2 and it consists of
two main sections. At left is the PWM
waveform generation circuitry and at
right, the DRV8871 H-bridge IC and
associated components, to provide
the high-current drive to the locomotive tracks.
The PWM generation circuitry is
based on IC1, a TL084 and IC2, an
+12V
S1a
LOCOMOTIVE
MOTOR
+12V
S2a
S1a
NO
CURRENT
FLOW
(a) COASTING
S2b
S1b
+12V
LOCOMOTIVE
MOTOR
+12V
S1b
MC14584 hex schmitt trigger inverter.
Two of the op amp stages, IC1a and
IC2b, combine to form an ~8kHz
triangle wave generator. IC1b is
configured as an integrator, with its
pin 5 non-inverting input connected
to a 2.5V half-supply rail derived from
the 5V rail via two 220W resistors and
a 1µF filter capacitor.
When its pin 6 inverting input is
above 2.5V, the output voltage at pin 7
drops at a constant rate whereas when
the pin 6 input is below 2.5V, the output voltage at pin 7 rises at the same
rate. Op amp stage IC1a is configured
as a comparator with hysteresis and
its output is low when its pin 3 input
is below 2.5V and high when its input
is above 2.5V.
This input is fed via a divider from
S2a
S1a
CURRENT
FLOW
(b) DRIVING FORWARDS
LOCOMOTIVE
MOTOR
0V
0V
S2b
S1b
+12V
S2a
S1a
+12V
CURRENT
FLOW
(c) DRIVING IN REVERSE
LOCOMOTIVE
MOTOR
0V
S2b
S1b
S2a
0V
CURRENT
FLOW
S2b
(d) BRAKING
March 2017 35
Fig.2: the complete circuit diagram for the Stationmaster, with the hand controller circuitry shown in the box at lower left.
IC1a and IC1b generate a triangle waveform at around 8kHz and IC1c and IC1d compare this to the control signal from
speed pot VR2. The outputs of IC1c and IC1d are PWM signals which are squared up by schmitt trigger inverter IC2 and
fed to H-bridge IC3 to drive the tracks.
the output of IC1b, with the other end
of the divider connected to its pin 1
output. So essentially, this completes
the feedback path causing IC1b to oscillate as well as defining the amplitude of the triangle wave it produces,
by the ratio of the 1kW and 3.3kW resistors.
When output pin 1 of IC1a is low, at
say 0.9V, output pin 7 of IC1b will need
to rise above 3V in order to switch the
output of IC1a high. You can confirm
this by calculating the voltage at pin
3 (in the middle of the divider): (3V ×
3.3kW + 0.9V × 1kW) ÷ (3.3kW + 1kW)
= 2.51V. Similarly, when output pin 1
of IC1a is high, at say 4.05V, output pin
7 of IC1b will need to fall below 2V in
order to switch the output of IC1a low;
(2V × 3.3kW + 4.05V × 1kW) ÷ (3.3kW
+ 1kW) = 2.48V.
36 Silicon Chip
So these will be the approximate
maximum and minimum voltages of
the triangular waveform at output pin
7 of IC1b, with a maximum of around
3V, a minimum of around 2V and thus
a peak-to-peak voltage of around 1V.
The actual waveforms produced by
the prototype are shown in the oscilloscope grab of Fig.3. The waveform at
pin 1 of IC1a is the green trace while
that at pin 7 of IC1b is the blue trace.
As you can see from the measurements
at the bottom of the screen, the actual peak-to-peak voltage of the triangle wave is 880mV and the frequency
is 9.43kHz (the actual frequency will
vary depending on circuit tolerances
but it is not critical).
The triangular wave is converted
into a variable duty cycle PWM signal
by comparing its amplitude to that of a
DC control signal which varies somewhere between its minimum and maximum voltages. The higher the control
signal voltage, the higher the PWM
duty cycle. However, the situation is
complicated by the fact that we need
to be able to drive the locomotive in
either direction and that we also need a
"dead band" when the speed pot is set
somewhere around the middle, where
there is no drive at all.
This situation is handled by using
two comparators along with two triangle waveforms that have slightly different DC levels. The other two stages of op amp IC1, ie, IC1c and IC1d
are used for these comparators and
the waveform from the pin 7 output
of IC1b is coupled to two of their inputs (pins 9 and 12) via 100nF capacitors. The DC bias for these two pins is
siliconchip.com.au
Fig.3 (left): the blue trace is the triangle waveform at pin 7 of IC1b. It has a frequency of 9.43kHz and an amplitude of
880mV peak-to-peak. The yellow and mauve traces are the DC-shifted versions of this waveform at pins 10 and 13 of IC1
respectively. The green trace shows the pulse applied to pin 6 of IC1b which are in-phase with the triangle waveform and
have a maximum voltage of 4.31V and minimum of 1.31V, limited by the drive capability of the op amp.
Fig.4 (right): the same voltages from pins 10 and 13 of IC1 are shown here but the blue trace now shows the reference
voltage from speed pot VR2. Since it is below the yellow trace and above the mauve trace, no drive is applied to the tracks
and the PWM output at pin 4 of IC2b, shown in green, is a flat line (ie, there is no PWM signal to tracks).
provided by a resistor network across
the 5V supply comprising two 47kW
fixed resistors, an 18kW resistor and
20kW trimpot VR1 which is connected
as a rheostat (ie, variable resistor).
Thus, input pin 9 of IC1c has a DC
level between 2.84V and 3.22V while
input pin 12 of IC1d has a DC level
between 1.78V and 2.16V, depending
on the setting of VR1. The average of
these two voltages will be very close
to the 2.5V half supply rail. The further apart these two voltages are, the
larger the "dead band" will be, allowing the speed control potentiometer to
be rotated over a larger part of its range
without any drive to the locomotive.
This adjustment is necessary to allow for variations in the amplitude
of the triangle waveform; VR1 is adjusted until the waveforms no longer
overlap, so that there is no drive to the
locomotive tracks with the speed pot
in its central position.
Also, there's no guarantee that when
its speed pot is in its half-way position,
it will necessarily be at exactly half
its nominal resistance value. Indeed,
if using a pot with a central detent, it
would be very annoying if the loco
slowly moved in one direction or the
other. So the dead band needs to be so
that the loco tracks get no drive with
the speed pot at its half-way point.
The two DC-biased triangle waveforms can also be seen in Fig.3, with
pin 9 of IC1c in yellow and pin 12 of
siliconchip.com.au
IC1d in mauve. As you can see, VR1
has been adjusted so that the minimum
voltage of pin 9 is above the maximum
voltage of pin 12.
Speed, inertia & brake controls
The speed, inertia and brake controls consist of two pots and a momentary switch and are normally mounted
in the separate hand controller unit
which is attached to the main board
by a telephone cable.
Normally, a 2-metre cable is about
right however you can use a longer or
shorter cable if necessary. There are
provisions to mount these controls
inside the main unit, however, we
won't go into details about that option
since we think most people will want
to use the hand controller for walkaround operation.
The controls are shown at lower left
in the circuit of Fig.2. Speed control
pot VR2 is effectively connected across
the 5V supply with padding resistors
at either end to limit the voltage at its
wiper so that it varies over an appropriate range to go from full speed in
the forward direction to full speed in
reverse, without too much of a dead
zone at either end.
The inertia potentiometer is wired
as a rheostat (variable resistor) and is
in series with the return signal from
the speed pot's wiper. The other end of
the inertia pot is fed to a pair of 2.2µF
capacitors on the main board, via a
10kW fixed resistor, so the higher a
resistance the inertia pot is set to, the
more slowly the voltage across these
2.2µF capacitors change. This simulates a locomotive with more inertia
(mass), so its speed will change more
slowly when the speed pot is rotated.
Brake switch S1 bypasses both the
speed and inertia pots and connects
the 2.5V mid-rail supply directly to the
10kW resistor, which rapidly charges/
discharges the 2.2µF capacitors on the
main board until the locomotive has
stopped and it will remain stopped
until the brake switch is released; if
the speed pot is at its midpoint after
the brake is released, the loco will not
move off again.
Note that braking is not instant as
this may cause the locomotive(s) to derail but it will stop the loco(s) significantly faster than simply winding the
speed pot back to its central position.
Track drive
The output of op amp (comparator)
IC1c goes high when the speed control
signal at its pin 10 non-inverting input
is above the triangle waveform at its
pin 9 inverting input, thus, its output
duty cycle increases with clockwise
rotation of the speed pot.
Similarly, the output of op amp
(comparator) IC1d goes high when the
speed control signal at its pin 13 inverting input is lower than the triangle
waveform at its pin 12 non-inverting
March 2017 37
Fig.5 (left): the same traces as in Fig.4 but now the speed pot has been rotated clockwise, increasing the reference voltage
(shown in blue). When the yellow waveform is below the blue reference voltage, the PWM output at pin 4 of IC2b, shown
in green, increases to 5V and it drops back to 0V when the yellow and blue waveforms cross again. Thus, as the speed pot
is rotated further clockwise, the PWM pulses at pin 2 of IC3 (IN2) increase in duty cycle.
Fig.6 (right): now speed pot VR2 has been rotated anti-clockwise past its centre position, so the reference voltage, shown
in blue, has now dropped low enough to intersect with the mauve waveform. The green trace now shows output pin 6 of
IC2c, which feeds input IN1 (pin 3) of IC3. Note that the positive edge of the PWM pulses is now delayed compared to the
crossing point, due to the limited bandwidth of op amp IC1 however the speed pot can still be used to adjust the PWM
duty cycle.
input, thus, its output duty cycle increases with anti-clockwise rotation
of the speed pot.
As stated earlier, VR1 is adjusted
so that the output of both comparators remain constantly low with the
speed pot at its halfway point. This
condition is shown in the scope grab
of Fig.4. The blue trace is the reference
voltage from speed pot VR2. Since it is
below the yellow trace and above the
mauve trace, no drive is applied to the
tracks and the PWM output at pin 4
of IC2b, shown in green, is a flat line.
Drive from both op amps (comparators) is fed to four of the six schmitt
trigger inverter stages of IC2. IC2a and
IC2f invert these signals and then drive
LED1 and LED2, which have a common 220W current-limiting resistor.
Hence, as the locomotive moves faster
in the forward direction, LED1 lights
up brighter (as it has a higher duty
cycle) and similarly, the brightness of
LED2 indicates the drive speed in the
reverse direction.
VM
POWER
PWM output waveforms
VCP
GATE
DRIVER
CHARGE
PUMP
OUT1
BRUSH TYPE
DC MOTOR
VM
IN1
ILIM
GATE
DRIVER
CORE
LOGIC
IN2
INTERNAL
CURRENT SENSE
OUT2
GND
38 Silicon Chip
TEMPERATURE
SENSOR
We previously referred to the scope
waveforms of Fig.3 and Fig.4 with the
latter showing the condition where the
speed control pot VR2 is centred, so
there is no output at pin 2 of IC3 (IN2,
green), nor at pin 3 (IN1, not shown).
Fig.7: internal block diagram for the DRV8871 H-bridge
IC. The internal Mosfets are shown at upper-right; you can
see the similarity in their connections to Fig.1. The IC also
contains the boost circuitry to produce the required high
and low side drive signals to the Mosfet gates, control logic
to prevent cross-conduction plus current and temperature
sensing and shutdown.
DRV8871
PROTECTION FEATURES
OVERCURRENT
MONITORING
The remaining four inverter stages
are wired up in two series pairs, effectively forming buffers to square up
the signals from IC1c and IC1d and
pass them to the inputs of integrated
H-bridge IC3.
With IN1 and IN2 (pins 3 and 2) of
IC3 both low, there is no output drive.
With IN1 high, OUT1 (pin 6) is driven
high while OUT2 (pin 8) is driven low.
With IN2 high, OUT1 is driven low
while OUT2 is driven high, reversing
the locomotive. And with IN1 and IN2
both high at the same time, both outputs are driven low to provide motor
braking, however, that feature is not
used in this circuit.
VOLTAGE
MONITORING
PGND
siliconchip.com.au
VR1 20kΩ
47kΩ
47kΩ
+
10µF
DEADBAND ADJUSTMENT
10kΩ
1kΩ
1µF
SYNC
+
220Ω
220Ω
REG1
78L05
DRIVE
1µF
220Ω
LED2
K
1000µF
25V
47kΩ
S1
Brake
10kΩ
56kΩ
VR2
100kΩ
Speed Control
In Fig.5, we have rotated VR2 partway clockwise and this has caused
the control voltage (blue trace) to rise
to 2.82V. As a result, pulses now appear at pin 2 of IC3 (IN2, green) with a
duty cycle of 28.8%. You can see that
the leading edges of these pulses correspond to the point where the yellow
trace dips below the blue trace and the
trailing edges are where they cross over
again, so the higher the blue (control)
voltage, the greater the applied duty
cycle will be.
Fig.6 shows the situation with VR2
rotated anti-clockwise from its central detent, reducing the control voltage (blue trace) to 1.72V. The green
trace now shows the voltage at pin 3
of IC3 (IN1) which has a duty cycle of
44.8% and the edges correspond to
the points where the blue and mauve
traces intersect.
H-bridge IC details
The internal block diagram of the
DRV8871 IC is shown in Fig.7. It has
four internal N-channel Mosfets with
parallel diodes which form the Hbridge which drives the motor, the
circuit blocks to control the Mosfets'
gates, the charge pump to generate the
required high-side and low-side gate
drive voltages and the various control
and protection units within.
This IC has a current limiting facilsiliconchip.com.au
VR3
1MΩ
Inertia Adjustment
CON5
To Main PCB
TO TRACK
CON3
2.2kΩ
2.2kΩ
+
1µF
K
LED4
K
1000µF
25V
+
BR1
Z0076
~
LED3
~
K
1000µF
25V
CON2
AC/DC IN
Vcc/2
LED1
K
CON1
VCC
18kΩ
3.3kΩ
10nF
2.2kΩ
IC1 TL074
100nF
1
22kΩ
100nF
IC2
MC14584
10MΩ
2.2µF
LED5
IC3
DRV8871
2.2µF
10MΩ
Internal Speed Pot Bottom
External
Int./Ext. Switch Controls
GND
Internal Brake
Int. Speed Pot Wiper/Inertia
Internal Speed Pot Top
CON4
Fig.8: PCB overlays for the main PCB
and hand controller PCB. Follow these
to build the two boards. There are only
two SMD components, IC3 and its 1µF
bypass capacitor, both on the main
board. The empty component positions
in the lower left corner of the main
board are there to allow the controls
to be mounted in the same box as the
main board and are left out if built with
the hand controller, as shown here.
Don't forget to install the wire link in
place of the internal/external switch.
ity which both protects it from damage
and also helps the unit withstand accidental short circuits across the track, as
will inevitably happen on any model
layout, particularly when a locomotive is derailed. The maximum output
current depends on the value of Rlim
which connects between the Ilim pin
and ground. The IC is rated for up to
3.6A peak, so a current limit of around
3A as set by Rlim = 22kW is quite safe.
Should IC3 overheat due to extended high current delivery, it will automatically shut down until it has cooled
sufficiently and then resume operation.
IC3 also has an internal "dead time"
delay to prevent cross-conduction of its
internal Mosfets, which means that the
driving circuitry can change the state of
inputs IN1 & IN2 at any time without
any chance of damaging the IC.
Referring back to Fig.2, IC3 also has
an SMD ceramic 1µF bypass capacitor to help stabilise the output voltage
and provide a relatively clean square
wave for driving the motor. Note that
IC3 has integral diodes between each
output and the two supply rails, to
clamp any inductive spikes from the
locomotive motor(s). It is purposedesigned for driving motors.
LED4 and LED5 are connected
across the track outputs in opposite directions with 2.2kW currentlimiting resistors and so normally echo
the brightness of LED1 and LED2 respectively, however, if there is a short
across the track, LED1/LED2 will still
light while LED4/LED5 will be off or
dim. Note that LED4 and LED5 are located near the output terminal and are
visible with the lid on the case.
Power supply
The power supply is quite simple
and accepts either 10-15VAC or 1219V DC. Actually, all the components
should survive with a supply as high
as 25V DC or 18VAC, should you wish
to push it close to its limiting values.
LED3 is connected directly across
the inputs and so will light solidly
with a DC input or flicker with reduced
brightness at 50Hz with an AC input.
Either CON1, a 2-way terminal block,
or CON2, a DC barrel connector can
be used. We suggest you stick with the
terminal block if your power supply
is rated at more than 2A.
The input supply is rectified by
bridge rectifier BR1 and this means
that with a DC supply, the polarity
of the connection is not important.
The output of the rectifier is filtered
with two parallel 1000µF capacitors,
smoothing any ripples in the DC and
also providing AC to DC conversion if
required (in combination with BR1).
The resulting DC is fed straight to the
motor controller IC, IC3 and also to the
March 2017 39
DIMENSIONS SUIT
ALTRONICS H0121 ABS BOX
ALL DIMENSIONS
IN MILLIMETRES
SILICON CHIP
STATIONMASTER
Input
{
{
To
Tracks
LID
16
38
TOP END OF BOX
input of 5V regulator REG1.
REG1 has a 1µF input bypass capacitor and 10µF tantalum output filter capacitor and supplies IC2, IC3 and the
two divider networks.
Construction
The Stationmaster is built on
two PCBs. The main board is coded
09103171, measures 143.5 x 50.5mm
and hosts most of the components
40 Silicon Chip
16
8
Fig.9: drilling and cutting diagrams for the main box. The
top panel drilling template can also be used as the panel
label.
while the hand controller board is coded 09103172, measures 98 x 40.5mm
and is fitted with the components
shown in the yellow box in Fig.2.
Use the overlay diagrams in Fig.8 as
a guide to construction, which is quite
straightforward. The only slightly
tricky component is IC3, which is only
available in a surface-mount package,
so start by soldering this. This has the
additional twist that the underside
of the IC features a metal pad which
needs to be soldered to the PCB to provide sufficient heatsinking.
If you have a hot air rework station,
all you need to do is apply a thin layer
of solder paste to the central pad and
eight pins for IC3, drop the IC in place
(ensuring its pin 1 dot is orientated as
shown in Fig.8) and then gently heat
the IC until all the solder reflows. You
can check that the solder underneath
siliconchip.com.au
DIMENSIONS SUIT
ALTRONICS H0216 ABS BOX
ALL DIMENSIONS
IN MILLIMETRES
5
2.5
STATIONMASTER
Fig.10: drilling and cutting diagrams for the hand controller. As with
the main box, the top panel drilling template can also be used as the
panel label.
16
17
16
17
CL
the IC has melted properly by examining it from the underside of the board
through the three large vias positioned
under IC3, once the board has cooled
sufficiently.
If you don't have a hot air tool,
we suggest you place a thin layer of
solder paste (or in a pinch, flux paste)
on the central pad for IC3, then
position it as explained above and tack
solder one of the eight pins using a
regular soldering iron.
Check that the IC is sitting flat on
the board and properly positioned
over its pads and then solder the
remaining pins, then refresh the first
pin which was tack-soldered. If any
bridges form between its leads, clean
them up using solder wick.
siliconchip.com.au
2.5
If you want to make your own label for either of the cases we have
a short description on our website on printing A4-sized synthetic
sticky labels here: www.siliconchip.com.au/Help/FrontPanels
You can then flip the board over and
melt some solder into the three large
vias under the IC. Leave the iron in
contact with this pad for a few seconds to ensure that the new solder remains molten and sufficient heat conducts through to the other side of the
board to reflow the solder paste. That
should do the trick and you can then
remove any excess solder on the underside pad using a solder sucker or
some solder wick.
There are also two small sets of SMD
pads on either side of IC3 and the one
to lower right is for the 1µF bypass
capacitor. This is pretty easy to solder, simply tack solder one end, wait
for the solder to cool, solder the other
end (being careful to ensure the solder
flows onto both the PCB pad and the
end of the capacitor) and then apply
fresh solder to the first joint.
Through-hole parts
With IC3 in place, the rest is pretty
straightforward. Fit the 15 small resistors in the locations shown in Fig.8. It's
a good idea to check the values with a
DMM before fitting as the colour bands
can be hard to identify accurately.
If you are using IC sockets, now is a
good time to install them, making sure
to orientate the notches as shown in
the overlay diagram. Otherwise, solder
the other two ICs directly to the PCB
but be careful to make sure that you
don't get them mixed up and that the
pin 1 dot goes in the location shown.
March 2017 41
Next, install all the small capacitors. The values are indicated on the
overlay diagram. The capacitors of 1µF
and above have a polarity (+) indicator, however, note that only the 10µF
capacitor is actually polarised and this
should have a matching + sign printed
on its body, which must be lined up
with that on the PCB.
LEDs 3-5 can now be fitted, taking
care to orientate them with the flat
side of the lens/shorter lead (cathode) to the right/bottom of the board,
where indicated with "K" on the PCB
overlay. These are pushed all the way
down onto the PCB before being soldered and the leads trimmed.
You can now fit the PCB stakes if
you want to, however, it isn't necessary and you can simply probe these
pads with DMM leads if necessary to
troubleshoot the circuit.
Now mount trimpot VR1 and regulator REG1. You will need to crank
REG1's leads to fit the solder pads
and make sure it goes in the right way
around, with its flat face towards the
nearest edge of the PCB. Note that a
7805 regulator can be used instead
and in this case, its metal tab faces the
edge of the PCB.
Next on the list are DC connector
CON2 and RJ12 connector CON4, both
of which should be pushed all the way
down onto the PCB before you solder
their pins. You can then follow with
terminal blocks CON1 and CON3
which must be fitted with their wire
entry holes towards the right edge of
the board.
Next, fit BR1, with its chamfered
corner towards the top edge of the
board. It should also have a + sign on
the body of the device which you can
line up with the polarity marker on
the PCB. The three 1000µF capacitors
can go in next, being careful to ensure
that the longer (+) lead goes through
the pad marked + in each case.
Now install LED1 and LED2. If you
want these to be visible through the
panel label on the lid of the box, fit
them with the bottom of each lens
21mm above the top surface of the
PCB.
However, these are really only necessary for diagnostic purposes so you
could just solder them flat on the PCB
like the others. As before, the cathode
side (shorter lead) is indicated in the
overlay with a "K" and this should line
up with the flat side of the lens.
The main PCB is now complete and
42 Silicon Chip
you can move on to building the hand
controller.
Hand controller assembly
There aren't many components on
this board. First solder the three small
resistors in place, then fit the RJ12 connector in the same manner as you did
for the main board. Having done that,
solder S1 and VR3 in place after making sure they have been pushed down
fully onto the PCB.
For VR2, you can use a similar pot
to VR3 however it's better if you use
the 16mm pot with centre detent, as
specified in the parts list. In this case,
the pot is be mounted on the case and
attached to the PCB via three short
(~50mm) flying leads. Refer to the photo above to see how the wiring is done.
Completing the hand controller
The next step is to prepare the two
cases to accept the boards. For the
hand controller, this is simply a matter of drilling three holes in the lid for
the two pots and pushbutton shaft to
poke through.
You can download the panel label
artwork from the Silicon Chip website
and use this as a drilling template; or
copy Fig.10. The hole for the 9mm pot
should be drilled to 7mm and 8mm for
the 16mm potentiometer. Ideally, you
should also drill a 3mm hole for the
latter pot's locking tab, although you
can simply snap this off (but then you
will need to do its nut up tight to stop
it rotating).
Having done that, print and affix the
panel label (see the link below Fig.10
for suggestions on how to do this) and
cut out the holes with a sharp hobby
knife; there's no need to make a hole
for the pot's locking tab as this will not
protrude through the case.
Now cut and/or file a rectangular
hole in the case end panel, as shown
in Fig.10. You can then insert this into
the appropriate slots and affix the hand
controller PCB to the integral posts
in the bottom of the case using four
small self-tapping screws. Note though
that you need to place two M3 Nylon
nuts on top of each of these posts before inserting the screws; these act as
spacers to get the modular socket to
the right height.
It's then simply a matter of inserting the other end panel into the case,
placing the lid on top, using the four
supplied screws to join the two halves
of the case together and then attach
the two knobs and the button cap for
S1. The knob for VR3 and the button
cap for S1 are simply pressed on and
held by friction while you will need
to use the grub screw to attach the
knob for VR2.
Completing the main unit
Now to complete the main unit.
First, you need to cut or file down the
rim around the lid of the case so that
when you attach the PCB later, the part
which projects out the side will not be
fouled by this rim. See the photo adjacent to Fig.9 for details.
Having done that, the next step is
to make the cut-out for the modular
socket in the side of the case. Fig.9
shows the detail. The only remaining holes that need to be made are for
LED1 & LED2, assuming you've decided to install them with long leads so
that they can be seen with the lid on.
The positions for these 3mm holes are
shown in Fig.9.
Now affix the panel label, using the
same technique as for the hand controller, making sure the "Motor Drive
Present" text goes just below the two
holes if you have drilled them. The label
should be orientated so that the logo is
near the cut-out for the modular socket.
Then attach the PCB to the lid using two short self-tapping screws and
check that the two halves of the case
fit together properly and top of the
LED lenses poke through the hole (if
you've made them).
But before you actually put the case
together, we need to do some testing
and adjustment.
Test & set up
Plug the hand controller into the
main board using a 4-wire telephone
cable and centre the speed pot while
the inertia pot should be fully anticlockwise. Adjust trimpot VR1 on the
main board to be fully clockwise.
Apply power to the main board via
CON1 or CON2 and check that LED3
lights. The other LEDs should be off. If
any of the other LEDs light up, switch
off and check for faults. Using IC3's
ground plane as the 0V reference,
check for 4.5-5.5V at the VCC test point
and half that at the VCC/2 test point. If
you have a frequency meter, measure
the frequency at the SYNC test point.
It should be in the range of 8-10kHz.
Measure the AC voltage across the
terminals of CON3. You should get 0V.
Now slowly rotate VR1 anti-clockwise
siliconchip.com.au
Parts List
1 double-sided PCB coded 09103171, 143.5 x 50.5mm
1 flange mount ABS box, 125 x 80 x 35mm (Altronics H0121)
1 panel label, 50 x 92mm
1 20kW single-turn horizontal PCB-mount trimpot (VR1)
2 No.4 x 5mm self-tapping screws
2 2-way 6.35mm PCB-mount terminal blocks (CON1,CON3) (Altronics
P2036A)
1 PCB-mount DC socket, 2.1mm or 2.5mm ID (CON2)
1 6P4C RJ14 low-profile PCB-mount modular socket (CON4) (Altronics
P1432)
2 14-pin DIL sockets (optional)
10 PCB stakes (optional)
Semiconductors
1 TL074 quad JFET-input op amp (IC1)
1 MC14584 hex schmitt trigger inverter (IC2)
1 DRV8871 H-bridge IC (IC3)
1 78L05 100mA 5V linear regulator (REG1)
1 400V 4/6A vertical PCB-mount bridge rectifier (BR1) (Jaycar ZR1360,
Altronics Z0076)
2 3mm yellow LEDs (LED1,LED2)
1 3mm red LED (LED3)
2 3mm green LEDs (LED4,LED5)
Capacitors
3 1000µF 25V low-ESR electrolytic capacitors
1 10µF 6V tag tantalum capacitor
2 2.2µF 50V multi-layer ceramic capacitors
2 1µF 50V multi-layer ceramic capacitors
1 1µF 25V X7R SMD ceramic capacitor, 2012/0805 size
2 100nF 50V multi-layer ceramic capacitors
1 10nF 50V MKT capacitor
Resistors (all 0.25W, 1%)
2 10MW
2 47kW
1 3.3kW
3 2.2kW
1 22kW
1 1kW
1 18kW
3 220W
Final assembly and usage
1 10kW
Additional parts for hand controller
1 PCB coded 09103172, 98 x 40.5mm
1 light grey ABS instrument case, 160 x 60 x 30mm (Altronics H0216)
1 panel label, 51 x 94mm
1 6P4C RJ14 low-profile PCB-mount modular socket (CON5) (Altronics
P1432)
1 PCB-mount tactile switch with 22mm long actuator (S1) (Altronics
S1119)
1 100kW 16mm potentiometer with centre detent (VR2) (Futurlec
100KBDETENT)
1 1MW 9mm vertical PCB-mount potentiometer (VR3) (Altronics R1950)
1 button cap (for S1) (Altronics S1482)
1 33mm black 1/4” shaft knob with white marker (for VR2) (Altronics H6067)
1 11mm black 18 tooth spline plastic knob (for VR3) (Altronics H6545/6)
4 No.4 x 5mm self-tapping screws
8 M3 Nylon hex nuts
3 50mm lengths of light duty hookup wire
1 2m RJ14 to RJ14 telephone cable (eg, Altronics P0766)
Resistors (all 0.25W, 1%)
1 56kW
1 47kW
siliconchip.com.au
1 10kW
until LED1 and/or LED2 light up, then
back off slightly until both LED1 and
LED2 are off. Check again that you
have 0V at CON3.
You can now slowly rotate speed
pot VR2 in one direction. If rotating
clockwise, LED1 and LED4 should
both light up and get brighter as you
turn the pot further. If rotating anticlockwise, LED2 and LED5 should
both light up and get brighter as you
turn the pot further.
Now rotate the inertia pot clockwise
and the above should still hold true
but you should notice that the rate
of change of LED brightness has been
reduced. With the speed pot fully at
one stop, hold down brake switch S1
and check that LED1, LED2, LED4 and
LED5 all switch off in fairly short order and return to their previous states
once you release it.
As a final test, you can hook up the
CON3 terminals to a pair of train tracks
and check that you can control the
speed and direction of a locomotive
on those tracks as expected. If it moves
in the opposite direction to what you
intend, simply swap the connections
at CON3.
Now that you've confirmed it's
working, you can join the two halves
of the box with the supplied screws
and integrate the controller into your
layout.
Note that while pressing and holding the brake button will bring everything to a halt very quickly, practice
will allow you to tap S1 to slow a locomotive, which will return to set speed
when you release it.
If you do need to use S1 for emergency braking, remember to set speed potentiometer VR2 to its central position
(easy if you've used a pot with centre
detent) before releasing S1 in order to
prevent the locomotive from moving
again when S1 is released.
RJ12 adaptors can be purchased and
placed along a loom cabled around the
layout so that the hand control can be
unplugged and moved to a different
location as you operate.
The speed set at the time of unplugging will be maintained for a period
and will slowly diminish over time
until control is re-established, which
might cause a rapid return to the former speed. It's best to set the inertia
control fairly high before plugging the
SC
controller back in to avoid this.
March 2017 43
|