This is only a preview of the January 1996 issue of Silicon Chip. You can view 22 of the 96 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. Articles in this series:
Articles in this series:
Articles in this series:
|
IR remote control for
the Railpower Mk.2
This remote control gives you complete
freedom of operation for the Railpower
Mk.2 train controller. It has pushbutton
control for everything & pulls negligible
current when not in use.
By RICK WALTERS
As presented in the September &
October 1995 issues, the Railpower
Mk.2 is a walkaround throttle. It
allows you to follow your trains as
they go around the layout. As such, it
performs very well. But perhaps you
don’t like being tethered by a remote
control cable. If so, you will want this
infrared remote control. It operates just
like any other remote and is based on
70 Silicon Chip
the same microprocessor used in the
Railpower Mk.2.
The remote control handpiece has
six pushbuttons but does not have
the meter which was included in the
walkaround hand control. Instead,
we have designed a small PC board
which has an array of 10 LEDs, to give
an indication of train speed. This is
mounted inside the main unit, along
with a small PC board for the infrared
receiver.
The remote control uses the same
plastic case as for the walkaround
hand control. It contains a small PC
board (coded 09101961) and a battery.
The board contains six pushbuttons,
three transistors, one IC, one crystal
and a few other components.
As you can see from the circuit of
Fig.1, the battery is connected all the
time, as is standard practice in all
infrared remote controls. But instead
of a dedicated IC as found in most remote controls, we have used a Z86E08
microprocessor.
To conserve the battery, we have
used a feature which was not previously exploited. The Z86E08 is a
CMOS device and normally does not
draw much current but for battery
operation, it can be put into a “sleep”
mode, whereby the current it draws
Fig.1: the transmitter circuit. This uses a Z86E08 microprocessor to produce
coded IR pulses when the buttons are being pressed. When the buttons are not
being pressed, the microprocessor goes into sleep mode to conserve the battery.
is only 10µA. This greatly increases
the battery life.
When IC1 is put to sleep. it takes
pins 16, 17 & 18 high (ie, to the battery
positive line, +4.5V). Later, when any
button is pressed, R0 or R1 (ie, row
zero or row one of the pushbutton
matrix) will go high, turning on transistor Q1 via diode D1 or D2. Q1 pulls
pin 4 of IC1 low, to “wake it up”, after
which it takes pins 16, 17 & 18 low
and scans the buttons to see which
one was pressed.
C3 (column 3), the input to the
INERTIA button, is high and if this
is pressed, pin 9 of IC1 will go high.
If this button is not pressed the processor then takes pin 16 (C2) high.
As you can see from the circuit, the
STOP or FASTER button, if pressed,
will take pin 8 or pin 9 of IC1 high
and the code for this button will be
sent. Pins 17 and 18 are taken high in
sequence and if any of the remaining
buttons are pressed, their code will
be transmitted.
The pulse code appears on pin 3
of IC1 and turns Q2 and thus Q3 on
and off. Q3 pulses two infrared LEDs
(LED1 and LED2).
Remember, only one button is press
ed at a time and the code for this button
will be sent many times before you can
release it. With the jumpers set on 1,1
a burst of code takes 20 milliseconds
to be sent.
Each time the processor finishes a
scan, it takes all column outputs high
(C0-C3) and looks at the collector of
Q1. If it is low, indicating a button is
pressed, it will scan the buttons again;
if high, it will go into sleep mode to
conserve the batteries.
The RATE links A and B must be
the same in the transmitter and the
Below: this photo shows the
completed IR receiver board being
installed in the Railpower case.
Note the mounting details for the
Acknowledge LED and the LT536
infrared diode (PD1).
January 1996 71
Fig.2: the IR receiver circuit. This uses two cascode transistor stages (Q1, Q2
and Q4, Q5) with AGC to provide the necessary large gain for the photodiode
signal. The signal decoding is done by IC4, a Z86E08 microcontroller
programmed for this purpose.
receiver. These links could allow you
to have one hand control with a 3-position selector switch and this could
control three Railpower IR receivers,
each with a different rate setting.
Infrared receiver
The infrared receiver consists of
photodiode PD1, cur
rent-to-voltage
converter IC1, two cascode transistor amplifiers (Q1, Q2 and Q4, Q5)
with AGC (automatic gain control), a
comparator and AGC detector (IC2),
a pulse stretcher (IC3) and a data
decoder, IC4. These are all mounted
on a PC board (coded 09101962)
which is housed in the case of the
72 Silicon Chip
Railpower controller. The circuit is
shown in Fig.2.
Photodiode PD1 sees the IR pulses
emitted by the remote control and
varies its current accordingly. This
variation in current is converted to
voltage pulses by op amp IC1 which
drives the base of Q1 via a .015µF
capacitor.
The pulses from IC1 can vary from
around 0.2V peak-peak when the remote control is close to PD1 to being
lost in the noise when it is some distance away. For this reason, we need
a lot of gain for weak signals but not
very much for the stronger ones. We
obtain lots of gain by using cascode
circuits and then we use automatic
gain control (AGC) on both to cope
with large signals.
Gain control
The two cascode circuits are similar, the first using PNP transistors
Q1 & Q2, the second using NPN
transistors Q4 & Q5. AGC is applied
to the first pair by FET Q3, while
FET Q6 applies AGC to the second
cascode pair.
The gain of the first cascode stage,
with Q3 turned off, is around 3.3 while
the gain of the second stage, with Q6
turned off, is 2.2 giving an overall gain
of 7.3 (3.3 x 2.2). With Q3 & Q6 turned
on fully, the gain of each cascode
stage can be in excess of 200, giving
an overall gain of 40,000 or more for
very small input signals.
PARTS LIST
Remote Control Transmitter
1 PC board, code 09101961, 85
x 50mm
1 plastic case (Jaycar HB-6032
or equivalent)
1 4MHz crystal (HC18, HC49)
2 yellow PC mount momentary
switches (Jaycar SP-0722 or
equivalent)
1 red PC mount momentary
switch (Jaycar SP-0720 or
equivalent)
1 black PC mount momentary
switch (Jaycar SP-0721 or
equivalent)
1 white PC mount momentary
switch (Jaycar SP-0723 or
equivalent)
1 green PC mount momentary
switch (Jaycar SP-0722 or
equivalent)
1 single AA cell holder (see text)
3 L1154 alkaline batteries
1 18 pin IC socket (optional)
4 #8 x 10mm self-tapping screws
4 5mm untapped spacers
1 100mm-length red wire
1 100mm-length black wire
1 50mm-length 1mm sleeving
Semiconductors
1 Z86E08 programmed TXA (IC1)
2 1N914 signal diodes (D1,D2)
2 BC338 NPN transistors (Q1,Q2)
1 BC640 PNP transistor (Q3)
2 CQY89A LED (or equivalent)
Capacitors
1 100µF 16VW electrolytic
2 0.1µF 50VW monolithic
2 22pF ceramic
In practice, the output signal from
the collector of Q5 is monitored by
IC2b which is connected as a peak
rectifier. With no input signal present,
pin 2 of IC2b is pulled high by the
47kΩ resistor connected to the +5V
rail. Negative-going pulse signals at
the collector of Q5 cause IC2b and
its associated diode D1 to pull pin 2
towards 0V and hence discharge the
100µF capacitor. Thus, the gates of Q3
& Q6 tend to be taken high for small
signals, to increase the gain. Conversely, large signals tend to result in the
gates of Q3 & Q6 going toward 0V, to
Resistors (0.25W, 1%)
4 100kΩ
1 470Ω
1 22kΩ
1 100Ω
1 10kΩ
2 1Ω
1 1kΩ
IR Receiver Board
1 PC board, code 0911X951, 120
x 50mm
1 4MHz crystal (HC18,HC49)
1 18-pin IC socket (optional)
2 3mm x 15mm threaded spacer
2 3mm x 10mm screw
2 3mm x 6mm screw
1 200mm-length black hook-up
wire
1 200mm-length red hook-up wire
1 200mm-length orange hook-up
wire
1 200mm-length yellow hook-up
wire
1 200mm-length green hook-up
wire
Semiconductors
1 TL071 op amp (IC1)
1 TL072 dual op amp (IC2)
1 74HC132 quad 2-input NAND
gate (IC3)
1 Z86E08 programmed RXB (IC4)
2 2N2907 PNP transistors
(Q1,Q2)
2 BC549 NPN transistors (Q4,Q5)
2 BS170 FET (Q3,Q6)
1 LT536 photodiode (PD1)
1 1N914 signal diode (D1)
1 5mm red LED (LED1)
Capacitors
1 100µF 16VW electrolytic
3 10µF 50VW electrolytic
turn them off and reduce the gain.
In practice, the circuit continuously
varies its gain so that the signal amplitude at the collector of Q5 is more
or less constant.
Q3 & Q6 are connected to the emitters of their respective cascode stages
via 0.1µF capacitors. This means that
the gain of the cascodes increases at
high frequencies but not at 50Hz or
100Hz, to reduce any interference from
incandescent or fluorescent lights.
IC2a is connected as a comparator
and compares the signal from the
collector of Q5 with the DC voltage at
6 0.1µF 50VW monolithic
1 .015µF 100VW MKT polyester
1 .01µF 100VW MKT polyester
1 .001µF 100VW MKT polyester
1 820pF disc ceramic
1 680pF disc ceramic
2 22pF capacitors
Resistors (0.25W, 1%)
1 220kΩ
1 18kΩ
3 100kΩ
3 10kΩ
1 68kΩ
1 3.3kΩ
2 56kΩ
1 2.2kΩ
2 47kΩ
2 1kΩ
3 33kΩ
1 470Ω
3 22kΩ
Speed Display Board
1 PC board, code 09101963, 65
x 50mm
1 5kΩ horizontal trimpot (VR1)
1 1kΩ horizontal trimpot (VR2)
Semiconductors
1 LM3914 bargraph driver (IC1)
1 10-LED display (Jaycar ZD1700)
Capacitors
1 10µF 50VW electrolytic
1 1µF 16VW electrolytic
1 0.1µF monolithic
Resistors (0.25W, 1%)
1 100kΩ
1 4.7kΩ
1 15kΩ
1 820Ω
1 15kΩ 9-resistor array (10-pin
SIP)
Miscellaneous
Hookup wire, PC stakes.
its pin 5. It effectively squares up the
signal pulses and removes any residual
noise. IC2a drives IC3, a CMOS quad
NAND gate which is used as a pulse
stretcher. This allows us to supply a
consistent pulse width to IC4, regardless of the output of IC2a.
Data decoder
IC4 is another Z86E08 microprocessor which has been programmed
to accept the IR data transmitted by
the hand control and convert it to the
correct code on pins 15, 16 & 17 to
operate the Railpower functions. The
January 1996 73
This topside view of the remote control transmitter board shows how the crystal
is laid flat. Make sure that the two IR LEDs are correctly oriented.
Fig.3: the component layout for the
transmitter PC board. Note the three
capacitors mounted on the underside
of the board. These are shown dotted
within the outline for IC1.
microprocessor stores two consecutive codes from the transmitter and
compares them. If they are identical,
it will send the information to the
Railpower; if they differ, it will ignore
them and compare the next two codes
received. As mentioned previously,
the rate links on the receiver must be
the same as those on the transmitter.
The three output lines from IC4 are
This view inside the completed transmitter shows the mounting details for the
three capacitors on the copper side of the board. Note the modified AA cell
holder for the three button cells.
Fig.4: the component
overlay for the IR
receiver board. Note that
the rate links on this
board must match the
rate link settings on the
transmitter PC board.
74 Silicon Chip
This view shows how the IR receiver board is mounted vertically along one side of the Railpower Mk.2
case, while the speed board is mounted upside down, with the LEDs protruding through the front panel.
RESISTOR COLOUR CODES
❏
No.
❏ 1
❏ 8
❏ 1
❏ 2
❏ 2
❏ 3
❏ 4
❏ 1
❏ 1
❏ 4
❏ 1
❏ 1
❏ 1
❏ 3
❏ 1
❏ 2
❏ 1
❏ 2
Value
220kΩ
100kΩ
68kΩ
56kΩ
47kΩ
33kΩ
22kΩ
18kΩ
15kΩ
10kΩ
4.7kΩ
3.3kΩ
2.2kΩ
1kΩ
820Ω
470Ω
100Ω
1Ω
4-Band Code (1%)
red red yellow brown
brown black yellow brown
blue grey orange brown
green blue orange brown
yellow violet orange brown
orange orange orange brown
red red orange brown
brown grey orange brown
brown green orange brown
brown black orange brown
yellow violet red brown
orange orange red brown
red red red brown
brown black red brown
grey red brown brown
yellow violet brown brown
brown black brown brown
brown black gold gold
5-Band Code (1%)
red red black orange brown
brown black black orange brown
blue grey black red brown
green blue black red brown
yellow violet black red brown
orange orange black red brown
red red black red brown
brown grey black red brown
brown green black red brown
brown black black red brown
yellow violet black brown brown
orange orange black brown brown
red red black brown brown
brown black black brown brown
grey red black black brown
yellow violet black black brown
brown black black black brown
brown black black silver brown
January 1996 75
Adding A Speed Meter To The Railpower Mk.2
Fig.5: the speed meter is a conventional LM3914 LED bargraph circuit. It takes the place
of the analog meter in the original walkaround control for the Railpower Mk.2.
If you wish to add a speed meter to the Railpower Mk.2, then
use the LED bargraph display we
have designed. It sits above the
LED indicators on the front panel
of the main unit and consists of a
bar of 10 red LEDs. It is a standard
circuit employing an LM3914 LED
bargraph display driver. The two
preset potentiometers on this board
are adjusted in a similar manner to
the meter setup in the hand control.
The circuit is shown in Fig.5 while
the component overlay for the PC
board (coded 09101963) is shown
in Fig.6.
Fit the IC, SIP and resistors, then
the capacitors and potentiometers.
If you wish, you can solder the
potentiometers on the copper side
of the board, as we have done, to
make them easy to adjust.
Connect a red wire to the +17V,
orange to the +5V, black to the
ground and yellow to the input
terminal, as shown on the layout.
The other end of the red wire connects to +17V on the main board
(REG1 input), the orange to +5V
(REG1 output) and the black wire
to ground. The other end of the
yellow wire should be soldered to
pin 4 of IC1 (top of VR5).
connected to IC1 in the Railpower
unit.
handpiece and the IR receiver board.
As mentioned previously, we have
also designed an optional LED bar
graph speed indicator which takes the
place of the speed meter in the original
walkaround hand control.
Let’s start with the remote control
transmitter PC board. Its component
layout is shown in Fig.3. Check the
board for open circuit tracks or shorts,
especially the track that passes between pins 7 and 8 of IC1. While you’re
at it, check the other two boards for
any etching problems and make any
fixes as required.
The first step is to mount the blank
board in the plastic case. It goes in the
half with the brass inserts (the front),
with the copper side of the PC board
facing up.
A small hole has been drilled at the
centre of each group of four pushbutton pads to allow you to drill pilot
holes through into the case front for
the six pushbuttons. When you have
drilled them, remove the board from
the case. (By the way, these pilot holes
are not present in the photo of our
prototype).
Fit the two long and two short links
Construction
In discussing the construction, we
will assume that you have already
built the Railpower Mk.2, as described
in the Sep
tember & October 1995
issues. We will also assume that you
have built up the original wired hand
control and have made everything
function as described in the setup
procedure.
To add the infrared remote control,
you need to build the remote control
76 Silicon Chip
Calibration
Once the maximum and minimum speeds have been set satisfac
torily on the main Railpower PC
board, FORWARD should be se-
This assembled speed meter shows nine discrete
resistors instead of the specified SIP resistor array.
lected and the minimum pot (VR2)
on this board set so that the first
LED lights. The controller should
then be taken to full speed and the
maximum pot (VR1) adjusted so
that LED number 10 is lit. There is
a small amount of interaction and
the adjustments may have to be
made several times to get it right.
As an alternative to the speed
bargraph, there is no reason why
you could not mount the original
walkaround control meter in the
front panel, fitting a meter zero
adjust control the same as in the
handpiece and taking the positive
meter wire to pin 2 on the DIN
socket.
at the LED end of the board and the
two rate links. We suggest you initially
code it 1,1 as shown on the overlay,
as this gives the fastest transmission
rate. Next, fit and solder the diodes and
resistors, followed by the transistors,
capacitors and crystal. Push the transistors well down so that they are only
about 2mm off the board. Bend the
crystal’s leads at right angles and lie
it down flat. The electrolytic capacitor
should also lie flat on the board.
Lastly, fit the pushbuttons, noting
that all the flats face in the same direction (towards the rate links). Do not
The two adjustment pots are mounted on the underside
of the speed meter board for easy access.
Fig.6 (right): install the
parts on the speed meter
PC board as shown in this
wiring diagram. Check that
all the LEDs are correctly
oriented and note the
mounting details for VR1
and VR2 (see photo above
right).
fit the LEDs as this will be done later.
If you elected not to use an IC socket,
fit and solder the IC marked TXA (this
Z86E08 has been programmed as the
transmitter); otherwise, solder in the
IC socket. In either case, be sure to
check the orientation of pin 1.
As the PC board is rather small, we
elected to mount three capacitors on
the copper side. These can be fitted
now. The 0.1µF monolithic type is
soldered from pin 5 to pin 14, then
laid flat against the board towards the
pin 1 end. The two 22pF capacitors
are soldered from pin 6 to pin 13 and
from pin 7 to the pad on the copper
track between pin 13 and pin 10. Both
are laid flat, facing towards the other
end of the socket. These details can be
checked in the relevant photo.
Battery holder
The battery consists of three 1.5V
button cells in series. These are held
in a half-sized holder made out of a
single AA cell holder. Cut the battery
holder in half with a saw or sharp knife
about 28mm from the spring end. Our
holder had a moulded ridge at this
point. Carefully cut the non-spring
January 1996 77
plastic end out of the holder and locate it in the piece with the spring to
make a half-size unit. The easiest way
to retain the end is to melt the plastic
with your soldering iron. If you do
this inside and out, the end will be
held firmly in place. Alternatively, you
can do a neater job if you have access
to ACC adhesive as used in plastic
model making). Solder a red wire to
the spring end and a black wire to the
other end, then connect the red to the
positive supply terminal on the PC
board and the black wire to the nega
tive terminal.
Now drill one of the case end pieces
to take the IR LEDs. Drill two 5mm
holes on the horizontal centreline
and 7.5mm either side of the vertical
centreline. Slip 10mm of 1mm-dia.
sleeving over each long LED lead, sit
the PC board and LEDs in the case
and bend the leads so that 2-3mm of
each LED protrudes through the end
piece. The longer sleeved lead should
be on the right when viewed from the
component side.
Once you are satisfied, solder in the
LEDs, insert the IC if you used a socket
and fit the board in the case using the
self-tapping screws and spacers. The
battery holder can be kept in place
with a dab of BLU-TACK® adhesive.
Receiver board
The component layout for the receiver board is shown in Fig.4. Start
by fitting the one link and the resistors.
Next, fit the ICs, using a socket for IC4
if you prefer. Make sure that all the
ICs are correctly oriented. This done,
solder in the MKT capaci
tors, the
transistors, electrolytic capacitors and
finally the crystal. Don’t mount PD1 or
the acknowledge LED yet.
RAILPOWER
SLOWER
FASTER
REVERSE
FORWARD
leads so that it protrudes satisfactorily
through the front panel. Locate the sensor centrally behind the rectangular
cutout. Both anodes (longer lead) are
towards the top of the PC board. When
you are satisfied with their positions,
solder them both in place.
Solder the black wire to the centre
pin of REG1 (ground) and the red wire
to the output pin of REG1 (+5V). The
orange wire should be soldered to pin
1 of IC1, the yellow to pin 2 and the
green to pin 3.
Reassemble the unit and after applying power, check that the walkaround
control still operates. If it doesn’t, the
most likely cause is a short between
pins 1, 2 or 3 on IC1.
Testing
INERTIA
STOP
Fig.7: the full-size artwork for the
remote control front panel.
Fit 200mm lengths of hook-up wire
to the board, in the wire colours as
shown in Fig.4, for the signal output
and supply connections. This done,
mount the PC board in the righthand
side of the Railpower case, using two
tapped metal spacers.
Drill two 5mm holes in the front
panel for the photodiode and acknowledge LED. File the hole for the photodiode to a 5 x 7.5mm rectangle, then
replace the panel and bend the LED
Clip the three cells into the holder on
the IR remote control unit, observing
their polarity. They are back-to-front
compared to standard cells, the small
cap being the negative connection.
Point the remote control at the receiver
and press a button. If all is well, the
acknowledge LED on the Railpower
should light and the corresponding
function should be indicated by the
Railpower LED.
If it doesn’t work, the problem is
knowing which unit is not operating correctly, the transmitter or the
receiver.
First, check that the battery voltage
is around 4.5V on the transmitter.
If you have an oscilloscope, hold a
button down and check pin 7 of IC1
to see that the crystal is oscillating at
4MHz. Now check at the anode of one
of the transmitter LEDs.
There should be a pulse train output
whenever a button is pressed. If the
pulses are being sent continuously,
RAILPOWER
Fig.8: this is the full-size front panel artwork for the remote control version of the Railpower Mk.2.
78 Silicon Chip
AC
K
ER
PO
W
ST
OP
FO
RW
AR
D
RE
VE
IN
RS
ER
E
TI
A
OF
F
OV
E
RL
OA
D
CUTOUT
Fig.9: here are the full
size etching patters for
the IR receiver board
(right), transmitter PC
board (bottom right) and
the speed meter PC board
(below). Check the etched
boards carefully before
installing any of the parts.
then one of the pushbuttons has been
inserted incorrectly.
If an oscilloscope is not available,
remove the batteries and connect a
DC power supply set to 4.5V. When a
button is pressed, the current should
be around 9mA. As soon as the button
is released, the current should drop
to about 5mA and after one second
drop to 100µA. If this occurs, you can
assume that the transmitter is working
satisfactorily. If not check the capacitors on the crystal pins.
IR receiver board
On the receiver, check that pin 14
of IC3 is at +5V with respect to pin 7.
If you have an oscilloscope, check pin
7 of the processor to confirm that the
crystal is oscillating at 4MHz. Hold the
transmitter close to the receiver with
a button pressed.
The output at pin 6 of IC1 should
be a negative-going pulse of several
hundred millivolts. It should be positive-going at Q2’s collector and 3-4V
negative-going at Q5’s collector.
The output of IC2a (pin 7) should be
positive-going, while the signal into
pin 9 of IC4 should be a negative-going
5V pulse 33µs wide.
This close-up view shows how the leads of the infrared photodiode (PD1) on the
receiver are bent over, so that the active surface of the device faces the hole in
the front panel.
If you don’t have an oscilloscope,
the best approach is to compare the
DC voltages measured in your receiver
with those shown on the circuit. They
should be within 10% of each other.
If there is a discrepancy, check the
component values around the relevant
stage and also your soldering.
Check also that the A and B rate
links on the transmitter and receiver
match each other. If they don’t, the
SC
remote control won’t work.
January 1996 79
|