Bed occupancy sensor, using parts you have

Don’t forget that the slats provide ventilation to the matress, don’t cover more than you need.

:+1:

I use a couple of these and they work well (for the sids monitor)

1 Like

@N-l1 Thank you for this awesome share, works great, been looking for something like this for a long, long time.

1 Like

Great write-up, thank you.

Is there a way to get the setup values in Home Assistant? I have a sensor that needs to be deployed in a second house where there is no way to change the threshold value. I can write a process to change the thresholds but need a way to see the values first.

Thanks @cyn

No. Unfortunately, I don’t think there is a way to see the values in HA. But if you can access HA, the ingress feature of ESPHome should give you access as well. You can also try setting a threshold (normally between 2-8) and test if the bed triggers.

Actually there is. See:

Correct me if I’m wrong @tom_l , but I just don’t see how that “gets the setup values in HA” :thinking:

There’s an input number in home assistant. You set it to the threshold value you want. The esp reads that value and uses it to compare to the incoming values from the bed sensors.

You don’t need to see the values. You can sit on the bed and adjust the input number until you get a change in output.

Yes, and that’s exactly what I meant here

Very nice way of testing the values though would definitely use it in future sensors :grinning:

I am looking to build this using some laminate flooring underpad i have lying around to see what range i can get. I also considered using a yoga mat between the conductive surfaces. Will see how it goes.

1 Like

Interested to see your results…

@N-l1 & @tom_l thank you for the discussion I tried that yesterday and got message: On the ESP32 pins GPIO32 through GPIO39 can be used. Which is why I reached out.

Unfortunately I have already soldered my board together and waiting on more from China.
My numbers usually run around 90 range when off & 50 when on, because I have a sheet of bubble wrap in between layers.

Going to read up on the ingress feature, that’s something I’m not familiar with.

1 Like

[ How to limit MQTT pings ]

Team

the n-I1 script currently sends a lot of MQTT pings per second , is there a way to change the script to send MQTT only when status change?

Hum, I don’t use MQTT but I am pretty sure it only sends a message when there is a state change. Check also here.

Can you make more sensors? I want to add sensors to your bed project that I don’t know yet. Please help me add sensors.

What are you going on about?

I had binary_sensor in my automation
Now I want to add sensors. Can someone help me?

esphome.io is what you want.

Took a while, but last weekend, I had the chance to work on this bed sensor project. I have to say, it is just great, thanks a lot to @N-l1 for your tutorial. :+1:

My first try was “normal” tin foil and a little heavier paper. Normal copy paper is 80g/m², I used a 120g/m². As you can see in the pic, they were just a prototype and way to small to work correctly. But to get the idea and test it a bit, they were great. :slight_smile: All worked like a charme, the values are not really that big compared to other real sensors, with someone in bed they ranged around 18 to 24 and with no weight they were around 40 to 50.
Nevertheless I tested these for two days, mainly because I couldn’t get my hand on a “heavy duty” tin foil.

After I got a heavy duty tin foil (pictured) I made new stripes for my slatted frame. In the second version (call it 2.0 :smiley: ) I made the stripes with the following setup:

  • my frame is 1.00m wide, so I made the paper/carton 80cm and the tin foil 70cm, where 10cm are for folding one end to put the paper clip on.
  • I used heavy duty or extra strong tin foil
  • I used an even thicker paper/carton, this time it was 180g/m².
  • I use two stripes for each side of the bed, they are glued on the frame with a distance around 50cm to 60cm.

The values are even lower with this setup, I have no idea, if it is the thicker tin foil, or the paper or even the length of the stripes.But they are very steady and therefor can give a good basis for sensors in HA. Right now I have a value of 9 with someone in bed, 13 without anything in bed, and 11 with two piles of t-shirts. My treshold is set to 10 and everything works fine. What I had to do was adjust the values after the first night, but since then, everything works very reliable.

I’m very happy and as I said, I didn’t have one incorrect reading. :smiley: :+1:

6 Likes

I just made one of these as well. Used poster board from staples and heavy duty tinfoil. I also have a slat bed frame, with a memory foam mattress. Seems to work pretty good. My settings are 12 when off, 7 when on. 10 when the dog jumps on he is about 16 pounds.

I copied an article I read from Phil Hawthorne, “Making Home Assistant’s Presence Detection not so Binary”, and applied it to the bed sensor.

I now have states of:
- Just Laid Down
- Asleep
- Just Left Bed
- Back to Bed
- Bed Empty

I can use these to run different automatons depending on each specific state.

Pretty cool.

5 Likes