Bed occupancy sensor, using parts you have

Not this type specifically but some type of copper tape.
I used it to keep snails out of vegetables.

It falls apart just looking at it.
I can’t see that ever working in a bed.

this is my implementation of a bed weight sensor using esp32 tasmota and mqtt and it works great. it can tell when my wife or I are asleep. then sets alarm, turns off lights etc

https://forums.homeseer.com/forum/hs4-products/hs4-plugins/lighting-primary-technology-plug-ins-aa/mcsmqtt-michael-mcsharry-aa/1456000-mqtt-tasmota-bed-weight-sensor-using-wemos-mini-d1-esp32

1 Like

Ah wow. That thin?
Thought it seemed cheap

I did the same with my bedsensor. After having tried pressure mats that never worked I used the same cheap load sensors. You buy a kit with 4 sensors and a small interface board. I connected that to an ESP8266 and wrote my own code that can report when the weight increases above a threshold. I 3D printed 4 small brackets and covers that holds the sensors, strapped to the bottom of beds with tiewraps.

The top cover is simply held in place by the mattress. I put some capton tape inside the covers to make the inside smooth to avoid any noises from the layers of the 3D print.

The beds are elevation types. I put the sensors above and below the point where the head raises up. This gives a good safe sensing both when I lie down or sit and read. I cannot feel anything through the spring mattress and no sounds. And the sensors are 100% reliable since I set the right level between vacant and occupied. You want the value so high that a few pillows makes no difference but so low that it senses your weight no matter which position you sleep. It took no time to find a good value. Plenty of margin.

Here is the little box I printed with the Wemos D1 mini and the HX711 board on top.

7 Likes

You really don’t feel them? Hmm, than I have to try them as well… :slight_smile:

I did a test with two packs of cigarettes and could exactly tell, where they were under the mattress. That’s why I wasn’t trying these load sensors. But I have some laying around, seems like a sneaky little test to do. :smiley:

EDIT: Would you mind sharing the 3d print files or a link to thingiverse? Thanks! :slight_smile:

@KennethLavrsen 3d printed boxes are nice. I didn’t use any

I placed the sensor upside down so that when they get pushed in they push in towards the mattress. It passes the wife test. She doesn’t notice them. Just some tape to keep it in place. It may not be as accurate for weight (if I had printed a box), but it is great for sensing presence by weight change

1 Like

If you have a thin foam mattress then you may feel something. But I have a normal mattress with springs and on top of that a thin latex mattress (pretty standard). You cannot feel that one spring is pushed up a little because at the same time the wodden lamellas are pushed down. The plastic cover looks deep but it actually only stands on top of the load cell with 4 mm of plastic. The cover goes down between the lamellas.

I will wrap up some files and put either on Thingiverse or at least on my own website and link then here. Later this week where we have some days off

1 Like

Exact weight of your wife when she is in bed. That is a nogo. She will murder you

lol ya, so having it be not so precise is a feature, lol

I have put the 3D files, and also my Arduino code on this page

http://www.lavrsen.dk/foswiki/bin/view/Kenneth/BedSensor

If anyone think - why not ESPHome? I prefer to write my own code specific for the purpose. This way I have much more control of how it works. Once you have written one software for ESP8266 including wifi connection, MQTT client, and Over-The-Air programming, all other programs look and work the same and it is easy to just add a sensor or LEDs or whatever. That is my preference.

5 Likes

Regardless of how this topic played out and that there are better, far more reliable options. I love this post to bits. and works well. If ya are not cash strapped there are better ways.

But I love the kiss/fun/experimental style.

Note: Make sure you have a “blowhole” where air can get out. I taped it so to well together. It fucked everything up.

After, very reliable.

If you are too tape savvy it will make bubbles that do get out with time and fuck up your sensor baseline.

2 cents.

1 Like

Speaking of batteries, for anyone that’s using batteries and not connected to power supply.
How long could it last?

Hey there. The image you see of a battery pack was just an image of the little spring I needed to modify the foil sheets. I am using power supply for the esp32.

Yes, I’m aware of that,
I’m just curious how long it would last if it’s running on battery.
Or if some sleep/standby settings need to be applied for the esp32

Hello, the Arduino code you released keeps compiling errors. Can you compile it into a .bin file? Thank you
搜狗截图20210624164604

A binary file made from my code will have IP address and MQTT credentials hardcoded. That is no use to you

But if you look at your own screenshot the problem you have is that there is no secrets.h file

You can just remove that line and instead define the constants in the .ino file.

Example

#define WIFI_SSID "myssid"
#define WIFI_PASSWORD "mypassword"
#define MQTT_SERVER "192.168.1.20"
#define MQTT_USER "mqttuser"
#define MQTT_PASSWORD "mqttpassword"
#define OTA_PASSWORD "otapassword"

How to add your telegram

I can sense you are a beginner with Arduino

You have two ways. Either put the 6 lines in a file called secrets.h placed in the same directory as the .ino file.

Or just paste the 6 lines at the beginning of the .ino file

The lines just defines 6 macros that are used in the code below

Yes, I am a beginner, thank you for your help, it has been compiled successfully

I built a two-sensor setup for a small couch as my first-ever DIY microcontroller project. With zero experience, it was generally quite easy and reporting to HA within 90 minutes (a lot of which was just figuring out how to flash w/ ESPHome, since I’m not using supervised). I did wind up adding a delayed_on_off of 0.5s to the individual sensors and 2s to the joined since it was generating around 5-10 on/off commands for a single instance of sitting down/getting up.

1 Like