Capacitive Touch Sensors - proximity and reliability

Hi all

My aim is to achieve reliable sensing when the hand approaches a metal light switch. (i.e. before it touches the surface)

I'd be most happy if the sensor worked if any human body parts were put within 30cm, but 2-5cm would do. Getting reliability (repeatability) when increasing the distance can be very tricky and I'm looking for some tips.

I've implemented capacitive touch sensing using the capsense library and a couple of hook up wires. I didn't use foil, but rather a "blank" 0.7mm brushed steel faceplate (this is like a metal lightswitch, but without any buttons). The blanking plate has an earthing connector which comes in handy for securing a wire to the plate.

The capacitiveSensor library page claims "the sensor will start to sense a hand or body inches away from the sensor", that said it's basing that on using a piece of foil which I haven't yet tried. I'm able to get it to work so it senses within mm, but not in the order of 5+cm.

I then tried this touch switch IC from Hobbytronics which requires a large resistor (3Mohm in my case). This works except sometimes when I power my Arduino down then back up again, it simply doesn't work until I remove and re-add a resistor, or dial up or down the resistance with a pot. Sometimes if I set it too sensitively, it works for a while, then randomly one day it might always stay triggered even when I move to the other side of the room...

I hit eBay for solutions, but mostly there are e.g. 12 channel capacitive sensors with pads built-in, and I want to use my own faceplate.

Can you help?

1/ Any tips on the above?

2/ I know resistance is the variable, but how does surface material, thickness, and surface area affect reliability and / or possibility of triggering a switch from a longer range?

but how does surface material, thickness, and surface area affect reliability and / or possibility of triggering a switch from a longer range

Thickness does not matter, surface area does. The bigger the surface area the better is the range.

I want to use my own faceplate.

See this:-

Add wires to attach it to your own face plate. Or get one on a break out board.

Grumpy_Mike:
See this:-
https://www.sparkfun.com/products/9604
Add wires to attach it to your own face plate. Or get one on a break out board.

Hi @Grumpy_Mike, thanks for the pointer.

The MPR121 looks very interesting. It has the ability to internally sum the outputs of each individual electrode by way of an input multiplexer, to enable proximity (as opposed to touch).

Re your comment about attaching wires to my own faceplate, I gather that given the above I'd need to connect all 12 wires to individual electrodes and put them behind the faceplate, rather than connecting them together.

Do you think the above is correct?

If so, any application ideas about how to do that? I was hoping the actual faceplate itself could become the electrode, but that would surely connect them all together, thus rendering the whole point of internal multiplexing a bit pointless.

Any ideas?

to enable proximity (as opposed to touch).

proximity sensors and touch sensors are by and large the same thing.

I gather that given the above I'd need to connect all 12 wires to individual electrodes and put them behind the faceplate, rather than connecting them together.

No, you can use just one, no need to do anything with the other pins.

Grumpy_Mike:
proximity sensors and touch sensors are by and large the same thing.

I was just referring to an application note for the MPR121, which says "Typically a smaller pad size is used for finger touch button detection; while a larger pad size is necessary for contactless near
proximity detection".

This doc says "Like MPR03x, MPR121 has a unique feature that all the electrode inputs can be internally connected together so that all the surface touch sensing area on the inputs are “summed” together to act as a single large electrode pad."

But I'm not particularly clear on whether that means you only need to use one pin therefore.

The application note covers the scenario where you might want to detect "overall" proximity whilst simultaneously detecting touch on each sensor individually... something I don't need to do.

So I'm not really clear on how to do that. Maybe I'm reading the app note wrongly?

But I'm not particularly clear on whether that means you only need to use one pin therefore.

The summing is if you have individual touch sensors that are isolated, you can join them together to make effectively one large pad.
So you only need to use one input if you only have a single plate.

Ok I think I'm going to get a couple of these ICs on breakout boards and give them a whirl.

Thanks for the suggestion.

I have been experimenting with this for awhile now and have used different libraries to incorporate different functionality I need for my application. I have found it challenging to maintain the distance effects after adding a relay. In my application I am using the sensor to trigger a relay to shut down a control switch to a motorized assembly as a safety feature. I have added a running average to smooth out the sensor data, the relay, and have implemented a function to compensate for the motors' effect on the sensor data (it drives the values so low some of my math was failing). My threshold value is calculated as a percentage of the previous value to detect changes that are 15% larger. as well as a reset for the relay. All of this additional functionality has made it more stable in operation but has robbed me of the distance effect. It is frustrating. I think using the running average to set the baseline value and setting the percentage threshold would help with some of your issues.

I think when you turn it on and it does not work properly has to do with the 'field'. When working with the sensitivity of the distance effect anything nearby can throw off your sensor values. The USB cable attached especially to a laptop, static electricity from carpet, how close the electronics are to your body or other conductive things. I triggered mine by setting a drink down near the sensor. Plugging the laptop in seems to help. Unplugging the USB after loading the code and running on a battery can make a difference. What worked for me was to implement the running average, so when powered on it takes 10-1000 values (whatever you set) and averages them. This prevents wild spikes and allows for a tighter threshold value. You might still come back later to find it triggered if you use a static threshold value. For me I set the threshold to be a calculated percentage because I would set the sensor up in one location and get values in the 250 range then set it up on a different table and get values in the 2100 range. Using the percentage makes it agnostic to the value itself and triggers on change. Hope this helps.