Loading...
How To Guides

Building a bed occupancy sensor for Home Assistant

Building a bed occupancy sensor for Home Assistant

Recently after automating many of my lights with motion sensors (guide coming soon!) I found myself wanting a way to automatically switch everything off at night. The question was how to properly determine when my partner and I had went to bed for the night?

I started researching bed occupancy sensors and came across a great post from Zack at Self Hosted Home where he used an ESP8266, 4 load cells and a HX711 to build what is essentially a bed size weight scale to determine if someone was in bed or not.

However when I set about building this, I ran into a few issues that required my setup to be different:

  1. How to connect 3 wire load cells, there are a lot of cheap 3 wire sensors out there but much of the documentation is for a proper 4 wire setup. Although to be clear, the post above does use a 3 wire setup also.
  2. Load Cell drift – once I had the setup working, I found my values would slowly start to drift over the course of a day and I wanted a way to overcome that.
  3. Using an exact weight rather than raw scale values – Zack uses the raw scale values in his setup rather than a calculated weight. This works great for his setup but my sport means that my weight can intentionally fluctuate quite a fair bit. For this reason I wanted to use a calculated weight in KG rather than the raw value, to make tuning my setup easier.

I also 3D printed some holders for the legs of my bed which are a little bigger than normal, these hold the sensors in place and stop the bed sliding around on them which I found was happening and causing issues with my readouts!

Parts list

There are just 3 essential parts for this build:

  • HX711 Amplifier
  • Load Cells – Note a HX711 is included in this link, I tried this one but the SparkFun one is of better quality and less fluctuations. Your mileage may vary!
  • Wemos D1 Mini or other similar board, needs 5V output.

Optionally you may want to print some holders for the cells if you have a 3D printer available and depending on your setup. There are many designs available on Thingiverse.

Guide

Hardware setup

These load cells are essentially a series of resistors whose value changes when flexed, the resulting change in voltage can then be measured and transformed into scale readings.

We are going to be connecting the load cells in a full wheatstone bridge in this guide which uses 4 load cells, however it is possible to use 2. The wiring for this can be a little confusing on first glance.

Firstly identify the following connections on your HX711 board, E+, E-, A+, A- (sometimes A is called S so interchange these).

The easiest way to start out is to lay all 4 load cells out into a square shape with one in each corner. You will have an Upper Left, Upper Right, Lower Left and Lower Right. In a very basic sense, the white wires join horizontally, the black wires join vertically and the red wires go to the HX711.

Upper left should go to E+, lower right should go to E-, upper right should go to A+, lower left should go to A-.

Once you have that, we need to wire the HX711 to the our Wemos D1 Mini (or whichever board you are using). Wire the 5v output of your board to the VCC pin on the HX711, do the same with the ground pins. Then we take the pin labelled D4 on our board and wire it to the DAT pin of the HX711. Finally, RX pin of our board goes to CLK of the HX711. We are using pins 2 and 3 in our code which corresponds to D4 and RX on our ESP board (GPIO 2 & 3).

It should look like this:

Software

We are going to be using the HX711 library, found here on Github.

Go ahead and fire up Arduino IDE and set your board to the Wemos D1 Mini (or whichever you are using) – set your board speed to 74880 for the D1 mini otherwise you may get some weird characters which seems to be a known issue.

Go to Sketch > Include Library > Manage Libraries and search for HX711 and install it.

Next download both of the sketches from my Github for this project, located here.

Test run

At this point I’d highly recommend testing everything is working before going to any effort of mounting.

Go ahead and upload the “Scale Calibration” sketch to your board and open the serial monitor at 74880. After a few seconds, you should see the monitor start to output something that resembles the following:

Initializing scale calibration.
Please remove all weight from scale.
Place known weights on scale one by one.
Reading: 0.00kg
Calibration Factor: 2400
Reading: 0.00kg
Calibration Factor: 2400
Reading: 0.01kg
Calibration Factor: 2400
Reading: 0.00kg
Calibration Factor: 2400
Reading 0.00kg
Calibration Factor: 2400

If you are getting readings from the monitor then this should mean your setup is working. If you are not, check your wiring as per above and check the troubleshooting section below.

Put some pressure on the inner part of one of the load cells with your finger, you should then start to see values change:

