Touch Switch using PIC12F629 Microcontroller
You can add this circuit to all sorts of projects that require on-off control.
Our design allows up to 4 touch sensors using a PIC12F629. The output of each touch sensor is active LOW and this can be connected to an additional circuit to control a LED, motor or relay etc.
The photo of the project shows one output with the two LEDs connected in series to produce an infinitely high input impedance so that one of the input/output lines of the micro can be used as both input and output. Two LEDs drive the base of a transistor and a third LED is connected to the collector of the transistor to indicate it is being activated.
The input lines to a PIC microcontroller contain FETs and a FET has an almost infinite input impedance (resistance). This mean it is very sensitive and will detect voltages that are called STATIC ELECTRICITY.
These voltages (Static Electricity and radiation from power cables and wiring) are all around the home and are produced by a number of things including the electromagnetic radiation from the 110v or 240v mains wiring, the radiation from a TV that uses a picture-tube (Cathode Ray Tube) by the electrons being fired by the gun towards the screen, the static produced when walking on carpet or produced by clothing hen it is moved on the body and the movement of paper and plastic items.
You will be amazed at where static electricity can be found and the input to the microcontroller we are using in this project will detect these charges, simply by connecting a wire to one of the input pins.
In fact the micro is so sensitive it will react uncontrollably when moved around the home.
The whole essence of this project has been to remove the uncontrollability-factor and create a touch wire that will only respond when it is touched.
This is a very difficult thing to do as we are using the very sensitive input of a pin to detect the charge (or lack of charge) produced by a finger and at the same time masking the charge from the surroundings.
The answer is to charge a small capacitor and see if the finger discharges it. This means the input will not be responsive to any static charges in the room.
For this to work, we are assuming the body is uncharged and some-times clothing etc will create a charged condition and the touch sensor will not work.
That’s why this project will not work in all situations and with all users.
However when it does work, it is amazing.
The slightest touch of the wire with a finger will turn on the LEDs.
You can build 1, 2, 3 or 4 sensors and use them with touch pads to control all types of devices.
One of the clever features of this circuit is the use of a single input/output line as both an input and output.
This is called multiplexing or “sharing.”
The line is firstly set up as an output and the 100p capacitor is charged. It is then turned into an input line and a 20mS delay is called to give a short period of time for a finger to discharge the capacitor.
The charge on the capacitor is then detected after this time and if it is low, the line is turned into an output to activate the base of the transistor via two LEDs.
These LEDs have been included to produce an infinitely high impedance on the line so that the charge on the 100p capacitor will not be affected.
The two LEDs and base-emitter junction of the transistor will produce an infinite impedance to voltages below the turn-on voltage of the combination.
Another clever circuit-design is placing a diode between the “ground” or Vss line of the micro and the 0v rail.
This reduces the 6v supply to 5.4v (as this is the maximum voltage the chip can be delivered). But more importantly it increases the sensitivity of the input line and makes the project much more sensitive by actually raising the zero-detection-point by about 0.5v.
For more detail: Touch Switch using PIC12F629 Microcontroller
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
Current Project / Post can also be found using:
- capacitive touch switch using pic