Electronic – arduino – How to detect impending user touch before it happens

arduinocapactiveesp32proximity-sensorsensor

I would like to detect an impending human touch on my microcontroller (I use an ESP32) – before it happens and setoff some kind of beeper (nasty humans, yees… touching electronics when you know you shouldn't). TL;TR: How can I reliably detect the presence of a finger within 0-3cm of my device?

Conditions

  1. it should allow for omnidirectional sensing of 'hand' distance (<3cm would be sufficient)
  2. the device size should ideally remain as small as possible (e.g. size of arduino nano)
  3. should be implementable/interface-able with an arduino-like microcontroller and provide a readout of the range

Here are the methods I could come up with to go about solving this problem practically with some pro's and con's (mostly the latter):

  • sound based: Several ultrasonic sensors (e.g. the hc-sr04) mounted. This would probably have some 'holes' in detection even if one sensor per cardinal direction is mounted. Sensors also tend to be somewhat large.
  • electromagnetic frequency/light based (sorted by typical wavelength band):
    • laser-based: not omnidirectional.
    • IR based: might be affected by daylight
    • far IR based: common sensors don't seem to be optimally suited for short distances, and usually they are quite large (this may also be just due to the Freznel lens, but this would allow omnidirectional sensing to my understanding)
    • microwave or 'radar' based: might be optimal, but common, affordable sensors seem to have issues for
      omnidirectional sensing (e.g. RCWL-0516). Also seem to have issues with short range detection.
  • capacitive: seems to work well for certain kinds of applications (like the musical instrument theremin). Apparently needs to be calibrated a lot though (imagine chip lying on a metal surface, or you taking your shoes off – apparently this varies signal strength greatly and could lead to false positives – i.e. chip beeping for no reason) – and apparently requires an antenna.

Questions:

  1. Are there any known methods that I have not discovered (see list above, that I will update), or any ideas that my imagination and googling skills seemed to have lacked to come up with?
  2. Is there any recommended method, from an theoretical engineering principle side (and feasibility/practicality side) to do this? I.e. would you recommend any method listed above for this problem?
  3. currently, I would tend towards a capacitive sensor for this approach – however I seem to be lacking some kind of integrated circuit (IC) that would allow me to do this easily. This, old article a bit more, but it's unclear how much calibration is needed and how well this would work. Then another question remains, can this be optimized using the ESP32 (or any other) touch sensors?

Best Answer

For capacitive sensor check PIC12F1822/23 from Microchip. You can also try an accelerometer as sensor. I created some device, connecting analog accelerometer module to ADC input MC and it senses even light touch. Also you can try some barometric sensor or electret microphone. It will sense pressure change from air move. Active sensors, like ultrasound and laser may not fit your application because they have dead zone. Infrared sensor like AD8833 can be useful too, but it needs processing image.