...
Reading: 0.01kg
Calibration Factor: 2400
Reading: 0.00kg
Calibration Factor: 2400
Reading 0.00kg
Calibration Factor: 2400
Reading: 4.58kg
Calibration Factor: 2400
Reading: 4.02kg
Calibration Factor: 2400
Reading 4.27kg
Calibration Factor: 2400
...

Don’t worry about the actual values, we will calibrate properly later.

Mounting

Assuming you got readings as above, you should be safe to mount the hardware in its final position.

This part is obviously very person dependant, but I’ll show you how I mounted mine.

Originally I had tried a number of different 3D printed holders for the load cells, they all worked but I found due to the nature of the legs of the bed, that the bed would very easily slide around on top of them meaning that the values would change daily which was very frustrating when trying to get a consistent setup!

The other issue was when manually placing the sensors under the bed, it was hard to get them in the same position under the bed at each corner, so that one sensor did not have more or less weight on it than another corner.

So I spent 20 minutes 3D modelling some casters/holders for the legs of my bed, so that the sensors would always be in the same position and the bed was unable to move.

Here was what I came up with:

This design allows the legs of the bed to sit perfectly inside and allows for zero movement of the load cell, meaning each corner is weighted identically.

Once mounted, we can move onto calibrating the scale for your setup.

Calibration

To get the load cells calibrated for your setup, ensure there is no additional weight on the scales apart from what would normally be on there at a “zero weight” – duvet, pillows etc.

We can fire up the calibration sketch again and open the monitor at 74880.

  1. Allow the monitor to print the zero weight a couple of times, again this should be 0 kg or very close to it. Expect a little fluctuation, this is normal.
  2. Once this has settled, place a known weight on the scale, 5kg is a good weight to use. Observe the output on the monitor and see how close (or far!) it is from being correct.
  3. Adjust the “calibration_factor” variable in the code and re-upload – start by adjusting the factor with larger increments of say 500 till you start to get closer to the actual weight, then maybe 100 points then 10 points.
  4. Re-upload the code – don’t forget to take your known weight off each time. Keep repeating until you have an accurate reading.

Once you are happy with the reading, take note of your calibration factor, we will need it for the next section!

Bed Sensor

We can now take a look at the final sketch, the Bed Sensor.

Fire up the sketch, and open the change your view to the config.h file:

We need to change a few simple variables here:

  • SSID and Password – change these to your Wifi setup.
  • MQTT_Server – change this to the IP or hostname of your MQTT server.
  • mqtt_username and mqtt_password – change these if you have authentication enabled.
  • Calibration factor – change this to the value you obtained from the calibration steps in the last section.

You can optionally adjust the MQTT topics if you wish. These topics are for:

  • State topic: this is where the kg value will be published to, which will be picked up with Home Assistant.
  • State raw topic: I am also publishing the raw scale values to Home Assistant, these can be pretty useful for checking drift.
  • Availability topic: When the scale starts up, it will publish a message to this topic so Home Assistant knows it is online.
  • Tare Topic: The scale will subscribe to this topic, when it receives a message to this topic, it will tare (reset) the scale. Very useful for combating drift.

Upload the sketch to your board and open the monitor at 74880 speed. You should see it connect to your Wifi, connect to MQTT then it will tare the scale. Then it will start to output the weight and raw value every 3 seconds.

Once again, make sure that no additional weight is on the bed when powering on.

Place a weight on the bed again as a final test and make sure it is reading correctly.

Now we can finish our setup in Home Assistant!

Home Assistant

Open your configuration.yaml file and add a new entry:

sensor:
  - platform: mqtt
    name: "Bed"
    state_topic: "home/bedroom/bed"
    unit_of_measurement: "kg"
    availability_topic: "home/bedroom/bed/available"
  - platform: mqtt
    name: "Bed Raw"
    state_topic: "home/bedroom/bed/raw"
    unit_of_measurement: "raw"
    availability_topic: "home/bedroom/bed/available"

Reload Home Assistant and go into Dev Tools > States and see if you are getting information through:

Head back to your configuration file and we are going to make some template sensors based on these values. I am using Zack’s code here as it works well.

First we add some template binary sensors:

binary_sensor:
  - platform: template
    sensors:
      lewis_in_bed:
        friendly_name: "Lewis in Bed"
        value_template: >
          {{ states('sensor.bed')|float >= 70 }}
      she_who_must_be_obeyed_in_bed:
        friendly_name: "She who must be obeyed in Bed"
        value_template: >
          {{ states('sensor.bed')|float > 40
            and (states('sensor.bed')|float < 60
               or states('sensor.bed')|float >= 100 )}}

