This was an early photo, I’ve since tightened up those cable ties as far as I can - I have each one on the same beam but on the left side or the right side (that beam you see in the pic that everything is screwed to is the central beam running from the head to the bottom of the bed - the other beams you see are running from left to right.
I apologize for resurrecting an old post. There was a lot of discussion around difficulties with the FSR connections. I’m doing a similar project and found these connectors which should make FSR connections much easier and more reliable.
Any expierience with force sensible resistors? I wanted to build a similar bed occupancy sensor as described here using a FSR and an ESP32 configured via ESP Home.
I is connected as follows:
One leg of the FSR is connected to the 5V output of the ESP32.
The other leg goes into a 10K Ohm potentiometer, which is then connected to GPIO15 (Touch).
The ESP configuration is as follows:
substitutions:
friendly_name: Bed Occupancy
esphome:
name: bed_occupancy
platform: ESP32
board: nodemcu-32s
# The Temperature sensor that is connected to D2.
sensor:
- platform: dht
pin: GPIO23 #D2
model: DHT22
temperature:
name: "Bedroom Temperature"
id: temperature
humidity:
name: "Bedroom Humidity"
id: humidity
update_interval: 60s
# Setting up the pressure mats
esp32_touch:
# Activate debug messages to calibrate sensor
setup_mode: true
# Definition of pressure mats
binary_sensor:
# - platform: esp32_touch
# pin: GPIO14
# name: "Bed Occupancy Left"
# id: bed_occ_left
# threshold: 5
- platform: esp32_touch
pin: GPIO15
name: "Bed Occupancy Right"
id: bed_occ_right
threshold: 5
# The accumulated bed occupancy sensor
# - platform: template
# name: "Bed Sensor"
# lambda: |-
# if (id(bed_occ_left).state || id(bed_occ_right).state) {
# return true;
# } else {
# return false;
# }
wifi:
ssid: !secret WIFI_SSID
password: !secret WIFI_PASSWORD
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: $friendly_name Fallback Hotspot
password: !secret ESPHOME_FALLBACK_AP_PASSWORD
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret ESPHOME_API_PASSWORD
ota:
password: !secret ESPHOME_API_PASSWORD
Now if I put the FSR on a table “curled up” on its side it gives readout values of about 70, no matter how the poti is positioned. As soon as I lay the FSR out flat on the table, or bed in a matter of fact, the read out drops immediatly to 0. The potentiometer again does not change this behaviour. This means currently the sensor allways evaluates to true.
How could I improve the situation? Do I need to wire it differently? Any help is appreciated.
I have a very similar setup for my bed sensors. Minus the potentiometer!
The only way i was able to get stable readings was to solder the strip and the wires onto the connector. Before that the readings would be all over the place.
It makes sense, as this is only the test setup I tried to keep it flexible using jumper wires for now. But I get a steady 0, regardless of the pressure on the bed. As the readout is steadily zero already when I even roll out the FSR on a table.
Btw: I initially had the FSR connected directly to the ESP without a poti in-between, but the result was the same.
I measured the FSR and if laid out flat on the table the restiance is in the Megaohm area, if I press on it, it is reduced to some Kiloohm or even lower. So the FSR itself is working just fine.
I have now done the following setups, all resulted in the Sensor Outputting ‘0’ and the Bed Sensor always set to ‘On’.:
Admittedly I am still using simple jumper wires to test the configuration, but so far I did not even get unstable read-outs. Am I doing something wrong in the setup?
I think you should stop using the 5 volt pin.
The input pins on an ESP is not 5 volt tolerant, so you could damage the ESP.
Use the 3.3 volt pin instead.
I have a DHT22 connected to the same ESP, which is still working. Also if I unplug the FSR (open circuit) the readout increases to some unstable number in the region of 1000. So I assume that my ESP survived sofar… Thanks for the hint I will have a go with @tom_l suggestion, when I have the time.
Could you send me a picture of what the soldering looks like?
With the FSR, it was always said that we shouldn’t solder it, but I thought that this was the only possible way as well.
I used the following connections (5V, GPIO33 and GND)
Regardless of me pushing onto the FSR, or not the readout in ESP Home was a constant 1.1V and 2810Ohm, although my multimeter provided readouts in MOhm area when the FSR is not touched and a much smaller value in the KOhm or several houndreds of Ohm, when pushing on the FSR.
The multimeter did change its value, when pushing on the FSR.
PS: When I capped the connection between the 10KOhm resistor and GPIO33, the readout changed to 0V & 0Ohm.
@Spurious Although I did not yet have luck with my overall setup of the sensor, I am using the exact same clamps on the FSR and at least this connection is sollid for me. I used pliers to create sufficient force on the clamps for them to close.
Didn’t check that yet, thought I first test the general setup that way, before calibrating it. It’s hard to read the multimeter, when lying on the bed At least not whilst alone.