I have a pressure mat that has 4 cables (all black) but I only use 2 of the 4 and they are just attached to an aqara leak sensor set in occupancy mode which works pretty much flawless since setting it up.
You just need to see what 2 of the 4 will allow a closed circuit when pressure is applied.
Still struggling with this one. I’ve got the four wires each hooked up to a GPIO on an ESP32 and the voltage readings don’t really give me any indication when someone’s in bed (see graph below).
Green/Yellow have continuity as do Black/Red. I’ve tried connecting G/B, G/R, Y/B, and Y/R and don’t get any significant readings across them with a multimeter when there’s someone in bed.
You’re not supposed to be connecting those wires directly to GPIO. What you’re supposed to be making is a resistor network that allows you to sense voltage differences in the range of 0–3.3V and therefore measure the change in resistance.
Hang on…
Find the two leads that have some sort of resistance that varies with weight using your multimeter (it should be high normally and drop down when squeezed hard).
Then use those two leads as part of our resistor network, with a decent amount of resistance added in the network (in my case I used 460k ohm IIRC). I will share below my own sensor’s schematic.
Then you will have a sensor that will get you a variable resistance or variable voltage. When the resistance goes below a certain setpoint, that means detection.
On top of that you can add debouncing using the delay on and delay off ESPhome constructs.
Thank you so much for that detailed reply. I finally had time to dig in to this and replicate your circuit (I think) and I’m not getting the results you describe.
I’ve tried with every permutation of the orange and brown wires with the R/B/G/Y wires from the sensor pad, but I think the yellow and green are the correct pair.
Regardless, the logs show the same values over and over, even with pressure on the sensor:
[12:10:04][D][sensor:093]: 'GPIO5': Sending state 3.10700 V with 5 decimals of accuracy
[12:10:04][D][resistance:039]: 'Variable resistance 1' - Resistance 33733.5Ω
[12:10:04][D][sensor:093]: 'Variable resistance 1': Sending state 33733.47656 Ω with 1 decimals of accuracy
[12:10:06][D][sensor:093]: 'GPIO5': Sending state 3.10700 V with 5 decimals of accuracy
[12:10:06][D][resistance:039]: 'Variable resistance 1' - Resistance 33733.5Ω
[12:10:07][D][sensor:093]: 'Variable resistance 1': Sending state 33733.47656 Ω with 1 decimals of accuracy
[12:10:09][D][sensor:093]: 'GPIO5': Sending state 3.10700 V with 5 decimals of accuracy
[12:10:09][D][resistance:039]: 'Variable resistance 1' - Resistance 33733.5Ω
[12:10:09][D][sensor:093]: 'Variable resistance 1': Sending state 33733.47656 Ω with 1 decimals of accuracy
[12:10:11][D][sensor:093]: 'GPIO5': Sending state 3.10700 V with 5 decimals of accuracy
[12:10:11][D][resistance:039]: 'Variable resistance 1' - Resistance 33733.5Ω
[12:10:11][D][sensor:093]: 'Variable resistance 1': Sending state 33733.47656 Ω with 1 decimals of accuracy
GPIO35 (or equivalent pin chosen in the ADC sensor of your YAML)
460K resistance
Other side of 460K resistance to GND.
Skip the capacitors for now.
You should see the ADC value change up or down when you compress the resistance. It’ll be noisy because of no capacitors, but at least you can confirm it’s happening and you can add the caps later.
Also, what is the range of resistances your thing goes over? You may have to select a different resistance to get a good ADC measurement.