Bed Scale / Occupancy sensor

By coasters do you mean the 3D printed bed leg load cell holders? I spent a total of $22.23 for all four of them when ordering via Thingiverse and picking a local 3D printing firm.

Yes & thanks

Hey have you resolved it yet or even have success?
I too have a MALM bed and am planing/thinking about a bed occupancy sensor.
Do you have the version where u can fold the whole amtress up? If not I’d recommend you put the weight sensor right beneath the slatted frame under the matress.
I unfortunately have the afore mention version so I could only potentially place the weights sensors under the whole bed which weights around 100kg already so I’d be very quick to overload them.

 - platform: hx711
    name: "Bed weight"
    dout_pin: D0
    clk_pin: D1
    gain: 128
    update_interval: 1s
    filters:
      - lambda: |-
          auto first_mass = 0.0;
          auto first_value = 21047304;
          auto second_mass = 76;
          auto second_value = 18826926;

          return map(x, first_value, second_value, first_mass, second_mass);
    unit_of_measurement: kg

Can you talk a bit about the filter you are using here? Like what exactly it is doing?

I’ve just set this up on my son’s bed. I’m just using the “calibrate_linear” filter and it works OK but wondering if there is a better method.

2 Likes

The calibrate_linear is just a shorthand for the mapping function I’m using. The calibrate_linear function did not exist when I wrote that code, but they do the same.

@johboh just finished setting this up again after moving/getting a new bed. Switched over to using 4 load sensors spread out further vs 2. Last night was the first time using it and I am having an issue where the value doesn’t stay consistent/goes negative over time.

This is the graph of my scale from the last night.

Have you seen similar issues? If so how did you handle it? If not, and ideas why I might be having this issue?

Hey!
Does it show the correct weight if when you just sit in the bed, stand up and sit again? I.e. is it just over a longer period of time it drift?
I had a similar issue where the weight was varying a lot during the night, but then I realized that I had a fifth leg in the center under the bed. I adjusted the leg so it does not touch the floor and now the weight is quite stable during the night.

Hi!

Looks cool, working on something similar based on your design. I was wondering where you got the parts that sit on the loadcells? Did they come with the sensors or did you have those printed too?

The small black “spacers” came attached like that with the cells (and are screwed on). But they are not really needed, but I have designed the holders after them. Other cells I have seen does not have them, but still a good center point upon you can put the load.

Were you ever able to solve this? I’ve exchanged my HX711 with another, but still a lot of drifting values…unable to use it in this way.

Actually I just swapped mine out with a new one last night. The first night I never went negative so that’s a plus. I’ll give it another few days and see if I can detect a useable pattern.

What type of board did you replace it with?

Similar HX711, but that was drifting as well…removed the bed sensor completely :frowning:

If there is drift I suspect that the load cells or the support is deforming during continuous load for the period of the night. I saw similar behavior when I had soft distances between cells and the floor. I’m till using the same setup as described in the first post, and have zero drifting during night:

So mine is doing waaaay better with the spark fun board and not the cheap aliexpress board.

Still seems to fluctuate a bit, but that could be because of my setup.

@pingme maybe try one of the spark fun boards, not cheap $18 with shipping I think for me.

I have solved the issue with these HX711 ADC boards. With all the HX711 board I have, the E- pin is not connected to GND but should be. Solder a wire between the two or otherwise connect E- to GND. That will make your bed scale a LOT more reliable and way less noisy.

Below is a graph of my load cells. On the left four HX711 board (1 per bed leg with 2 load cells each) but all ungrounded. Around 18:30 I soldered E- to GND for all sensors and connected them. The difference is night and day.

image

Connect E- to GND!

1 Like

Hi @johboh ,

Great topic. I have a question about the load cell and the way you mounted the foot on it. On the second picture it looks like you have to screws for mounting. Did you removed the metal foot part(drilled out) and screwed back the new plastic part?

I Googled a lot :slight_smile: , but i can’t find anybody who did replaced the foot part.

grtx,

Marcel

Hey!
The load cell is just resting in the 3D printed holder. I have not modified the load cell itself in any way. The plastic part on the load cell is part of the load cell (fastened with two screws). So the leg of the bed is just resting on this plastic part. The sides of 3D printed part is making sure the cell is always under the leg.

I’m another load cell project I replaced this plastic part with my own part that is part of a bigger plate.

1 Like

I love this!!! I just kept mine really simple though.

The only info I used there was what sensor and where to solder the two small wires…
I used a simple black load mat with an Aqara window sensor… [zigbee].

1 Like

Curious about the battery usage… I assume that the battery of the door sensor is used to power the mat?

Yes that’s correct. The battery lasts quite a while. Easy setup but I’m having trouble with mine because over time the mat compresses and no longer registers activity.

This is the one I’m going with → I have all the parts just have to build it :slight_smile: