FSR - the best bed occupancy sensor

Why isn’t that on the Number component page?

That’s where I looked for that exact setting. Either way I’m leaving it as an input number now.

1 Like

By the looks of it only the template number supports restore_value and all other number platforms don’t (at this point). Probably that’s the reason why the documentation is found directly in the Template Number docs and not in Number component docs (because it’s not “universal” for that component). :bulb:

1 Like

I want to build it today, but I didnt understand how to connect the wires to esp32, I have resistors
I just need pic or something to show me how to wire
thank you

Could anyone help me in setting up a second strip for my partners side of the bed?

We have a superking bed and the bed sensor is working fantastic but what it’s highlighted is that I sleep on the same place and she moves around lol. It’s perfect when she’s on the right spot but not so good when she moves.

My plan is to add a third FSR but ideally I would create 2 ADC sensors and name then XXX1 and XXX2 but I would only want them to change the binary sensor if one or the other is lower than the threshold.

So basically

  • platform: template
    name: “XXX Bed Occupied”
    id: “XXX_bed_occupied”
    lambda: |-
    if (id(XXX1_bed_sensor).state < id(XXX_trigger_level).state) {

OR XXX2 < Trigger State

return true;
} else {
return false;
}

I know how to setup the 2 sensors but I’m struggling with coding the OR. Ideally I’ll end up with a single binary sensor that can be switched by 2 FSR’s

Thank you all :slight_smile:

Does somebody has a link on Aliexpress for buying these resistors ?

Thanks !

I got these, £30 pair @ 60cm

No, I mean the resistors (R1)

Buy them locally.
You can probably find a box full of all values fairly cheap.

We don’t have such a store nearby…

Anyway, I already have to order stuff at Aliexpress so.

A box with different values would indeed be great, but I’m a novice so I really don’t know what I should order…and that’s why I asked.

For a start these assorted kits are always useful.

Like some resistors:

https://www.aliexpress.com/item/32505894332.html

Some capacitors:

https://www.aliexpress.com/item/32954751214.html

Some diodes:

https://www.aliexpress.com/item/4000986877208.html

2 Likes

Hi r1 Value is described. What about r2? What would it be?

R2 is the FSR, the resistor that varies with weight.

1 Like

ahahah ! doh!
Thanks

1 Like

I just added a second sensor and ran into the problem with the FSR out of bed resistance over 20Mohm (as high as my meter goes) and in bed resistance in the 2k range. So I used a 100k resistor for the voltage divider. It works great. I get 3vdc out of bed and around .2vdc in bed.

But it leads to a question…

since a 100k resistor works so well and gives a very distinct in bed vs out of bed signal what is the benefit of calculating the resistor values to give a more precise range of voltage detection? I can’t think of any reason in this situation that just requires a “go/no go” test.

1 Like

If you are lucky enough to have an out of bed resistance that high and in be that low, then it is less important to do the calculation.

However if for example your mattress is super heavy and partially activates the FSR it is more important to use the calculation to get the widest possible voltage swing.

4 Likes

Yeah, I didn’t think about the other direction.

That makes sense.

Thanks

how can I calibrate the sensor?
the value was 3.30 and go down slowly , not the value its 3.05 , how I can to calibrate it again to 3.30?

There is no calibration. The sensor is either on or off depending on your trigger level.

1 Like

There is going to be some drift.

Just make sure that there is a big enough difference between in bed and out, and set your trigger level to a reasonable level.

2 Likes