FSR - the best bed occupancy sensor

For the last time, no. With nothing connected:

Then calculate R1:

R1 = SQRT( Rin_bed * Rout_of_bed)

2 Likes

those values are the values of the FSR itself when you are in bed (Rin) and out of bed (Rout). that’s why you need a multi-meter because you can’t find those values in any other way.

then once you find both values of the FSR then you use them to calculate the value of R1.

1 Like

Got it.

Thank you!

Nothing is missing. This is an ESPHome project and the required config is provided in the first post.

So just a small feedback because im so happy to have your sensor project running now since about half a year - its just one of my most loved sensor in my whole system. i have some issues with the resistor, probably picked a wrong size, but with the triggerlevel adjustment so far no problems at all!

Thanks for sharing your awesome idea with us!

1 Like

Out of interest I would really like to get this working… I have all the hardware… not even sure where to start… I’ve installed ESPHome but after that not finding much on the how to… Can anyone point me in the direction to get started?

1 Like

Thank you I have it installed on HA but I’m trying to connect to the D1 Mini… Thank you for the link it was very helpful!! Nice to see some people have manners.

1 Like

This is not a “how to use esphome” topic. Please ask elsewhere.

1 Like

I’ve read, re-read this post about 2000 times… where exactly does the above go? HA config file? That’s where I put it and it’s throwing an error so pardon me but I’m this close to having this thing actually working! :slight_smile:

3 Likes

Thansk for sharing detail on this project. I was able to build 2 sensors following your instruction.

For those of you with memory foam, I found the weight distribution is so even that when measuring resistance with bed empty or occupied, the resistance is so high that my multimeter will say overload. I got a piece of plywood and lay the entire sensor on top and that allows it to produce a resistance in the 5k range. The result voltage produced is still a little narrow (2.5V empty and 2 V occupied, but consistent).

2 Likes

Any particular reason not just using a number component directly in esphome? Should be possible to have the complete logic on the esphome node then :muscle:

2 Likes

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?