FSR - the best bed occupancy sensor


These are the headers. If you haven’t done that, you need to soldering them to the board.
Later check again and see if you get any data.

Do you mean on the side of a slat? That won’t really work, because the FSR won’t bend in the right way. In fact, you might even damage it if under too much load that way.

I meant something like this, where it’s marked red. The ones I have are not connected so it’s basically the one below but as two pieces. But as I mentioned in my edited post, my try earlier today did not give any usable results for the resistance measurement. Maybe my mattress is too thick or sth. not really sure :confused:

image

Exactly, you got it. It doesn’t work reliably under mattress protector. I have used it with other bed that has double slats and it works perfectly, zero false reports. This might be a good reason to get a new bed haha

The bed itself is great just unfortunately not really suited for this stuff :frowning: I certainly didn’t consider using this sensor back when I bought it haha. Also found a pic that is more accurate. My mattress rests on two of those next to each other

And beside strapping it to one of those slats I also tried putting it under the feet/legs but same result :confused:

Maybe a pressure mat would work, might try that out. I also thought about the mattress protector but I fear it will be too soft for the sensor

I have a similar rack. It worked for me to place the sensor with the pressure layer towards the slat (not towards the mattress)

Could you provide a picture please? Not sure I fully understand, english is not my first language :confused:

I finally set up the FSRs as a bed occupancy sensor. I ordered 2 600mm long strips from Aliexpress. They were a bit folded when they arrived by I taped them flat on the slats. My bed slats are arched so when the mattress was put down it applied enough force on the center of the arch to make the FSR read ~200Kohm. To solve this I put some card board on the slat above and below the fsr’s slat to try and raise the mattress up a bit. Now when no one is in bed the sensor reads 10Mohms and when in bed goes below 100Kohm depending on how close to the middle you are. So far I have had a few nights with it working reliably and still works after moving the mattress to change the sheets.
I did modify the esphome code to have a combined binary sensor for both sides and set a on off delay for the binary sensors so I can get a bit of hysteresis.
Next step is to solder a PCB for it as now its on a breadboard. Fun project!

Wouldn’t this setup eventually start giving false positives?

Great write up, thank you. Just wondering though, the sensor says its rated to 100kg, surely a mattress and person weights more than 100kg. My mattress is heavy as.
Although I kinda feel I’m reading this wrong as I haven’t seen anyone question it.
Is it with the mattress on it just zeros it out?

A lot of the weight is distributed evenly by the mattress over a larger area than just the sensor. There’s very little weight on the sensor when no one is in bed.

I weigh near 100Kg and have a pretty hefty innerspring mattress and my sensor is still working fine (first post above when it was implemented was Dec 2021).

Appreciate the reply.

I’m a little stuck on getting started with the code, is this an ESPHome project or do I need to add the code to specific yml files.

Any help to get started would be appreciated

It is an ESPHome project. This is not a generic ESPHome help topic so if you have questions about getting started with ESPHome start a new topic in that forum category (after reading the documentation and searching first).

thanks for that.

Is there anywhere I can access the full esphome code listing for this.

“You will need an input number in Home Assistant for each FSR:” - how is this used and what should the input number be called, I can’t connect the dots on this one.

cheers

Everything you need is in the first post. But sure, I stripped everything out of my bedroom config except parts relevant to this project, you will have to adjust it for your your network and chosen ESP board:

esphome:
  name: master-bed-sensor
  platform: ESP32
  board: mhetesp32minikit

wifi:
  ssid: 'WAPLO'
  password: !secret wifi_pwd
  manual_ip:
    static_ip: 10.1.1.90
    gateway: 10.1.1.1
    subnet: 255.255.255.0

api:
  encryption:
    key: !secret api_encryption_key

logger:

ota:
  password: !secret esp_pwd

binary_sensor:
  - platform: status
    name: "Master Bedroom Sensor Status"

  - 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: wifi_signal
    name: "Master Bedroom Sensor WiFi Signal"
    update_interval: 15s
    filters:
      - sliding_window_moving_average:
          window_size: 15
          send_every: 15
          send_first_at: 1

  - 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
    
  - platform: homeassistant
    name: "Trigger Level"
    id: "trigger_level"
    entity_id: input_number.master_bed_trigger_level

switch:
  - platform: restart
    name: "Master Bed Sensor Restart"

Seriously?

The config and how you use it is directly under that quote.

Thanks for that, must have missed or misunderstood the input number bit, i’ll re-read.

Hello, i bought a FSR sensor 600mm but when I put it under the mattress, to measure the resistance, without my weight with the multimeter it cannot detect any value at 20M ohm, the writing on the device is OL.
what am I doing wrong?

Nothing. What does it read when you are in bed?

when I am in bed the value measured at 20k ohms is 11. when I am not in bed the value is 0.L at any unit of measurement on the multimeter