Bed occupancy sensor, using parts you have

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

Quick question, do you use 3rd printed case for the load cells?
Or is the couch surface flat/hard that you can just place the load cells only below the couch cushion?

Not sure if your question is directed at me or someone else, but I used the foil capacitance mat method at the top of this thread, which goes under the cushion in my case. No load cells at all, but I don’t think they’d work under the cushion without some kind of rigid plate attached.

Did you find out anything interesting for battery power btw? I’ve just been using a USB power pack which lasts 3 days before needing a recharge :confused:

Sorry, i assumed you were using load cells
Not yet, as for the portable power pack you’re using, what’s the battery capacity before it run out in 3 days?

It’s a 10,000 mAh pack from 2014, I imagine you’d get a bit longer from a new pack at the same capacity. I haven’t tried with the setup_mode flag disabled, not sure if that might help battery life.