This shows you the differences between two versions of the page.
iothings:proiecte:2022:remote_fish_feeder [2023/01/17 20:31] andreea.pietricica Remote fish feeder and aquarium water monitoring |
iothings:proiecte:2022:remote_fish_feeder [2023/01/20 00:33] (current) andreea.pietricica |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Remote fish feeder and aquarium water monitoring ==== | + | Student: Pietricica Andreea-Catalina |
- | === Project description === | + | ACES Master |
+ | |||
+ | ====== Remote Fish Feeder and Aquarium Water Monitoring ====== | ||
+ | |||
+ | ===== Project description ===== | ||
+ | |||
+ | **Gitlab Code** : https://gitlab.com/AndreeaP/iot_fish_feeder/-/tree/main/ | ||
+ | |||
+ | **Web application**: https://aquarium-fish-feeder.web.app/ | ||
+ | |||
+ | **Demo**: [[https://ctipub-my.sharepoint.com/:v:/g/personal/andreea_pietricica_stud_etti_upb_ro/EXzTKU1CGjdBknyXPioWtRQBdFk-pExpJcn7SH3EXTUaYw|Fish Feeder Video]] | ||
The purpose of this project is to develop a simpler solution for aquarium maintenance using IoT devices. It has three features: | The purpose of this project is to develop a simpler solution for aquarium maintenance using IoT devices. It has three features: | ||
Line 15: | Line 25: | ||
{{:iothings:proiecte:2022:acvariu.jpeg?500|Project final result}} | {{:iothings:proiecte:2022:acvariu.jpeg?500|Project final result}} | ||
- | === Hardware description === | + | ===== Hardware description ===== |
== Components == | == Components == | ||
Line 34: | Line 44: | ||
== Putting it all together: == | == Putting it all together: == | ||
{{:iothings:proiecte:2022:schematic.jpg?500| Project schematic}} | {{:iothings:proiecte:2022:schematic.jpg?500| Project schematic}} | ||
+ | |||
+ | The schematic was created using Fritzing program. | ||
+ | |||
{{:iothings:proiecte:2022:whatsapp_image_2023-01-11_at_20.20.49_9_.jpeg?500|Project physical implementation}} | {{:iothings:proiecte:2022:whatsapp_image_2023-01-11_at_20.20.49_9_.jpeg?500|Project physical implementation}} | ||
*Note: The purpose of the Arduino UNO board from this image is only for supplying a constant 5VDC voltage. | *Note: The purpose of the Arduino UNO board from this image is only for supplying a constant 5VDC voltage. | ||
- | === Software description === | + | ===== Project functionality ===== |
* The web page | * The web page | ||
{{:iothings:proiecte:2022:site.jpg?700|Web page}} | {{:iothings:proiecte:2022:site.jpg?700|Web page}} | ||
Line 54: | Line 67: | ||
{{:iothings:proiecte:2022:feed.jpg?300|Database feed field}} | {{:iothings:proiecte:2022:feed.jpg?300|Database feed field}} | ||
- | The value from servo/feed field from Firebase can be a number between 1 and 10, meaning the number of fixed quantities of food to be released. After one release, 5 more seconds will pass before the second release, in order to give the fish enough time to eat. | + | The value from servo/feed field from Firebase can be a number between 1 and 9, meaning the number of fixed quantities of food to be released. After one release, 5 more seconds will pass before the second release, in order to give the fish enough time to eat. |
The quantity can be written in the box (see image) from the web application and then updated in the database. The value 1 is set as default, so if the user wants this way, he just has to press the Feed button, without writing anything. | The quantity can be written in the box (see image) from the web application and then updated in the database. The value 1 is set as default, so if the user wants this way, he just has to press the Feed button, without writing anything. | ||
Line 71: | Line 84: | ||
{{:iothings:proiecte:2022:feed_failes.jpg?400| Feeding failed message}} | {{:iothings:proiecte:2022:feed_failes.jpg?400| Feeding failed message}} | ||
+ | |||
+ | Also, if the number inserted is greater than 9, an error message will be displayed. | ||
+ | |||
+ | {{:iothings:proiecte:2022:feed_invalid.jpg?400| Invalid feeding value}} | ||
** The entire process is described by the following diagram ** | ** The entire process is described by the following diagram ** | ||
- | {{:iothings:proiecte:2022:feed_diagram.jpg?600| The feeding functionality}} | + | {{:iothings:proiecte:2022:feed_diagram.jpg?700| The feeding functionality}} |
== Water temperature monitoring == | == Water temperature monitoring == | ||
Line 100: | Line 117: | ||
** The water temperature monitoring process is described by the following diagram. ** | ** The water temperature monitoring process is described by the following diagram. ** | ||
- | {{:iothings:proiecte:2022:temp.jpg?600| Water temperature monitoring functionality}} | + | {{:iothings:proiecte:2022:temp.jpg?700| Water temperature monitoring functionality}} |
== Water level monitoring == | == Water level monitoring == | ||
Line 110: | Line 127: | ||
{{:iothings:proiecte:2022:level_firebase.jpg?300| Database level field}} | {{:iothings:proiecte:2022:level_firebase.jpg?300| Database level field}} | ||
- | In the web application, there is a section where the last registered value is displayed, also with the day when the measurement was done. It is expressed as a number of centimeters above the maximum level. So, at first, when the tank is filled with water, the sensor measuring part must be completely sank. In this way, the user can know how close the water level is to the water filter, in case he is away for a long time. It is important for the water filter to not function in the air, because it will be damaged. | + | In the web application, there is a section where the last registered value is displayed, also with the day when the measurement was done. It is expressed as a number of centimeters below the maximum level. So, at first, when the tank is filled with water, the sensor measuring part must be completely sank. In this way, the user can know how close the water level is to the water filter, in case he is away for a long time. It is important for the water filter to not function in the air, because it will be damaged. |
An important detail is that the sensor has only 4 centimeters. | An important detail is that the sensor has only 4 centimeters. | ||
Line 126: | Line 143: | ||
** The water level monitoring process is described by the following diagram. ** | ** The water level monitoring process is described by the following diagram. ** | ||
- | {{:iothings:proiecte:2022:level.jpg?600| Water level monitoring functionality}} | + | {{:iothings:proiecte:2022:level.jpg?700| Water level monitoring functionality}} |
+ | |||
+ | The web application is also available on mobile format. The graphs are bigger than the screen size, but they are horizontally scrollable. | ||
+ | |||
+ | {{:iothings:proiecte:2022:mobile_5_.jpeg?300| Mobile application - part I}} {{:iothings:proiecte:2022:mobile_4_.jpeg?300| Mobile application - part II}} | ||
+ | |||
+ | ===== Software description ===== | ||
+ | |||
+ | For the implementation of this project the following software tools were necessary: | ||
+ | |||
+ | **For the web application:** | ||
+ | * Visual Studio Code | ||
+ | * Node.js | ||
+ | * Note.js Extension Pack for VS Code | ||
+ | * Firebase tools | ||
+ | * React | ||
+ | |||
+ | Instructions: | ||
+ | * Install Node.js and Node.js extension Pack for VS Code - https://randomnerdtutorials.com/esp32-firebase-web-app/#install-nodejs \\ | ||
+ | * Install Firebase tools | ||
+ | |||
+ | <code> | ||
+ | npm -g install firebase-tools | ||
+ | </code> | ||
+ | |||
+ | * Install react | ||
+ | <code> | ||
+ | npm i react | ||
+ | </code> | ||
+ | |||
+ | * Generate node modules (in order to have all the necessary dependencies) | ||
+ | <code> | ||
+ | npm install | ||
+ | </code> | ||
+ | |||
+ | * Firebase login | ||
+ | <code> | ||
+ | firebase login | ||
+ | </code> | ||
+ | |||
+ | * Build the application | ||
+ | <code> | ||
+ | npm run build | ||
+ | </code> | ||
+ | |||
+ | * Deploy the application | ||
+ | <code> | ||
+ | firebase deploy --only hosting:aquarium-fish-feeder | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | **For the ESP32 application:** | ||
+ | * Arduino IDE | ||
+ | * ESP32 library for Arduino IDE (https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/) | ||
+ | * Firebase-ESP-Client Library for Arduino IDE | ||
+ | * OneWire and DallasTemperature libraries for Arduino IDE | ||
+ | |||
+ | == The web application == | ||
+ | The web application was implemented in JavaScript using React library. The main advantages of using this library are that it makes JavaScript coding easier, provides developer tools and structures the application into components. | ||
+ | |||
+ | The functions created using React and Firebase tools permitted the monitoring of the database changes. In this way, when a new value appears in the database, the effect is seen immediately in the web page. The charts are also updated with the new values of level and temperature. Also, by sending the feed data to Firebase and then waiting for that value to be changed by the hardware components, made it possible to display the messages "Feeding successful/failed". | ||
+ | The component //FishFeeder.jsx// contains the implementation for all the described functionalities. The charts are created using //recharts// React library. | ||
+ | |||
+ | The application is hosted by the Firebase platform. | ||
+ | |||
+ | == The Arduino application == | ||
+ | |||
+ | The Arduino application consists in three main parts: | ||
+ | * **The feeding functionality** - detects changes to the database and based on that value, activates the pin that controls the servomotor, in such way that the food will fall from the container, then it switches it back. If this value is greater than 1, the container will stay closed for 5 seconds before the servomotor gets activated the second, the third etc. time. | ||
+ | |||
+ | * **The water temperature monitoring part** - in these part the value from the temperature sensor is read using the OneWire library. This is done every 8 hours, using a time delay variable that stores the value in milliseconds. To prepare for reading the value, the ESP32 activates at first the power pin for that sensor. After reading, it gets deactivated. The temperature is then sent to the database, together with its timestamp. | ||
+ | |||
+ | * **The water level monitoring part** - in these part the value from the level sensor is read as raw value. This value is transformed based on 4 different ranges obtained experimentally, defining each one a level of 1 centimeter. This is done every 2 days, using a time delay variable that stores the value in milliseconds. To prepare for reading the value, the ESP32 activates at first the power pin for that sensor. After reading, it gets deactivated. The level value is then sent to the database, together with its timestamp. | ||
+ | |||
+ | {{:iothings:proiecte:2022:software_diagram.jpg?700| Software diagram}} | ||
+ | |||
+ | ===== Problems ===== | ||
+ | * The water level senor is small. It can only detect if the water level decreases with maximum 4 centimeters. | ||
+ | * The water level has a low sensitivity. It registers very different values for the same depth, when performing multiple measurements. | ||
+ | |||
+ | ===== Conclusions ===== | ||
+ | The remote fish feeder and aquarium water monitoring system is a very useful device, that makes for people easier to maintain an aquarium, especially for long periods of time when they are not home. | ||
+ | As about the project development, I consider it a very interesting activity, mainly because of the knowledge I gathered during this process: working with Firebase, controlling hardware components remotely and also creating web applications. The project still can be improved, but it represents a great starting point in developing IoT applications. | ||
+ | |||
+ | ===== Resources ===== | ||
+ | |||
+ | https://esp32io.com/tutorials/esp32-temperature-sensor \\ | ||
+ | https://esp32io.com/tutorials/esp32-water-sensor \\ | ||
+ | https://randomnerdtutorials.com/esp32-ds18b20-temperature-arduino-ide/ \\ | ||
+ | https://randomnerdtutorials.com/control-esp-gpios-firebase-web-app/ \\ | ||
+ | https://randomnerdtutorials.com/esp32-firebase-web-app/#install-nodejs \\ | ||
+ | https://www.javatpoint.com/reactjs-tutorial \\ | ||
+ | https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/ \\ |