A capacitive touch pad is something quite simple. If you google it, probably will easily find a bunch of material explaining how it works.
Today there are some dedicated ICs as well as hundreds of microcontrollers that have some IOs with capacitive touch input option, but at the time when I came up with this simple solution such devices weren't that cheap and easy to find.
Even considering today's devices, I believe this circuit still super valid! Is an awesome call for those hardcore fellows that want to see the raw sensor input (like me) and the simplicity along with sensitivity is great if you have some applications as tick glass, door, table, etc.
I already added some multiplexers to read multiple buttons in a touch keyboard and the performance was outstanding. Maybe if I escalate this multiplexing version would be possible to create a gesture sensor, but let's keep this for another project...
I like to put the more juicy part of the project description at the beginning hahaha, in this case I made a simple video showing the sensor signal
In this sample you can see a significant difference in the signal, the positive width goes from 2.5ms to 2.8ms (300us is quite easy to measure).
This test was made using a wood bench with ~3.5cm thicknesses .
Of course, this type of device is very sensitive to the environment and the firmware should consider the proportional variance to figure out when somebody is "pressing".
Some other considerations:
I recommend you to look the schematics to understand this considerations.
- This example uses the counter's Q8 (equivalent to solder R10 jumper);
- C1 was left empty. Adding a parallel capacitor decrease the sensitivity but increase the stability;
- The connector J1-2 is the actual pad input, J1-1 is the ground connection, and it can be used to add a shield or use a parallel capacitor as sensor element.
- Adding a shield might decrease the sensitivity, it may be a good idea to put some material to add a gap between the sensor and the shield, otherwise the shield-pad capacitance could ruin the signal.
- Frequency is different for different materials, different if you add a parallel capacitance, different if you add a shield and so on. That's why I added jumpers on each counter's Q, you can solder the one is better for your application.
- If you want to detect a finger instead of a hand and/or use a smaller pad you can achieve it increasing the sensitivity by using another output. With great power comes great responsibility and shielding might be needed as well.
I made a video showing this experiment. Watch it, but take in consideration the list above (because I forgot to say 50% of what I wanted to say).
I like to start all my circuits from some features list but in this case the single and main feature is to create a sensitive capacitor touch pad. To achieve that I'll bring a modular and easy to implement solution, designed based on the following blocks diagram:
The principle here is using the finger or hand capacitance as the charging/discharging cap of an RC oscillator. As this capacitance is quite small, the oscillation frequency will be high and you'll need a faster and more expansive microcontroller to read it, especially if you want to increase the sensitivity. A tricky solution for this matter is just a simple frequency divider.
As all electronics circuits, now there are infinite possibilities. I used many options in different circuits but for this specific post my solution is bellow:
- R1, R2, R21, D1, D2, D3 are for protection;
- R18 and R19 is for protection during programming;
- X1 is not necessary (I added just because wasn't sure about time measurement using internal clock, maybe in more adverse conditions it would became necessary);
- C1 is for stability only, but can be left open for testing and when trying more sensitive responses.
- J1 has 2 pins, one is for the pad and the other one is for shield or in case of a parallel sensor application (as one if the pictures in the gallery), to read water level (for example).
- All counter outputs have resistors, but the point here is to solder only one of them. In the experiment above I've used Q8, but you might prefer a different one.
- C3 and R4 were a design error, soldering them doesn't make any difference, they are not necessary. R4 can be substitute by a jumper.
This specific PCB wasn't designed by me, but by one of my students and I appreciate that, his name is Mohamed AlSuwaidi. He also soldered this prototype in the pictures bellow. The extra cables are only for programming the ATtyni45. Eagle files are attached.
General design considerations
If you wanna design this circuit but doesn't have those specific components, probably you can assembly it using some old parts you have at home or at some near by electronics store. I'll give you some ideas about other possible solutions and what are the important features for each one of them.
Well, all starts from a rc oscillator circuit, and we have a lot of options for that, I'll introduce three:
Opamp symmetric supply:
Note: R1 and R2 are just to set the High and Low trigger voltages, if you don't know how it works and are lazy to google it, use the magic 10k for everyone. C and R are described bellow.
OpAmp single supply:
Note: R1, R2 and R3 are just to set the High and Low trigger voltages. C and R are described bellow. If you don't know how it works and are lazy to google it, use the magic 10k for everyone .
Now to transform this oscillator into a touch sensor you just change the cap to a pad, simple like this.
OK, now the overall circuit is clear, but let's pick some real parts and add some values.
OpAmp selection: As we need to measure some small cap the most important feature is slew rate. Near home the LM318 was easy to find, it has 50V/us slew rate and was more than enough to have a good result. I did a research on Digikey and found the MIC920, I never used this specific partnumber, but today would be mu choice.
The second important thing is the output. And at this point deppends on your divider. If you use some CMOS up to 15V it wont be a problem, but if don't maybe rail to rail could be an important feature as well.
If you choose some symmetric power supply don't forget to add a schottky rectifier at the output.
NOT selection: Of course schmitt inputs work better, I also used some regular not and it works, but drifts more (for obvious reasons). Beyond that, if you want to have more sensitive response, run for ICs that can handle higher frequencies. I like those single gate ICs because they are small, highly recommend to have them in your inventory, they are so useful.
RC circuit: This is the heart of this circuit. A higher R woudl provide less current to charge the capacitor and increases the sensitivity. In the other hand, as the world isn't a fairy tail, a bigger resistor increase the noise (caused by multiple factors). Regarding C, the touchpad itself is a capacitor, a parallel capacitor can give a more stable response, but personally, in more sensitive applications, I like to keep it open and use the software to "fix the signal". If you wonder to use a thinner material I would definatelly add a 50pF for stability, it reduces variations caused by humidity and temperature and provide a smoother signal to read.
Counter/divider: In this case I've used the best parts selection tool: www.digikey.com Just filer the IC by function, pakage, and frequency and you're good. If you wonder to buy some stuff at some store nearby or use the college inventory I think is better to select TTL circuits rather than CMOS just because usually they are faster. Colleges inventories have the mor standard partnumbers available and I use to find them the wikipedia lists: https://en.wikipedia.org/wiki/List_of_4000-series_integrated_circuits and https://en.wikipedia.org/wiki/7400-series_integrated_circuits
I truly hope somebody will try this circuit , it's very fun and can be used for a bunch of fun applications.