กลับไปหน้ารวมไฟล์
automatic-pet-water-dispenser-and-consumption-monitoring-bb621f-en.md

The objective of this project is to monitor water consumption of a pet, send an alert when a pet is not consuming enough water and have its water bowl filled automatically when it is low. The water can also be refilled remotely by the caregiver from a dashboard. The water consumption status is indicated by detecting if a pet is drinking using a motion sensor and measuring the water level before and after drinking using an ultrasonic sensor. When drinking motion is detected, the ultrasonic sensor stops sensing until the drink is complete. The water consumption data is sent to ThingsBoard through MQTT. This includes the consumption amount of each drink, total consumption for the day, and the number of drinks taken that day. After 24 hours, the total daily consumption is sent to ThingsBoard through MQTT. If it is below a threshold, showing that a pet has not had much to drink, an email is sent to the caregiver. The collected data can then be analyzed by a machine learning algorithm to detect more complex anomalous drinking behaviours and indicate the health status of pets. A servo motor is used to control a water dispenser to fill water automatically. The servo motor can also be controlled through a dashboard. This ensures a pet always has access to water.

The project uses Arduino Cloud and ThingsBoard. Arduino Cloud is used as an IDE where we write code and upload code to MKR1000. ThingsBoard is used for data collection, actuator control, and sending notification to users. To implement MQTT communication between MKR1000 and ThingsBoard, we must first specify the broker, port, topics and username. To send data to the dashboard, we first create several charts to visualize and store the collected data. To control the actuator, we create an RPC widget in ThingsBoard.

In addition to collect data and control actuator, ThingsBoard is used to setup email notifications to users when their pets don’t consume enough water. Email notifications are sent by following this tutorial: https://thingsboard.io/docs/user-guide/rule-engine-2-0/tutorials/send-email/

Hydration Monitoring

This smart pet bowl ensures your pets always have fresh water while tracking their health via consumption data.

  • Level Sensing: Uses a Non-contact Water Level Sensor or a HC-SR04 Ultrasonic sensor to monitor the water depth. When the level drops below a threshold, the Arduino triggers a Peristaltic Pump to refill the bowl from a reservoir.
  • Weight Measurement: For precise consumption tracking, the bowl sits on a Load Cell (HX711). By measuring the weight before and after the pet drinks, the system calculates the exact volume consumed.

IoT & Cloud Reporting

  • ThingsBoard Integration: The data is sent via WiFi (using an ESP8266/ESP32) to the ThingsBoard platform.
  • Analytics: Owners can view graphs of their pet's water intake over days or weeks. Automated alerts can be set to notify the owner's phone if a sudden drop in consumption is detected, which could indicate potential health issues.

The code flow is illustrated in the chart below.

Code Flow Chart

The following video show the device detecting drinking, calculating consumption and automatically refilling the water bowl.

*General Functionality of Automatic Water Dispenser*

Below shows the ThingsBoard dashboard that collects and displays data from the automatic water dispenser. The blue button turns the water pump on and off to manually fill the water bowl. The three gauges display the current total consumption, drink count and fill count for that day. The subsequent charts contain alarms, consumption data, water distance data, daily consumption, and a table of the real-time data being sent from the Arduino board.

ThingsBoard Dashboard

This video shows the consumption data being calculated and published through MQTT to the ThingsBoard dashboard.

*Consumption Data being Sent to ThingsBoard Dashboard*

Zooming in on the dashboard data, the distance and consumption charts were collected for almost two days. In the distance chart, shown in the following image, the larger the distance, the emptier the water bowl. It can be seen how it is filled automatically before 12:00. The water level continued to go down throughout the day as the pet drank water. Around 11:00 pm it was manually filled before going to bed. The water level stayed steady overnight and then began to increase in the morning as the pet drank.

Water Distance Chart

The chart below shows consumption data. Each blue bar shows how much the pet drank at a specific time. The first bar was captured in testing, when the bowl was manually emptied.

Consumption Data Chart

ThingsBoard is also used to manually control the water pump. This is shown in the following video.

*Remotely filling water bowl*

An alarm was configured to send an email notification if daily consumption was below 500mL. The dailyconsumption is only published after every 24 hours. Our tests successful ran for 24 hours and published the daily consumption to Thingsboard, but it was not below the threshold. To test the threshold and email functionality, MQTTBox was used to publish a daily consumption below threshold.

MQTTBox Test

This was received by ThingsBoard:

Data in ThingsBoard

An alarm was updated on the dashboard:

Alarm on Dashboard

Finally, an email was recieved by the caregiver and notified of the daily water consumption amount.

Email Notification

The following tutorials were useful in the development of this project:

Getting Started with ThingsBoard: https://thingsboard.io/docs/getting-started-guides/helloworld/

Setup ThingsBoard RPC widget: https://thingsboard.io/docs/user-guide/ui/widget-library/#rpc-control-widget

Sending Notifications: https://thingsboard.io/docs/user-guide/rule-engine-2-0/tutorials/send-email/

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x ThingsBoard"
author: "soehlcom"
category: ""
components:
  - "1x SG90 Micro-servo motor"
  - "1x Arduino MKR1000"
  - "1x Drill / Driver, Cordless"
  - "1x Accessory, Screw"
  - "1x PIR Motion Sensor (generic)"
  - "1x Push button water dispensor"
  - "1x Fasteners (generic)"
  - "1x Ultrasonic Sensor - HC-SR04 (Generic)"
description: "Monitor consumption, send an alert when a pet is not consuming enough and have the water bowl filled automatically or remotely by user."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://create.arduino.cc/editor/soehlcom/e84b4a9d-6692-4961-99fc-f7a08ad0936a/preview"
  - "https://create.arduino.cc/editor/soehlcom/e84b4a9d-6692-4961-99fc-f7a08ad0936a/preview"
encryptedPayload: "U2FsdGVkX19c1V8JKAiklZEzF9d0qgcoYvPEdsLcJeQHJ9lpAxfmvdUMHmgRjIzOV3hRX45rF8IsOiT9Y4tEqbPBDbZgfn7a1W8dHLIJmsU="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/automatic-pet-water-dispenser-and-consumption-monitoring-bb621f_cover.jpg"
lang: "en"
likes: 1
passwordHash: "a118a4d145661d96706e3ff946b7e80bb87493512f18b197f9ddf73d6b500a8c"
price: 2450
seoDescription: "Arduino Automatic Pet Water Dispenser with consumption Monitoring, alerts, and remote or Automatic water filling."
tags:
  - "iot"
  - "dashboard"
  - "mqtt"
title: "Automatic Pet Water Dispenser and Consumption Monitoring"
tools: []
videoLinks:
  - "https://www.youtube.com/embed/2fbQAukCkdc"
  - "https://www.youtube.com/embed/EwFMiNMK2zE"
  - "https://www.youtube.com/embed/o9DQFbq2fYM"
views: 3684