![Elektor EPROM Скачать руководство пользователя страница 48](http://html1.mh-extra.com/html/elektor/eprom/eprom_manual_2386336048.webp)
if none of the keys are pressed. This time-out
is necessary because you may not always be
aware that a reset to the microcontroller has
occurred. The torch may, for example undergo
a mechanical shock sufficient to momentarily
disconnect the battery and generate a reset.
Pressing and releasing either push-button
will return the torch to normal operation at
brightness level 2.
Making a good case
Li-Ion cells are not the same size as standard
AA cells so it is not a simple matter just to
cannibalise a standard torch case.
Machine drawings are available for this
project (
Figure 5
), detailing the construction
of a suitable casing for the torch. Those of you
who do not have a lathe or milling machine
lying around at home may wish to take the
drawings along to a local machine shop for a
quotation. The drawings are produced in
Micrographx format and can be downloaded
from this month’s Free Downloads at the
Elektor Electronics
website. Note that the
PCB slides into tapered slots in the head of
the torch, this ensures that the PCB and the
splashproof pushbutton covers (boots) are
securely held in place.
Solder two copper battery contacts to the
PCB and fit a suitable spring in the base of
the torch to ensure that the Li-Ion cell makes
a good connection with the contacts.
(012019-1)
wire. Each winding layer should be
separated by two turns of 0.1 mm
thick tape. This will reduce the
capacitance of the finished coil and
also provide a smooth surface for the
next layer of windings. The EPCOS
core has an A
l
value of 250 so to pro-
duce an inductance of 233 mH
requires 30.5 turns:
L = 30.5
2
x 250 nH = 233 mH
To be on the safe side add an extra
turn (L will increase by 6%). After
completing the coil it can be mea-
sured directly on an inductance
meter or tested in-circuit as
described under the next heading. If
you are planning to fit a magnet to
the torch casing to enable it to clamp
on to metallic surfaces make sure
that the magnet is sited at least 2 cm
away from the coil otherwise it will
reduce its inductance by about 10%.
Let there be light
The PCB layout is shown in
Figure 3.
Divide the PCB into its two parts
and solder all the surface-mount
components and LEDs onto the
boards. The coil is the only ‘conven-
tionally’ packaged component and
should be soldered to the component
side of the PCB. The two PCBs are
then soldered together at right
angles so that the pads serve both to
secure the PCBs and carry power to
the LEDs.
To test the circuit it is best to use
a variable Power Supply Unit (PSU)
with a current indicator (alterna-
tively a low impedance ammeter in
series with the supply lead will suf-
fice). It is important to note that the
microcontroller technical data sheet
specifies a minimum ramp-up time
for the supply voltage. If the supply
voltage rises too slowly the internal
reset does not function correctly and
this can cause the FETs to conduct
too heavily. This is not a problem
when the circuit is battery powered
but from an external PSU make sure
you adjust the supply voltage (above
2.8 V) before switching the output to
the circuit. Before powering-up for
the first time set the PSU current
limit to 0.4 A and add a 10
Ω
resistor
in series with the supply.
At power-up (providing no but-
tons are pressed) the PIC will begin
the first of two test routines. These
routines are invoked only when the
battery is fitted. They will check that
the clock frequency is 4 MHz (corre-
sponding to a machine cycle of 1
µ
s),
test the inductor and check the A/D
converter.
During the first test routine the
lamp will flash on and off with a
period of 200 ms and a 50:50 duty
cycle. If the ON time of the light is
much greater than the OFF time
(more than about 20%) then this indi-
cates that the value of L1 is too high
and it will be necessary to remove
one or two turns from the winding.
The lamp will go out after 1,000 peri-
ods (200 s) providing none of the
buttons are pressed first. During ON
times the lamp brightness is set by
a T
ON
time of 15
µ
s and a
(T
ON
+T
OFF
) time of 100
µ
s. Current
consumption should correspond to
the lower line of the graph in
Fig-
ure 4
.
When everything is in order,
briefly press one of the pushbuttons
this will turn off the lamp and start
the second test routine. In this rou-
tine the lamp is lit continuously at
increasing power levels. Doubling
the T
ON
time increases the power
four times. The current consumption
of the circuit should correspond with
the upper line in Figure 4.
The torch will switch off after 50 s
GENERAL
INTEREST
63
11/2002
Elektor Electronics
Содержание EPROM
Страница 1: ......