This does a couple of checks:

  • If the weight is greater than 70kg, Lewis is in bed.
  • If the weight is greater than 40kg, but less than 60kg, she who must be obeyed is in bed. Or if the weight is greater than 100kg, she is also in bed.

I found using a slight range works well.

Then we add another template sensor to calculate the number of people in bed, which is a great sensor to have when doing automations:

sensor:
  - platform: template
    sensors:
      num_in_bed:
        friendly_name: "Number of People in Bed"
        unit_of_measurement: 'people'
        value_template: >-
          {% if is_state('binary_sensor.lewis_in_bed', 'on') and is_state('binary_sensor.she_who_must_be_obeyed_in_bed', 'on') %}
              2
          {% elif is_state('binary_sensor.lewis_in_bed', 'on') or is_state('binary_sensor.she_who_must_be_obeyed_in_bed', 'on') %}
              1
          {% else %}
              0
          {% endif %}

Restart home assistant and check your dev states again.

Time to give it a test and see if the results are as expected. It will probably take a little tweaking to get it correct for your setup.

Next steps

Remote taring

If you find your setup is working, but the perhaps the values are drifting over the course of a day, or the scale isn’t always going back to zero after getting up in the morning, you can use the remote tare function.

One method is to create an automation which tares the scale everyday at midday:

automation:
  alias: Remote tare
  trigger:
  - at: '12:00'
    platform: time
  condition:
  - below: '1'
    condition: numeric_state
    entity_id: sensor.num_in_master_bed
  action:
  - data:
      payload: 'on'
      topic: home/bedroom/bed/tare
    service: mqtt.publish

This will reset the scale to zero everyday at midday, only if the number of people sensor is at 0.

Useful automations

A couple of really useful automations using this sensor are:

  • 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!

Troubleshooting

  • The vast majority of issues will be wiring related. If you are having issues I’d suggest double checking your wiring, then triple checking. Its very easy to make the slightest error which will cause the whole setup to not work correctly.
  • Ensure you are using 5v output, 3.3v will technically work, but it is not recommended and you won’t get great results if you don’t use 5v.
  • Ensure you are using the correct pins on your dev board. Do not make the mistake of thinking pin 2 and 3 in the code corresponds to D2 and D3 physically on the board. Look up the pinout and ensure you are using GPIO pins.
  • Check your voltages, if you have everything correct use a multimeter and measure volts across E+ and E- where you should get 4.3v. Then measure A+ and A- where you will get roughly half of that. If you are not, check your wiring again.
  • If you are getting readouts but they are in negative values, switch the E+ and E- wires around and that should correct the issue.
  • Solder and heat shrink your wires, they seem to be highly sensitive to interference so do everything you can to minimize this.

Let me know in the comments if you have any further issues or as always, what you want to see next!

