Published:2011/7/26 21:19:00 Author:Li xiao na From:SeekIC
Design by J. Wickenhauser
You don’t need special ICs when a capacitive (or ’touch’) switch can also be realized with an inexpensive PIC controller. This article shows how it’s done.
Over the past few years several manufacturers have come up with special integrated circuits for touch control switches. These ICs usually operate on the principle of capacitive change, work perfectly but are hard to obtain as well as relatively expensive. Fortunately, a capacitive switch may also be realized using ’traditional’ means, i.e., a little physics and a microcontroller.
The human body
may act as one plate of a capacitor, with the other plate formed by a coin soldered onto a copper plane. The principle is illustrated in Figure 1. Assuming the coin has a surface area of 3.2 cm2 and is placed at a distance of 4 mm (using an acrylic plastic disc as a spacer) and a dielectric constant of 8, a theoretical capacitance of 8 pF is obtained, or 2-3 pF when the pad is not touched.
A second capacitor (C2) is charged via two resistors. In reality, the three switches are microcontroller port lines with GP1/GP2 representing signal A" and GPO, signal ’B’.
The measurement comprises tire closing of the two switches for 2μs using signal ’B’. The 2μS period allows capacitor CI to almost fully charge via Rl. A very small portion of the charge (the amount is negligible) also flows to ground via R2. Next the two switches are opened and CI is allowed to charge C2. As soon as the voltage on C2 exceeds a certain level (here, about 0.7 V) the measurement is finished. Signal ’B’ disappears and C2 is discharged. This marks the return of the measurement cycle to its start state. The number of iterations it takes to fully charge the second capacitor is counted — it’s as simple as that.
The simultaneous charging and discharging of C2 may appear a bit of a contradiction. However, a small portion of the charge in C2 is also lost, because the switches are open much longer than closed.
The smart button
Ideally, about 20,000 cycles are required to enable C2 to be charged by the user’s finger. Consequently a measurement takes about 50 ms. As soon as the software has recognized a ’key press’ action on GP3, output GP4 is pulled Low, causing the indicator LED to light up. At the same time, the number of cycles for each measurement is output via pin GP5. An oscilloscope or a pulse counter connected to GP5 will clearly indicate the approach of the finger.
As you can see from the circuit diagram in Figure 2, the microcontroller used is a cheap and easy to obtain type PIC12C508 which has 512 bytes of memory. If you happen to have a ’509 lying around (with 1024 bytes) it can be used also. The R-C oscillator inside the PIC operates at about 4 MHz.
The printed circuit board shown Figure 3 is single-sided. Normally the copper plane on the board is sufficient for reliable operation. In cases where higher sensitivity is required, the surface area may be increased.
The circuit is capable of adaptive operation. This means that the trigger point is shifted (within limits) to compensate for effects like dirt on the touch pad. Only relatively fast capacitive changes are recognized as valid actions. Also, the fact that the measurement is completely done in software can be exploited by making clever use of the energy reduction features offered by a PIC. Because a measurement takes only 50 ms and it is sufficient to do measurement every 500 ms, the controller could be ’asleep’ most of the time. The upshot is that the average current consumption of the circuit can be reduced to 0.1-0.2 mA without problems.
The circuit is made relatively immune to constant external RF signals by the software varying the speed of signal A’ to some extent.
Reprinted Url Of This Article: http://www.seekic.com/blog/project_solutions/2011/07/26/Touch_controlled_switch__With_a_PIC.html
Print this Page | Comments | Reading(1834)
Author:Ecco Reading(32821)
Author:Ecco Reading(3526)
Author:Ecco Reading(3246)
Author:Ecco Reading(3801)
Author:Ecco Reading(5331)
Author:Ecco Reading(3315)
Author:Ecco Reading(3462)
Author:Ecco Reading(3604)
Author:Ecco Reading(4009)
Author:Ecco Reading(3807)
Author:Ecco Reading(3748)
Author:Ecco Reading(3780)
Author:Ecco Reading(6094)
Author:Ecco Reading(3764)
Author:Ecco Reading(4579)