Coder Social home page Coder Social logo

andrewjfreyer / ha-dog-bowl-sensor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matthewjselby/ha-dog-bowl-sensor

1.0 0.0 0.0 1.05 MB

A sensor to measure how much water is left in your dog's bowl and report to Home Assistant (via MQTT)

License: MIT License

Python 100.00%

ha-dog-bowl-sensor's Introduction

๐Ÿ’ง๐Ÿ• Home Assistant Dog Bowl Water Level Sensor

Measures how much water remains in your dog's bowl and reports to Home Assistant for all your automation needs.

Materials

You'll need the following to build the sensor:

Item Quantity
Raspi Pico W 1
3D printed base 1
M5 x 12 mm screw 2
TAL220B Load Cell 1
HX711 Load Sensor Amplifier (any HX711 board will do) 1

3D Printing

You'll need to 3D print the top and bottom of the scale. I recommend printing with PETG since the scale body might get wet while in use.

STLs

STL files are included in the body folder for the top and bottom of the scale. The scale top has a diameter of 180 mm. If that is too big or small for your dog's bowl, you'll have to modify the model.

Fusion360

A fusion360 model is also located in the body folder. The model has a user parameter ScaleDiameter that can be changed to suit the size of your dog's bowl.

Construction

  1. Wire up the Raspi Pico W and the HX711 load sensor amplifier as shown below:

wiring image

  1. Assemble the scale by inserting the load cell between the scale bottom and the scale top and securing with the M5 screws:

construction image

Programming

  1. Set up an MQTT Broker with Home Assistant (e.g., the Mosquitto add-on).
  2. Install Micropython on the Raspi Pico W. Instructions here.
  3. Fill out WiFi SSID, WiFi password, MQTT server (or IP address), MQTT username, and MQTT password in secrets-template.
  4. Rename secrets-template file to secrets.
  5. Mount Raspi Pico W as flash drive on computer. Put main.py and lib folder on the Raspi Pico W. You can also open in VSCode and upload to the board with the Pico-Go extension.

Calibration

  1. First, get the raw value of the scale with nothing on it (you can use the Raw value output in the serial console when nothing is on the scale). Replace loadCellZeroValue in the config variable section with this value.
  2. Next, get the raw value of the scale with something you know the weight of in grams (you can weigh something with another scale). The calculate loadCellScalingFactor according to the following formula: loadCellScalingFactor = knownWeight / (scaleRawValueWithKnownWeight - loadCellZeroValue). Replace loadCellScalingFactor in the config variable section with this value.
  3. Finally, get the scaled value of the scale with your dog's bowl on it (you can use the Scaled value output in the serial console when your dog's bowl is on the scale). Replace emptyBowlWeight with this vaulue in the config variable section with this value.

Home Assistant

The sensor will be automatically added to Home Assistant via MQTT discovery.

Credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.