e021050.pdf

(940 KB) Pobierz
GENERAL INTEREST
Lighting and
Gearbox Control
for remote-control model lorries
Design by D. Dzida
The circuit described here uses a PIC microcontroller to take over the
complete control of the lighting and gearbox in a model lorry. It can also
be used with a fork-lift truck, excavator or similar type of vehicle.
50
Elektor Electronics
1/2002
855733428.407.png
GENERAL INTEREST
The problem with these kinds of remotely
controlled vehicles is that they have a large
number of functions, which normally means
that an expensive remote-control unit must
be used. The project presented here consists
of a small printed circuit board, featuring a
microcontroller from the popular Microchip
PIC family, which looks after the extended
functions. This involves a combination of
automatic function control and the decoding of
supplementary functions.
Technical data
Supply voltage:
5V (from receiver)
Current consumption:
less than 10 mA
(excluding lamp currents)
External supply voltage:
5–12V
Blinking rate:
fixed, approx. 0.5 Hz
Gearbox servo travel:
adjustable using a trimpot
Trailer coupling servo direction of rotation:
selectable (left/right) using JP1
Maximum current per output:
0.3 A
Keyed output for control only (max. 10 mA)
Relays may be connected (only with flyback diodes!)
The automatic functions are:
– turn indicators are automatically activated
when the vehicle is turned;
– the brake lights go on when the accelerator
is released;
Note regarding the maximum lamp current:
If the lamps are powered from the internal supply voltage (see Figure 5) using the
receiver–speed controller BEC, the maximum output current of the speed con-
troller BEC must not be exceeded!
+5V
+5V
+5V
K1
R10
100
D 6
D 5
D 4
D3
D 9
D 8
SERVO
K12
DRIVE
R1
R2
R3
R4
R5
R6
K2
R11
(RECVR)
GEAR
+5V
T1
R23
1k2
R24
1k2
R25
1k2
R26
1k2
R27
1k2
R28
1k2
K3
R12
100
T2
C3
SERVO
TRAILER
COUPLING
T3
100n
R22
K4
2
T4
(RECVR)
R13
25
24
23
22
21
20
19
18
TRAILER
COUPLING
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
T5
28
MCLR
T6
K5
K13
IC2
(RECVR)
R14
13
MDX
HEADLIGHTS
0
1
2
3
4
5
6
7
14
IC1
11
10
6
7
6x
BC817
+5V
0
1
2
RA0
RA1
RA2
RA3
15
K6
0
7
8x
12
(RECVR)
9
8
R15
1
17
16
15
14
KEY /
SWITCH
CHANNEL
RB7
9
5
D7
D 1
D 2
4051
RB6
3
PIC16C57
2
RB5
6
K7
G8
4
RB4
R7
R8
R9
13
12
11
10
(RECVR)
+5V
R16
RB3
HAZARD
FLASHER
RB2
1
TOCKI
RB1
R19
K8
RB0
T7
R29
1k2
R30
1k2
R31
1k2
OSC1
OSC2
SERVO
R21
R20
27
26
4
T8
CONTROL
X1
JP1
T9
K9
(RECVR)
C2
C1
TURN
INDICATOR
R17
P1
22p
22p
16MHz
L / R
K14
10k
STEERING
R32
100
R33
100
3x
BC817
K10
MT
D1 0
C5
TO
MOTOR
CONTROL
+5V
R34
R35
100n
OUT
K11
16
C4
(RECVR)
THROTTLE /
BRAKE
MOTOR
CONTROL
IC1
D11
D12
R18
10 µ
16V
8
010204 - 11
Figure 1. Schematic diagram of the lighting and gearbox controller. The microcontroller evaluates the pulse signals from the remote
control receiver and generates the additional control signals for the lights and gearbox.
1/2002
Elektor Electronics
51
855733428.418.png 855733428.429.png 855733428.440.png 855733428.001.png 855733428.012.png 855733428.023.png 855733428.034.png 855733428.045.png 855733428.055.png 855733428.066.png 855733428.077.png 855733428.088.png 855733428.099.png 855733428.110.png 855733428.121.png 855733428.132.png 855733428.143.png 855733428.154.png 855733428.165.png 855733428.176.png 855733428.187.png 855733428.198.png 855733428.209.png 855733428.220.png 855733428.231.png 855733428.242.png 855733428.253.png 855733428.264.png 855733428.275.png 855733428.286.png 855733428.297.png 855733428.308.png 855733428.319.png 855733428.330.png 855733428.341.png 855733428.352.png 855733428.363.png 855733428.374.png 855733428.385.png 855733428.393.png 855733428.394.png 855733428.395.png 855733428.396.png 855733428.397.png 855733428.398.png 855733428.399.png 855733428.400.png 855733428.401.png 855733428.402.png 855733428.403.png 855733428.404.png 855733428.405.png 855733428.406.png 855733428.408.png 855733428.409.png 855733428.410.png 855733428.411.png 855733428.412.png 855733428.413.png 855733428.414.png 855733428.415.png 855733428.416.png 855733428.417.png 855733428.419.png 855733428.420.png 855733428.421.png 855733428.422.png 855733428.423.png 855733428.424.png 855733428.425.png 855733428.426.png 855733428.427.png 855733428.428.png 855733428.430.png 855733428.431.png 855733428.432.png 855733428.433.png 855733428.434.png 855733428.435.png 855733428.436.png 855733428.437.png 855733428.438.png 855733428.439.png 855733428.441.png 855733428.442.png 855733428.443.png 855733428.444.png 855733428.445.png 855733428.446.png 855733428.447.png 855733428.448.png 855733428.449.png 855733428.450.png 855733428.002.png 855733428.003.png 855733428.004.png 855733428.005.png 855733428.006.png 855733428.007.png 855733428.008.png 855733428.009.png 855733428.010.png 855733428.011.png 855733428.013.png 855733428.014.png 855733428.015.png 855733428.016.png 855733428.017.png 855733428.018.png 855733428.019.png 855733428.020.png 855733428.021.png 855733428.022.png 855733428.024.png 855733428.025.png 855733428.026.png 855733428.027.png 855733428.028.png 855733428.029.png 855733428.030.png 855733428.031.png 855733428.032.png 855733428.033.png 855733428.035.png 855733428.036.png 855733428.037.png 855733428.038.png 855733428.039.png 855733428.040.png 855733428.041.png 855733428.042.png 855733428.043.png 855733428.044.png 855733428.046.png 855733428.047.png 855733428.048.png 855733428.049.png
 
