ESP Touch - Threshold too close

I’ve set up a couple of Touch sensors however the threshold is too close so turns on/off constantly.

So the idle state is around 5
When pressed it goes to about 4

Is there a way to make this threshold bigger?

Can you describe (or share a photo of) the physical setup of your touch sensors?

1 Like

Hi Tom,
Apologies… Sure.

I’m basically trying to make a “bed contact sensor” (on the cheap :wink: ) - So I’m following something similar to this

I have one side connected to touch, and the other side connected to ground.

Try constructing it like this:

1 Like

I tried that, but then the threshold goes really high and isn’t stable.
For example it may stabilize around 750 but does fluctuate up and down +/- 10.
Thus when trying to set the threshold, nothing is really stable.

I did a nija edit when I realised how you were using it.

This is the exact one I followed… BUT…

-I only have two pads
-Both pads go to one earth
-Both pads have their own threshold (as I’d like “each side”)

I was curious if I could put any resistors or anything similar on the Earth to widen the range a little?

Try increasing the separation between the plates.

1 Like

This has also been done.
I started originally with one plate and the wires connected to each side.
I then changed to two plates, with a wire connected to each and the rear touching each other.

This did increase the threshold, but not by much.

Wait, you have the gnd and touch shorted together?

Don’t do that, just put the gnd plate really close to the sense plate. Like one width of paper away, but not actually touching.

1 Like

Sorry Tom, no.

I have a piece of A4 paper with foil partially covering one side - with the ‘Touch’ cable connected.
Another piece of A4 with the same, but, the Earth connected.
These are then placed ‘back to back’ within the ‘sleeve’ (not touching)

When pressure is applied, the contact is going through 2 A4 pieces of paper.

I’m going to attempt another piece of paper between the plates to see if that increases the threshold.

Hope all of this is making sense!

Have you tried playing around with all the parameters of esp32_touch component? In one of my projects I had similar issue, but increasing the voltage_attenuation made all the difference.

1 Like

Hey, no I haven’t… I wasn’t aware of this.

Could you possibly share your config?

Here’s my repo on GitHub.

esp32_touch:
  setup_mode: false
  iir_filter: 15ms
  low_voltage_reference: 0.5V
  high_voltage_reference: 2.7V
  voltage_attenuation: 1.5V
1 Like

Just added this straight in but not getting anything from the ‘setup mode’ when changed to true

That is…odd. With setup_mode set to true, ESPHome just spams the serial/OTA logs with values from the touch sensor. I’m assuming you also have a binary sensor configured for esp32_touch platform, correct?

Apologies… Appears ESP just “had a moment” - re-flashed and was logging just fine.
I changed the iir_filter to 10ms

The values have now changed from floating around:
6 & 7 at idle and 5 or 6 when touched to
floating around 30 and around 20 when touched.

This solved it - thanks again!