beautypg.com

Project b13 capacitor discharge – Elenco XP&trade User Manual

Page 47

background image

Project B13

Capacitor Discharge

Build the circuit as shown. Turn on the slide switch (S1).
Load program Basic Light Meter into the microcontroller
(U21) using the programming instructions in project B1,
unless you already loaded it in the preceding project.

Press the F8 key or select Terminal under the PICAXE
menu to open a terminal window for communication with
the microcontroller, set the baud rate to 4800, and select
Refresh. Turn the slide switch (S1) off and on to reset
the microcontroller.

Push the press switch (S2) to charge the 470

μ

F

capacitor (C5). The microcontroller measures the
voltage at the capacitor, then displays it as a number in
the Terminal. When the capacitor is fully charged then
255 will be displayed, when it is fully discharged then 0
will be displayed. You can study how quickly the
capacitor discharges.

Change the capacitor discharge rate by replacing the
10k

Ω

resistor with any of the other resistors (including

the photoresistor). You can also swap the positions of
the press switch and resistor.

Optional:

-46-

If you remove the resistor
completely from the circuit, the
capacitor will still discharge but
very slowly. This is due to the
resistance of the microcontroller
input, which is very high.