GENERAL INTEREST
BEC
The acronym ‘BEC’ simply stands for ‘bat-
tery eliminator circuit’. This is a circuit that
eliminates the need for a separate battery to
power the remote control by providing an
adequately processed (stabilised and decou-
pled) supply voltage from the motor battery
pack. In a model lorry, this BEC is built into
the speed controller (the motor controller
for the tractor). Such speed controllers
always include a BEC with a 5-V output volt-
age. In the case of special regulators for lor-
ries, this 5-V output can supply a heavier
load than a normal regulator for cars. The
amount of output current that can be sup-
plied by the regulator depends on the model
and ranges from 1 to 3 ampères.
C5
C1
C4
P1
C2
HOEK1
C3
010204-1
K1
K2
K3
K4
K5
K6
K7
K8
K9
K10
R10
R11
R12
R13
R14
D6
R22
R1
T1
X1
D5
K12
R2
R3
R23
R24
R25
R26
T2
D4
T3
IC1
T4
D3
R4
R5
R6
R7
T5
R15
R16
R17
D9
R27
R28
R29
R30
R31
K13
T6
D8
T7
D7
T8
IC2
D1
D2
R8
R9
R18
T9
K14
JP1
R32
D10
R33
HOEK3
D11
R34
R35
D12
K11
– the back-up lights go on when the vehicle
moves in reverse.
Supplementary switches on the remote con-
trol unit can be used to switch on the dipped
beams, main beams, hazard flasher, flashing
lights on the driver’s cab, horn and additional
output channels.
Figure 2. Printed circuit board track layout and component layouts for the copper
and component sides of the single-sided circuit board.
Lamp current
The current consumption of the circuit with
no lamps connected is less than 10 mA. Each
of the nine outputs connected to the transis-
tors can switch a maximum of 300 mA,
which altogether yields (9
Furthermore, the gearbox servo
can be sequentially shifted up or
down using a switch or the control
stick (just like a real Porsche, but
with only three gears…).
Finally, there is a trailer function,
0.3 A) = 2.7 A!
This amount of current can only be provided
by an external power source (wired as
shown in Figure 6).
If the internal 5-V supply voltage is used
(wired as shown in Figure 5), the 5-V output
of the vehicle’s speed controller must supply
not only the current for the remote control
receiver and the servos, but also the total
lamp current. Consequently, if there are
many lamps, a speed controller that can pro-
vide 1.5 A or more should be used. The fol-
lowing is a suggestion for the lamp selection
(5 V / 40 mA lamps):
×
dipped beams:
6 ×
40 mA
=
240 mA
main beams:
2
×
80 mA
=
160 mA
brake lights:
4 ×
40 mA
=
160 mA
back-up lights:
2
×
40 mA
=
80 mA
blinkers:
6 ×
40 mA
=
240 mA
hazard flashers:
2
×
40 mA
=
80 mA
switched channel:
1 ×
80 mA
=
80 mA
—————————————————–—————–
Total lamp current:
1.04 A
Figure 3. Top view of the prototype circuit board.
52
Elektor Electronics
1/2002
855733428.050.png 855733428.051.png 855733428.052.png 855733428.053.png 855733428.054.png 855733428.056.png 855733428.057.png 855733428.058.png 855733428.059.png 855733428.060.png 855733428.061.png 855733428.062.png 855733428.063.png 855733428.064.png 855733428.065.png 855733428.067.png 855733428.068.png 855733428.069.png 855733428.070.png 855733428.071.png 855733428.072.png 855733428.073.png 855733428.074.png 855733428.075.png 855733428.076.png 855733428.078.png 855733428.079.png 855733428.080.png 855733428.081.png 855733428.082.png 855733428.083.png 855733428.084.png 855733428.085.png 855733428.086.png 855733428.087.png 855733428.089.png 855733428.090.png 855733428.091.png 855733428.092.png 855733428.093.png 855733428.094.png 855733428.095.png 855733428.096.png 855733428.097.png 855733428.098.png 855733428.100.png 855733428.101.png 855733428.102.png 855733428.103.png 855733428.104.png 855733428.105.png 855733428.106.png 855733428.107.png 855733428.108.png 855733428.109.png 855733428.111.png 855733428.112.png 855733428.113.png 855733428.114.png 855733428.115.png 855733428.116.png 855733428.117.png 855733428.118.png 855733428.119.png 855733428.120.png 855733428.122.png 855733428.123.png 855733428.124.png 855733428.125.png 855733428.126.png 855733428.127.png 855733428.128.png 855733428.129.png 855733428.130.png 855733428.131.png 855733428.133.png 855733428.134.png 855733428.135.png 855733428.136.png 855733428.137.png 855733428.138.png 855733428.139.png 855733428.140.png 855733428.141.png 855733428.142.png 855733428.144.png 855733428.145.png 855733428.146.png 855733428.147.png 855733428.148.png 855733428.149.png 855733428.150.png 855733428.151.png 855733428.152.png 855733428.153.png 855733428.155.png 855733428.156.png 855733428.157.png 855733428.158.png 855733428.159.png 855733428.160.png 855733428.161.png 855733428.162.png 855733428.163.png 855733428.164.png 855733428.166.png 855733428.167.png 855733428.168.png 855733428.169.png 855733428.170.png 855733428.171.png 855733428.172.png 855733428.173.png 855733428.174.png 855733428.175.png 855733428.177.png 855733428.178.png 855733428.179.png 855733428.180.png 855733428.181.png 855733428.182.png 855733428.183.png 855733428.184.png 855733428.185.png 855733428.186.png 855733428.188.png 855733428.189.png 855733428.190.png 855733428.191.png 855733428.192.png 855733428.193.png 855733428.194.png 855733428.195.png 855733428.196.png 855733428.197.png 855733428.199.png 855733428.200.png 855733428.201.png 855733428.202.png 855733428.203.png 855733428.204.png 855733428.205.png 855733428.206.png 855733428.207.png 855733428.208.png 855733428.210.png 855733428.211.png 855733428.212.png 855733428.213.png 855733428.214.png 855733428.215.png 855733428.216.png 855733428.217.png 855733428.218.png 855733428.219.png 855733428.221.png 855733428.222.png 855733428.223.png 855733428.224.png 855733428.225.png 855733428.226.png 855733428.227.png 855733428.228.png 855733428.229.png 855733428.230.png 855733428.232.png 855733428.233.png 855733428.234.png 855733428.235.png 855733428.236.png 855733428.237.png 855733428.238.png 855733428.239.png 855733428.240.png 855733428.241.png 855733428.243.png 855733428.244.png 855733428.245.png 855733428.246.png 855733428.247.png 855733428.248.png 855733428.249.png 855733428.250.png 855733428.251.png 855733428.252.png 855733428.254.png 855733428.255.png 855733428.256.png 855733428.257.png 855733428.258.png 855733428.259.png 855733428.260.png 855733428.261.png 855733428.262.png 855733428.263.png 855733428.265.png 855733428.266.png 855733428.267.png 855733428.268.png 855733428.269.png 855733428.270.png 855733428.271.png 855733428.272.png 855733428.273.png 855733428.274.png 855733428.276.png 855733428.277.png 855733428.278.png 855733428.279.png 855733428.280.png 855733428.281.png 855733428.282.png 855733428.283.png 855733428.284.png 855733428.285.png 855733428.287.png 855733428.288.png 855733428.289.png 855733428.290.png 855733428.291.png 855733428.292.png 855733428.293.png 855733428.294.png 855733428.295.png 855733428.296.png 855733428.298.png 855733428.299.png 855733428.300.png 855733428.301.png 855733428.302.png 855733428.303.png 855733428.304.png 855733428.305.png 855733428.306.png 855733428.307.png 855733428.309.png 855733428.310.png 855733428.311.png 855733428.312.png 855733428.313.png 855733428.314.png 855733428.315.png 855733428.316.png 855733428.317.png 855733428.318.png 855733428.320.png 855733428.321.png 855733428.322.png 855733428.323.png 855733428.324.png 855733428.325.png 855733428.326.png 855733428.327.png 855733428.328.png 855733428.329.png 855733428.331.png 855733428.332.png 855733428.333.png 855733428.334.png 855733428.335.png 855733428.336.png 855733428.337.png 855733428.338.png 855733428.339.png 855733428.340.png 855733428.342.png 855733428.343.png 855733428.344.png 855733428.345.png 855733428.346.png 855733428.347.png 855733428.348.png 855733428.349.png 855733428.350.png 855733428.351.png 855733428.353.png
GENERAL INTEREST
K5, K6, K7, K9 and K11, respectively. From
there, they reach inputs X0–X6 of the multi-
plexer (IC1), and from the multiplexer they
arrive at port pins RA0–RA3 of the PIC micro-
controller (IC2). The 4051 CMOS multiplexer
could in principle be omitted, but then a
larger and more expensive PIC would be
needed.
The signals for the functions that are
directly controlled by the remote controller
(motor and steering) are not only passed on
to the microcontroller, but are also looped
directly through to output pin headers for
connection to the steering servo (K8) and the
motor speed controller (K10).
Port pin RB0 of the microcontroller is con-
nected to jumper JP1. This jumper selects the
direction of rotation of the servo for the trailer
coupling. The amount of travel of the gear
servo can be set using trimpot P1, which is
connected to port pin RB1.
By programmed processing of the various
input signals, the microcontroller generates
control signals for two servo outputs (K1:
gearbox servo and K3: trailer coupling servo)
and eleven switched outputs that are avail-
able on pin headers K12, K13 and K14. Nine
switched outputs are implemented as open-
collector outputs using external transistors
(T1–T9), while two output pins (of K14) are
directly connected to port pins RC3 and RC4.
Table 1 presents a summary of the connec-
tors with their designations and functions. If
you are interested in the software that
processes the signals in the PIC microcon-
troller, you can download it from the Free
Downloads page on the Elektor Electronics
website.
Each of the switched outputs is provided
with a LED that indicates the output state
(D1–D9 and D11). LED D10 has a special
function. After the supply voltage is
switched on, some of the signals from the
microcontroller are first calibrated (such as
the signals for the turn indicators, brake
lights and back-up lights). The control stick
must not be moved while this is happening.
LED D10 is illuminated only after the initial-
isation has been successfully completed
(which can take up to four seconds) in order
to indicate that the circuit is ready to be
used. LED D12 is connected to a switched
channel that is not currently used (K14/3)
and thus does not presently have any func-
tion. However, the author intends to use this
output to support an infrared link between
the tractor and the trailer.
COMPONENTS LIST
D10 = LED, 3mm, green, high
efficiency (low current)
T1-T9 = BC817
IC1 = 4051 SMD
IC2 = PIC16C57, programmed,
order code 010204-41
Resistors:
R1-R9,R20,R34,R35 = 2k
2
R10,R12,R21,R32,R33 = 100
R11,R13-R19,R22 = 10k
R23-R31 = 1k 2
P1 = 10-turn preset, horizontal
mounting
Miscellaneous:
JP1 = 2-way pinheader with jumper
K2,K4-K7,K9,K11 = servo connection
cable
K1,K3,K8,K10 = 3-way pinheader
K12,K13,K14 = 5-way pinheader
X1 = 16MHz quartz crystal
PCB, order code 010204-1
Disk, project source code files, order
code 010204-11
Capacitors:
C1,C2 = 22pF
C3,C5 = 100nF
C4 = 10 µ F 16V radial
Semiconductors:
D1-D9,D11,D12 = LED, 3mm, red,
high efficiency (low current)
in which a single servo operates the
coupling to the tractor and the asso-
ciated support legs on the trailer.
This double function is specially
designed to be used with a Tamiya
lorry trailer kit. If only the trailer cou-
pling is needed, this function can
naturally also be used with other
model lorries.
updates or extensions. The circuit,
which is shown in schematic form in
Figure 1, assumes the use of a bat-
tery eliminator circuit (BEC) provid-
ing a regulated supply voltage of 5 V.
The microcontroller evaluates the
signals from seven output channels
of the remote-control receiver. At
each of these outputs, the receiver
provides the well-known pulse-
width modulated signal whose pulse
width ranges from 1 to 2 ms (1.5 ms ±
0.5 ms). These signals, which control
the gearbox, dipped/high beam,
switched channel, hazard flasher,
steering and motor (‘gas’) functions,
are connected to pin headers K2, K4,
Circuit operation
The heart of the controller is a
Microchip PIC16C57 clocked at
16 MHz. The version in the DIL28
package is used, since this makes it
easier to carry out possible software
Construction and use
Fitting the components to the printed circuit
board (Figure 2) requires some special atten-
Figure 4. The SMD components are fitted on the bottom side of the circuit board.
1/2002
Elektor Electronics
53
855733428.354.png 855733428.355.png 855733428.356.png 855733428.357.png 855733428.358.png 855733428.359.png
GENERAL INTEREST
Table 1. Summary of connections
and functions
K12'
La1
La2
La3
Gearbox: K1 & K2
K1: Gearbox servo connection (only for a 3-speed gearbox)
K2:
La4
Connection for the cable from the receiver ‘gearbox’ output.
Function on the remote control unit: rocker switch with three positions:
up / off / down
La5
K13'
La6
Function:
The amount of servo travel to the left or right of the middle position can be set
using P1. Any change in the setting of P1 becomes effective only after the power
is next switched on. When the power is switched on, the servo always moves to
the middle position (second gear).
La7
La8
K14'
La9
• rocker switch ‘up’ once
servo moves forward
one position (e.g. from second gear to third
gear).
• rocker switch ‘down’ once servo moves
backward one position (e.g. from second gear to
first gear).
1 st gear
3 rd gear
010204 - 12
2 nd gear
010204 - 14
Figure 5. Lamp connections when using the
internal supply voltage.
Trailer coupling: K3 & K4
K3: Connection for the trailer coupling servo (for a Tamiya lorry with electrically
operated support legs – see text)
K12'
K4:
Connection for the cable from the receiver ‘trailer coupling’ output.
Function on the remote control unit: rocker switch with three positions:
up / off / down
La1
La2
Function:
• rocker switch ‘up’ servo moves to position 1 (in this position, the support
legs are lowered until a limit switch on the trailer is tripped).
• rocker switch ‘off’
La3
La4
servo moves to position 3 (if the back-up light is not on,
the coupling cannot be opened!).
• rocker switch moved to ‘down’ AND back-up lights ON servo moves to
position 2 (in this position, the support legs are lowered until a limit switch on
the trailer is tripped).
After the rocker switch has been released (it
returns automatically to the middle position),
the servo moves to position 4. The trailer
coupling is now open and the tractor can sep-
arate from the trailer. The trailer coupling
remains open until the switch is again moved
to the ‘up’ position (to raise the support legs
and close the trailer coupling).
La5
K13'
La6
BT1
La7
La8
K14'
La9
Pos 4
Pos 1
Pos 2
Pos 3
010204 - 15
010204 - 13
Dipped beam / main beam: K5
K5: Connection for the cable from the receiver ‘dipped beam / main beam’ output.
Function on the remote control unit: toggle switch with three positions:
up / off / down
Figure 6. Lamp connections when using an
external voltage source (5–12 V).
Function:
• toggle switch set to ‘up’ all lights out (K12/3&4)
•toggle switch ‘off’
tion. Although the circuit board is single-
sided, components are mounted on both
sides. IC1 (a 4051 in an SMD package) is sol-
dered to the copper side. Particular care is
necessary in fitting transistors T1–T9, which
are also mounted on the copper side. For fit-
ting the components on the component side,
it is best to start with the wire bridges.
Attentive readers will probably notice that
dipped beam on (K12/3)
• toggle switch ‘down’
dipped beam and main beam on (K12/3&4)
Switched / keyed channel: K6
K6:
Connection for the cable from the receiver ‘ switched/keyed channel ’ output.
Function on the remote control unit: rocker switch with three positions:
up / off / down
54
Elektor Electronics
1/2002
855733428.360.png 855733428.361.png 855733428.362.png 855733428.364.png 855733428.365.png 855733428.366.png 855733428.367.png 855733428.368.png 855733428.369.png 855733428.370.png 855733428.371.png 855733428.372.png 855733428.373.png 855733428.375.png 855733428.376.png 855733428.377.png 855733428.378.png 855733428.379.png 855733428.380.png 855733428.381.png 855733428.382.png 855733428.383.png 855733428.384.png 855733428.386.png 855733428.387.png 855733428.388.png 855733428.389.png 855733428.390.png 855733428.391.png 855733428.392.png
 
Zgłoś jeśli naruszono regulamin