43 comments
  1. Puneit Singh

    This is one of the most concise and well written guide on this topic. Bed occupancy sensor has been on my mind of an year and your guide helped me make the purchase for the hardware required.
    I would make a tiny suggestion .. please link to the arduino code and also share your STL files. It will really help to make it one stop guide for the whole thing.

    If you have done other cool stuff, please share. Really enjoyed the flow of your guide. Thank you

  2. Lewis Barclay

    Thanks, glad you enjoyed it! I have linked the code, please find the code on Github. I didn’t share the STL files because it would only fit my bed.

    Please see my other how to guides, more coming soon!

  3. Morten Mortensen

    Very well written walk-through of your bed sensor project, thanks a ton for sharing it. πŸ™‚

    How does the 3D printed load-cell holders hold up to the pressure over time, I’ve noticed that there is a dimple on top of the load-cell that it used to concentrate / centre the load, does that not dig into the top cover of the 3D box you printed?

    Or maybe that’s not a concern and just me over-thinking it? πŸ™‚

    1. Lewis Barclay

      Thanks, glad you enjoyed it!

      They actually hold up very well! The dimple is actually flush with the rest of the casing, so that’s why I didn’t have concerns since the outer rim takes much of the strain. I hope that makes sense. the nature of this makes it hard to photograph!

  4. mike

    ” I found myself wanting a way to automatically switch everything off at night. ”
    Uhhh….. every try “Hey alexa, turn off lights.”

    1. Lewis Barclay

      A few issues with that approach:

      Not everything integrates with Alexa
      There is more to automation than just lights
      I only have one Alexa at the moment which is located downstairs, if I were to turn off all the lights, I can’t see to go upstairs

  5. fabian

    First of all: nice project and thank you for sharing! I was wandering how accurate the load cells can be when exceeding their max load. My bed has a wooden frame and a quite heavy mattress – I guess the empty weight would well exceed 100kg maybe even 150kg. Would the approach with 4x50kg load cells still be feasible or should I look for 100kg cells. After all I am not interested in measuring my weight but only in determining the occupancy state of the bed.

    1. Lewis Barclay

      Thank you!

      I had the same concerns and to be completely honest, I am unsure on that one! I personally think it will work fine as an occupancy sensor even if the weight is over 200kg so I think you will be fine. If you needed it to be 100% accurate I would not recommend it but since you don’t, I think you would be good to go!

  6. Rick

    Thanks for this very detailed guide !

    I have 0 experience with electronics and this motivated me to venture into my first diy electronics project !
    Got all the parts except for the HX711 board, which is a different version from the one you are using :
    https://c.76.my/Malaysia/load-[email protected]1.jpg

    Mine has DT and SCK instead of DAT and CLK, can you please help with how to wire this one to the Wemos D1 board ? I followed the scheme and replaced DAT and CLK directly with DT and SCK but it doesn’t work like that, so I guess it needs some changes .

    Totally lost here, spent a good 2hours soldering everything together and I managed to get to Wemos D1 sketch part but was not getting any readings .

    Thanks

    1. Lewis Barclay

      Hey Rick,

      That’s great to hear you got started with this!

      I’m pretty sure you have DT/DAT and SCK/CLK wired correctly, so you might want to check elsewhere. You can try and reverse DT and SCK (I have seen some boards where they are labeled incorrectly) so give that a try, you won’t break anything. Which pins have you wired to on the Wemos side?

      Also check you are getting voltage between E+ and E- and between A+ and A-, I think it should be around 5v and 3.3v respectively if I remember from the top of my head!

      Hope that helps a little.

  7. Rick

    Hi Lewis,

    Thanks for your fast reply !

    On the Wemos I have tried with both D4 / RX from your guide and D1 / D2 (changed the gpio in your sketch to match those) and in both cases I did not get any readings .

    Just tried checking voltages with my multimeter and I am getting a hard time registering any values but after a lot of fiddling around I managed to read 3.8V on E+ / E- (although many times it reads smaller values and most of the times I can’t get any readings at all) and on the A+ / A- the maximum voltage I was able to see was 1.2V so the problem might be there ?

    It’s strange though because my continuity test shows that all the solderings from the wires connecting the cells between each other are ok .

    Will give it a try with the DT / SCK change but now that I got these low voltage readings the problem is probably related to it .

    1. Lewis Barclay

      Hey Rick,

      OK sounds like you have made a little headway!

      Are you using the 5v supply from the Wemos I assume?

      Do you want to drop me an email (lewis”at”everythingsmarthome.co.uk, some photos of the setup would be great!) and I’ll do my best to help!

      Lewis

  8. Nick

    Any help you could provide would hugely appreciated. This could really help with my sleep disorder.

    How do I tell if a wemos has a 5V output? Could you provide a link to one you reccomend.

    Also, will it matter if the weight on my bed is not evenly dispersed? The bed is really heavy, has 5 points of contact, and the headboard is much heavier than the footboard.

    Also, do you have any recommendations for sensors that detect room presence. I need to detect what times I enter and leave several rooms in my house.

    Thanks in advance.

    1. Lewis Barclay

      Hey Nick,

      The Wemos D1 Mini is a great board for this application and has 5v, it’s what I used. You will find the link above!

      No it shouldn’t matter if the weight isn’t dispersed evenly as each sensor is taken into account individually.

      I haven’t tried them myself (yet!) but you could look into something like a thermal image sensor might work well!

      Thanks,
      Lewis

  9. Lipown

    Thanks for the guide! The sensors arrived and I tested it. Firstly all to breadboard and it seemed to work fine but the values were negative and if I put some weight on to it, it risen towards zero so I calibrated it acc. to it. It worked. I put it under bed. Worked quite fine for 20 minutes. Even the values were above zero, so Irecalibrated it accordingly.

    I need to emphasize that I am using it on Weemos D1 mini with ESP Home, not your script.

    – I tried some jumps on the bed and it froze on big value. Somehow after few minutes it went back to working normal but after half an hour it stuck on same big value and that stayed all the night.
    – I have the sensors on double bed, am I damaged them or is there maybe only a contact issue?
    – Is there a way to found out which out of four is damaged/have bad contact? Any idea please?

    1. Lewis Barclay

      Hi there,

      Glad you got it working!

      I’m really not sure to be honest, I haven’t used esphome with this so maybe an issue there? Might be worth trying the above code and seeing if that works first and if you can re-produce the error, then you will know where the problem lies, software or hardware!

  10. Lipown

    I feel very sorry for disturbing you. It was a cable. Took me a couple of hours to investigate. I just found your 3D model on the thingiverse. Is there a litle space between the upper and lower part so the sensor might spread or how is it actually working please? Thanks!

    1. Lewis Barclay

      Glad you figured it out!

      That section of the model isn’t mine, the model just holds the sensor in place and provides a flat bed to place things on. Hope that helps!

  11. Steve

    I just finished installing something based off this πŸ™‚ It worked well, thanks. you helped a great deal there.

    The One problem I had was that I wasn’t getting a reading with the bed on the sensors. I think it’s because the cases I printed for the sensors was taking the whole weight. So I put a 2p coin on top of each (being smaller than the flexible bit of the case) and it started registering properly.

  12. Uros

    Hello
    First great job with this torial.
    But I have problems. I dont get more then 0,5v on e+ and e- and i tray 3pcs of hx711 and on all 3 is the same. I’m usind d1 mini and esphome. I check the load cells and they work ok if i conect 5v direct on cells and measuring voltage on the oder side of bridge i get up to 5mv if i push all cells down.
    I the voltage from e+ and e- controled by the software or the hx711 do the job.

  13. Sam Hoyt

    I used your guide to install this on my bed last weekend, and it works great. My bed has posts on the slats underneath, so they hold some of the weight. This does mean the weight reading isn’t accurate, but it still reads consistently enough that I can use it.
    Thanks for putting this together. It made the job really easy.

  14. Sam Hoyt

    One of the best things I’ve done with it so far is I set up an alarm to wake me up in the morning. It starts going off at the time I set, and the only way to turn it off is to get up. If I get back in bed before the time I’m supposed to be at work, it starts going off again.

  15. andilge

    Hi Lewis,

    Thnx for this detailed and interesting post, the amount of feedback shows where a lot of us are going to.

    I’m about to roll this off at my home as well but I’m hesitant about the sensors for 2 things.
    – I don’t have a 3D printer and the printed holders look like a show stopper to me.
    – Since the topic is not really measuring my wight the sensors are probably over precise.

    What about using seat occupancy sensors that are in every car? They are build to support human weight, it’s possible to install them (one per person, not 4 per bed) on the slatted frame instead of the 4 feat. This would dramatically facilitate the installation, wiring becomes easier (like binary switches), cleaner installation where cables can be hidden better and no need for the individually printed holders.

    Here an example sensor if you don want to tear it out of your car
    https://www.aliexpress.com/item/4000517283911.html?spm=a2g0o.productlist.0.0.73aa46bedkMn4W&algo_pvid=7502ec79-5c07-46ce-8356-5823e197336e&algo_expid=7502ec79-5c07-46ce-8356-5823e197336e-0&btsid=1cca751a-f429-42df-bb59-ba7296c4ed20&ws_ab_test=searchweb0_0,searchweb201602_6,searchweb201603_53

    1. Lewis Barclay

      Hey, thanks for the comment and feedback, glad you liked the post!

      That’s a pretty interesting sensor, thanks for sharing, I had not thought about that before!

      The only issue I can see is that because it cannot detect weight, it would not be suitable for 2 people since there is no way to tell if 1 person or 2 people are on the bed!

      I understand the issue with the 3d printer, it would be good if there was another solution! Tiny wooden casters maybe?

      Thanks,
      Lewis

  16. Nate

    Hey there! I’m glad I finally ran into your post – this is a project that I’ve been working on intermittently over the past year.

    I have the exact same load cell – is it a half bridge load cell? How would I use it with just two load cells? Any tips on wiring?

    The reason I want to use just two is that I can’t quite figure out how to connect all 4 legs of my bed without splicing additional length of wiring on the load cells, which I want to avoid.

    1. Lewis Barclay

      Hey Nate! I’m glad you liked it!

      2 load cells should be fairly simple but I haven’t tried it in “production” so I don’t have any tips on the wiring.

      I have seen this post before which looks correct to me, hope it helps (very last post from Wawa):

      https://forum.arduino.cc/index.php?topic=546892.0

      The rest of the guide should be the same once you get it reading. Please do let me know if it works or how you get it to work, I’d love to add that information to the post!

  17. Bob

    Hi Lewis,

    Well done, your instructions are clear, and it works well at the test ‘setup’ with a wooden ‘shelf’. Next step should mount it under my bed. Hope the WAF (Wife Acceptance Factor) is high enough to get it working for that goal πŸ™‚

    Although, one problem still exist. I adjusted the calibration factor to 2386.
    It shows my weight in Home Assistant 10 times higher; 2 kg is 20 kg.

    Should I adjust the bed_sensor script?

    1. Lewis Barclay

      Hi,

      Glad you got it working! Yes you just need to adjust the bed_sensor sketch with the calibration factor you worked out in the calibration sketch. This is the intended way to do it!

      Hope that helps.

  18. Pablo

    Hi Lew, first of all thanks for this guide!

    I mounted the bed sensor with your guide and it seemed to work properly, weight values ​​are very precise but after few minutes freezes and I only can fix it rebooting sensor. Something similar happened to another user (Lipown) and in his case the problem came from a cable but he didn’t say which was. What should I do?

    1. Lewis Barclay

      Hi Pablo,

      I would start by replacing the power (USB) cable to see if that helps. Double check all your wiring, have you soldered all connections?

      Let me know how you get on!

  19. Pablo

    Hi Lewis! First thanks for your reply!

    Yesterday I replaced the wiring between Wemos and HX711 and issue remains (now I think the problem occurs a little earlier). I have found that if I don’t put on weight everything works correctly but it stays frozen within a few minutes of loading weight.

    I have a 5V-2A mobile charger connected to the Wemos and today I will replace it to see if the problem persist, I will also check volts across E+ and E- as you said in troubleshooting section. On the other hand, do you think the issue can be caused by bad wiring between load cells?

    Thanks!!

  20. Pablo

    Hi! I think I resolved the issue! First, I changed USB cable and the power supply (phone charger) by another one and sensor became more stable, it stays online all night without any problem. Nevertheless, after one day sensor freezes another time (I think due to lack of communication with MQTT server). Then I soldered a Wifi antenna to Wemos D1 and it has worked until today without problems.

    Thanks!!!

  21. Jan

    Hi Lewis,

    Great project! Just connected the load cells to a Wemos D1 Mini and uploaded the Scale_Calibration sketch. Seeing some readings in the Serial Monitor, but when pressing on a load cell, it keeps 0.00 kg. When seeing the ‘Reading: 0.00 kg’, I guess the loadcells are connected the right way?

    12:32:21.373 -> Reading: 0.00 kg
    12:32:21.373 -> Calibration factor: 2400
    12:32:24.789 -> Reading: 0.00 kg
    12:32:24.789 -> Calibration factor: 2400
    12:32:28.202 -> Reading: 0.00 kg
    12:32:28.202 -> Calibration factor: 2400
    12:32:31.604 -> Reading: 0.00 kg
    12:32:31.604 -> Calibration factor: 2400

    1. Lewis Barclay

      Hi Jan,

      I would certainly suggest checking the wiring, if you are getting zero readings it may be that the wiring to the HX711 board is correct, but the wiring from the load cells to the HX711 board is not. I would suggest double checking. Does the raw value change?

      Let me know!

  22. Jan

    Hi Lewis,

    Even though I’d checked the wires several times, the problem was there. Reconnected everything again, and now it’s working. Great!

    Another question: Is it possible to make the Wemos reconnected to the MQTT broker when the MQTT broker is restarted and offline for a short period of time?
    After restarting the Wemos, it connects to the MQTT broker, but it would be nice if restarting the Wemos is not necessary.
    I’m using Mosquitto MQTT broker as a Home Assistant add-on, so restarting HA after an update, makes the MQTT broker restarting as well.

Leave a Reply

Your email address will not be published. Required fields are marked *