FSR - the best bed occupancy sensor

Thank you for all your help!! ESPhome is running, esp32 connected… now working on getting some readings… that part isn’t going well but I’ll keep at it :slight_smile:

Yeah I KNOW this is an easy project by my first experience with esphome and building a sensor… so slow and steady hahhahahahha Baby steps…

1 Like

Thank you for that!!! It’s what fixed that for me!

1 Like

Did you just “improve” @tom_l project by tweaking the yaml to a way that it works 100% on the esp now? :joy: That would be quite an achievement for a first time user :muscle: Maybe want to share your yaml here?

So far I’ve managed to get it to stay connected LOL

Here:

esphome:
  name: johnbed

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "4+kq640vtmKu2sBAMvUlalO+WN49wPEXQ8GMkcQkoBw="

ota:
  password: "0401214cf2c56dc77149a3929e163f7a"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Johnbed Fallback Hotspot"
    password: "1wW7PkHMCkI9"

captive_portal:
    

Can’t get a reading and/or HA doesn’t show anything but I’ll get there. I’ll just keep looking and reading until I figure it out. If that’s not what you’re looking for let me know :slight_smile:

1 Like

It had only been added to esphome a few months prior to me making this.

It would be a good addition. I might get around to changing it one day. If it ain’t broke…

2 Likes

that should it be (no setup in ha required):

binary_sensor:
  - platform: template
    name: "Master Bed Occupied"
    id: mb_o
    lambda: |-
      if (id(master_bed_sensor).state < id(trigger_level).state) {
        return true;
      } else {
        return false;
      }

sensor:
  - platform: adc
    pin: GPIO34
    attenuation: 11db
    name: "Master Bed Sensor"
    id: "master_bed_sensor"
    icon: mdi:bed
    update_interval: 0.5s
    filters:
      - sliding_window_moving_average:
          window_size: 10
          send_every: 1
      - or:
          - throttle: 180s
          - delta: 0.02

number:
  - platform: template
    name: "Master Bed Trigger Level"
    id: "trigger_level"
    optimistic: true
    min: 0
    max: 3.5
    step: 0.05
    icon: mdi:arrow-collapse-down
    unit_of_measurement: V  

untested

2 Likes

Hello, I’m getting Rin = 14-20kOhm
But I’m not sure about Rout
I adjusted the multimeter from 200ohm ~ 20 MIL ohm but I’m only getting value of 1 each time.
Is it supposed to be lower or higher than Rin?

Uncompressed the resistance will be higher. In the order of 25K Ohm.

Change the range on your meter. “1” is probably the over-range indicator.

2 Likes

Hi, this was my result for each range

20k Ω - 1
200k Ω - 1
2M Ω - 1
20M Ω - 1

Should i just assume a number like 5 mil for example?

No, why would you assume such a low value?

You need a meter that can measure above 20k Ohm.

I think my multimeter is already capable of that, but it still gives me 1

You are not measuring the resistance correctly then.

How should i do it correctly?
I can still get the resistance value when I’m on the bed and tuning to 20k.
But out of bed still gives me 1 (out of range) after tuning all the way to 20M

Do you have any known value resistors laying around greater than 2M ohm?

if you do check those and see if the meter returns the correct value.

maybe the meter is bad. Or maybe it needs a new battery?

I’ll try to get some 2M, and 20M ones.
I rarely use it but I’ll try replacing new batteries as well

1 Like

I ordered a sensor from Amazon that is 60 cm and looked similar but not exactly the same as ops. The range spec was 10g to 10kg. Without mattress, with mattress or with mattress and person on top of the sensor, the resistance was out of range with my multimeter set in the mega ohm range. Only if I am pushing directly on the sensor with my finger was I able to bring the resistance down to the 50k ohm range.

I wonder if it’s because my bed (memory foam) has really good weigh distribution so the sensor is not feeling any significant weight. My solution is to prop up the sensor by elevating it on the slates using a strip of ply wood. With that I am able to get sensor to produce a resistance of 10k ohm. I would suggest trying that to see if you can lower the resistance down that way.

1 Like

Updated the first post to use a number entity instead of an input number.

3 Likes

Hi all, I’m trying to build my sensor. I already have all the components and have measured the resistance of the FSR in and out of the bed.

My values are .50 out of the bed and .25 in bed using the multimeter in the 2M mode.

With this values, what is the resistance value that I need to use? I’m pretty noob in electronics.

Any help will be really appreciated.

Put the numbers into the equation in the first post.

I bought a bunch of different round ones for another use but haven’t played with them yet.

I was planning on investigating if they could be coupled with a Xiaomi door sensor (but sounds like this is unlikely to be reliable, as per some discussions in this thread). I was going to try using them for seat occupancy.

I was thinking about trying to use one for bed occupancy, since I have a bunch of them. Perhaps one with the right rating may work ok. Maybe they could go under just your head etc? I guess they’re unlikely to work as well as a long linear one.

I bought from here with no problems.

AU $2.42 7%OFF | 1kg 3kg 5kg 10KG 20KG 30kg 50KG 100KG 150KG Film Pressure Sensor Resistive Force Sensitive Plantar Flexible Robot FSR Insole

1 Like