Thought I’d share my bed occupancy sensor (yes I know, more bed occupancy sensors based on load cells!) and hopefully make it easy for anyone else that wants to replicate.
Using those cheap 50kg load cells under each corner of the bed, a HX711 board, Wemos D1 Mini and of course Home Assistant!
One thing I found hard to find information on was how to mount the sensors. I tried a few things but ended up 3D printing casters/holders for my bed legs and allowing the load cells to slot into them, this stops the bed sliding around on the cells and interfering with the reading. This method keeps everything secure and ensures each cell is in the exact same position.
Ensuring that when we are both in bed, every light and media player is turned off, door locks are set and the house alarm is set to “armed home”.
I have lights that are automated through Home Assistant when motion is detected, I add a condition to these automations not to trigger these lights when we are both in bed, this is so that our dogs do not trigger lights all night.
During night hours, the bathroom light comes on at a very dim brightness if one of us exits the bed during the night. This is great for not being blinded when getting up to the bathroom during the night!
This project is awesome. I am trying to do the same with minor modification. In my case I don’t need accurate measurement and all I want to check if there is any additional weight on the bed or not. I am having trouble mounting the load cell because of my special bed legs. However I would only need one cell. My bed has a middle leg in the centre. Do you know how to make the wiring to HX711 if I only need one or maximum two load cells?
The tutorial helps me a lot, especially the troubleshooting section, thank you so much! The sensors are working fine now, but I have never worked with MQTT before. When it comes to setting this up, do I just need to use this integration? https://www.home-assistant.io/docs/mqtt/broker/ And do you know a way to run the ESP8266 on battery without having to re-charge it every couple of days?
Running an ESP8266 can be a difficult task that depends on many factors, what sensors do you plan to use, how often do you need the ESP8266 to report, how big a battery, etc etc?
This is great, thank you so much! The installation seems pretty straight forward, I will definitely try it out.
I’m using the same sensors as in your tutorial, with a different amplifier and a board from aliexpress that’s called something like “Micro ATmega32U4 Leonardo replacement”. It’s working fine with your calibration code, but I’ll have to switch to a wireless solution w/ battery, because there’s no outlet next to the bed.
I’m sorry I do not know the answer to that, you would need to measure the power draw of the setup and do some calculations to see what kind of runtime you would get. You can also implement deep sleep on Arduino boards which saves a lot of power. Choosing a board without USB headers can save a lot of power along with removing any onboard LEDS.
I’ve made a battery door sensor before on battery power, it lasted a long time after doing the above, but that is a totally different sensor, I don’t think you will get a long time out of a battery but you will know more after doing the calculations. I used this link here which had a lot of good information:
If you need the exact weight measurement then yes.
I have made mine so that there is support under the load cell part that bends. So that it can’t bend too much to break. I use it only to detect on/off the bed. Not so interested of the actual weight.
This is probably a stupid question, however I’ve seen Lewis’ YouTube guide on this, read the article and now ended up here when googling for inspiration!
I’ve printed the same sensor holders as shown in the 1st and 2nd images above. But if the bed leg is larger than the printed top (as is the case by seeing the larger “leg holder” printed cases), then how does the bed leg apply pressure to the flappy part of the case, when it will also be touching the 4 edges of the top case too?
Sorry if that’s not a very clear question… I’d be interested to see how people have attached the sensor cases to the bed legs is I guess what I’m asking…!
I was about to go ahead with this project, but I noticed our bed has 12 (!) legs !
Is it possible to have 12 load cells connected to the HX711 ?
If so, how do I join the wiring … in groups of 3 ? Does it matter if you join the outer legs / corners etc ?
The load cells are more reliable (at least in my experience) but obviously a bit more work.
To answer the question, you don’t need to cover all legs necessarily, you could make “blanks” for the other 8 legs so the weight is distributed evenly - haven’t tried it but should work
Well, anyway, I found this guy who has diagrams for 4 / 2 and even 1 leg(s)/load cells.
If you don’t need an exact weight measurement and just a simple presence detection, this more then enough I think. I think I’m just going to take the 2 center legs of each side of the bed and see how this goes.
Btw, I also read that some HX711 amplifiers don’t have ground on pin E- , maybe that’s the cause of inaccurate readings: