Home IoT Hub Series · 18
[Part 18] Is the dog bowl empty? HX711 food-remaining measurement node
Use an HX711 load cell to estimate remaining pet food in a bowl.
This node measures remaining pet food using an HX711 load cell. It is a good example of converting a physical weight into a hub slot.
Mechanical mounting matters more than code here. The bowl platform must press the load cell consistently without rubbing the frame.
![[Part 18] Is the dog bowl empty? HX711 food-remaining measurement node hero image](/iot-lab/assets/pet-bowl-load-cell-hero.png)
This article is part of the Home IoT Hub system connected to the central NodeMCU server built in Part 2: Building the Brain. The HX711 load-cell node reports remaining food weight and connects low-food state to hub alerts. The collected data is sent over the local
IoT_Hub_Net network and updates slot 20 for pet bowl weight on the central server (/set?no20=value), becoming part of the decision pipeline for the 20-channel smart-home controller.Parts and cost
| Part | Qty | Unit price |
|---|---|---|
| Wemos D1 Mini | 1 pc | $1.50 |
| HX711 + load cell(5kg) set | 1 set | $2.20 |
| Jumper wires 4 pc | — | — |
| Total | $3.60 |
Pin wiring
| Sensor / module | Board pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| DT | D1 (GPIO5) |
| SCK | D2 (GPIO4) |
Full code
#include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <HX711.h> const char* ssid = "IoT_Hub_Net"; const char* password = "iothub1234"; const char* hubURL = "http://192.168.1.1"; #define DOUT 5 // D1 #define CLK 4 // D2 #define SLOT_NO 20 #define THRESHOLD 50 // 50 g or less means warning #define INTERVAL 10000 HX711 scale; void setup() { Serial.begin(115200); scale.begin(DOUT, CLK); scale.set_scale(2280.f); // calibration factor, adjust after measurement scale.tare(); // tare current weight to zero WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.print("Connecting to IoT_Hub_Net"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("\nConnected!"); Serial.println("Pet Bowl ready. Tare done."); } void loop() { float weight = scale.get_units(5); // 5note if (weight < 0) weight = 0; Serial.print("Pet Bowl: "); Serial.print(weight, 0); Serial.print(" g"); if (weight < THRESHOLD) Serial.print(" REFILL!"); Serial.println(); WiFiClient client; HTTPClient http; String url = String(hubURL) + "/set?no" + String(SLOT_NO) + "=" + String((int)weight); http.begin(client, url); int code = http.GET(); http.end(); Serial.print("HTTP "); Serial.print(code); Serial.print(" -> "); Serial.println(url); Serial.println(); delay(INTERVAL); }
Upload and check
Connect the Wemos D1 Mini to the PC with a USB data cable, select the ESP8266 board and port in the Arduino IDE, upload the sketch, then open Tools → Serial Monitor and set the baud rate to 115200.
Serial Monitor
After uploading, open Tools → Serial Monitor in the Arduino IDE and set the baud rate to 115200. The following is an example Serial Monitor flow for checking normal operation. This is not a real screenshot. It shows load-cell calibration, stable-window filtering, and slot 20 updates.
[BOOT] Home IoT Node #18 - Pet bowl load cell [CAL] HX711 tare=complete, scale=2280.0 [SENSOR] raw_weight=164.2g stable_window=10 [FILTER] eating_motion=NO, outlier=PASS [HTTP] GET /set?no20=164.2 [HUB] 200 OK - slot no20 updated [LOOP] send only when stable for 5 minutes
- If
Connectedorconnectedappears, the Wi-Fi step passed. - If
HTTP 200or200 OKappears, the value reached the brain server. - If the value does not update, check both the slot number in the URL and the sensor wiring.
Build notes
- Calibrate with a known weight, then put the bowl on the platform and check whether the value changes smoothly.
- Power on the hub brain first so the node can join
IoT_Hub_Net. - Use the same slot number written in the source code.
- Open the serial monitor at 115200 baud and confirm
HTTP 200. - If the value does not appear on the hub, recheck wiring, GPIO number, and Wi-Fi connection.
Using and Installing a Pet Bowl Weight Sensor
Placing an HX711 and load cell under your dog's bowl turns it into more than a 'refill me' alert; it becomes a small guardian of your pet's health. Here we focus not on wiring or code, but on how to use it and where to install it.
Troubleshooting checkpoints
The node code can look short, but real home installation is affected by placement, power, Wi-Fi quality, and sensor noise. Check these points before letting the node become a decision input for the brain server.
| Symptom | Likely cause | Field fix |
|---|---|---|
| Values jump while the dog is eating | Licking and pushing the bowl creates impact and vibration | Treat changes above 50 g/s as eating activity and send only the average after 5 minutes of stability. |
| An empty bowl is not 0 g | Load-cell zero drifts with temperature and mounting stress | Run no-load tare at boot, add periodic tare if safe, and clamp negative values to zero. |
| Weight changes depending on bowl position | The platform does not transfer force evenly to the load cell | Use a rigid top plate and adjust spacers so the load is applied in the intended measurement direction. |
| Values spike during Wi-Fi transmission | HX711 microvolt signals are affected by power and board noise | Keep signal wires short, measure after power stabilizes, and separate sampling from HTTP transmission timing. |
Practical Uses
- Food-level alerts: When the weight drops below 50g, the hub signals 'refill needed', so you never miss an empty bowl while out.
- Intake and appetite monitoring: Logging the difference between the day's starting and ending weight gives a graph of actual consumption. A sudden drop can be an early sign of illness or stress, helping you decide when a vet visit is warranted.
- Multi-pet feeding management: A sensor per bowl reveals who eats how much, making it easier to manage obesity or picky eating.
- Auto-feeder integration: When weight falls below a threshold, the hub can tell the feeder to dispense once, creating a closed-loop automatic feeding cycle.
Recommended Placement
- Flat, firm floor: Carpets and mats spread the load and make readings jump. Tile or a rigid board is best.
- Center the load: Keep the bowl's weight over the load cell's center to reduce error.
- Avoid vibration sources (washers, entryways) and walkways where the bowl gets kicked.
- Water-bowl use: The same setup can sense water level for a 'refill water' alert.
Field Tips and Cautions
- Tare: Zero the scale with the empty bowl in place; the bowl's weight cancels out and you read only the food.
- Calibration: Set the scale factor with known weights like 100g or 200g for accurate grams.
- Temperature drift: Near windows or floor heating, readings slowly wander; choose a temperature-stable spot.
- 4-wire load cell colors: Usually red (E+), black (E-), green/white (A+/-). If colors differ, check the datasheet.
- Impact handling: When a dog nudges or noses the bowl, values spike momentarily. Averaging several readings cuts false alarms.
FAQ
Q. Do I reconfigure when I change bowls? Different bowls weigh differently, so just re-tare. Keep the same calibration factor.
Q. Readings keep drifting slightly. That's temperature drift or floor wobble. A stable location and averaging fix it.
Q. Is a damp area okay? Load cell contacts and the HX711 dislike water, so use a waterproof case and keep distance from the water bowl.
This article is part of the 20-channel Home IoT system built from the Part 2 central brain server and the distributed edge nodes in Parts 3-19. Use this map to check the slot and sensor flow across the series.
[Part 1] Home IoT Hub overview[Part 2] Central brain server · slots 1-20[Part 3] Stop guessing room comfort · slots 1/2[Part 4] Did I close the door? · slots 9[Part 5] Is the fridge really cooling? · slots 12[Part 6] Should I open the window? · slots 3[Part 7] Stop bathroom mold before it starts · slots 19[Part 8] Is the boiler actually running? · slots 5/17[Part 9] Did I leave the gas stove on? · slots 6[Part 10] Get warned before gas smell becomes obvious · slots 7[Part 11] Catch flame signs while away from home · slots 8[Part 12] Is bad air making you foggy? · slots 13/14[Part 13] Why is the power bill so high? · slots 15[Part 14] Is water leaking, and how much are we using? · slots 16[Part 15] Do not leave windows open in the rain · slots 18[Part 16] Are the lights off and the door locked? · slots 11/10[Part 17] Control the air conditioner from the IoT hub · slots 4[Part 18] Is the dog bowl empty? · slots 20[Part 19] Cool the room only when someone is there · slots 1/4[Part 20] The house finally fits on one screen · slots all