thedaviddias / mqtt-bed-sensor

MQTT based bed sensor with remote tare function.

Home Page:https://everythingsmarthome.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mqtt-bed-sensor

MQTT Bed Sensor/Scales for bed occupancy (although entirely adaptable for anything), for integrating with Home Assistant, OpenHAB, Domoticz and anything else supporting MQTT.

Has remote tare function which you can issue over MQTT if your sensor suffers from drift which many load cells seem to. This saves having to re-start the device everytime you want to tare.

Full guide available here

Requirements

Hardware

Libraries

  • HX711 library - available through Arduino IDE library manager
  • PubSubClient library - available through Arduino IDE library manager
  • ESP boards

Use case

This was built specifically with bed occupancy in mind so that automations can be triggered when in bed such as switching lights off, locking doors, setting alarms etc etc using Home Assistant. I found that load cells seem to "drift" a little over time, with this in mind a remote tare function was built in so that I can issue a tare command over MQTT which will reset it to zero without having to physically reset the device everytime.

Calibration

  1. Load calibration sketch and ensure no additional weight is on the bed/scale
  2. Using serial monitor, observe starting measurements
  3. Place known weight on bed/scale e.g 5kg and observe new measurements printed on monitor
  4. Adjust calibration factor variable and repeat steps till values are correct. Take note of calibration factor

Bed sensor

  1. Load sketch, ensure no additional weight is on the scales
  2. Fill in all variables in config.h file
  3. Observe output on serial monitor, place known weight on scales and ensure read-out is correct.
  4. Once happy, unplug and plug into main power supply and enjoy!

Need help?

Join the community on discord:

Support

If you would like to support this project and many more like it, please consider supporting me so I can keep delivering more projects just like this one:

Credits

The original idea for this has been adapted from Zack over at Self Hosted Home's original build, so big thanks to him!

About

MQTT based bed sensor with remote tare function.

https://everythingsmarthome.co.uk

License:GNU General Public License v3.0


Languages

Language:C++ 85.5%Language:C 14.5%