====== Smart Agriculture for Cats ====== [[http://uniteng.com/index.php/about-me/|Neil Hao]] Starts from 2021/Aug/15 to ~~LASTMOD~~ (Last Modification) ===== Overview ===== {{ :esp32:smart_agriculture_for_cats_system.jpg?direct&400|}} I often forgot to water the barley grass for my cats. Thus, I spent two days for designing a "Smart Agriculture" project for my cats, one day for hardware design, another day for the software design. The hardware is based on ESP32. The software is based on IBM Node-Red and Mosquitto, totally using private cloud. Features: * 7-Day Programmable Scheduling * Up to two soil moisture sensors support * Up to two relays support * Up to two controlled 5V outputs * ADC, I2C, SPI and additional IOs extension connectors * USB Type C Socket ---- ===== Hardware Design ===== |Schematics|{{ :esp32:smart_agriculture_for_cats_sch.pdf |}}|Version: 15 Aug 2021| |Gerber Files|{{ :esp32:smart_agriculture_for_cats_gerberfiles.zip |}}|Version: 15 Aug 2021| {{ :esp32:smart_agriculture_for_cats_pcb.jpg?direct&600|}} ^ No. ^ Description ^ | 1 | ESP32 WROOM | | 2 | Relay 1 Connector | | 3 | Relay 2 Connector | | 4 | Controlled 5V output 1 | | 5 | Controlled 5V output 2 | | 6 | Soil moisture sensor 1 | | 7 | Soil moisture sensor 2 | | 8 | I2C Connector | | 9 | SPI Connector | | 10 | Additional IOs connector | | 11 | User Button | | 12 | USB Type C Socket | | 13 | [[esp32:flashdownloader|ESP32 Flash Download Tool]] Connector | ---- ===== Software Design ===== ==== Firmware ==== | Firmware | {{ :esp32:smart_agriculture_for_cats_firmware.zip |}}|Version: 15 Aug 2021| === MQTT Topic Definitions === **Topic: HOME/SA01/IO Type:Subscription** ^ Commands ^ Description ^ | ATS+ R1ON NUM | Turn on Relay 1 for NUM ms | | ATS+ R2ON NUM | Turn on Relay 2 for NUM ms | | ATS+ R1OFF NUM | Turn off Relay 1, NUM is ignored | | ATS+ R2OFF NUM | Turn off Relay 2, NUM is ignored | | ATS+ P1ON NUM | Turn on Controlled 5V output 1 for NUM ms | | ATS+ P2ON NUM | Turn on Controlled 5V output 2 for NUM ms | | ATS+ P1OFF NUM | Turn off Controlled 5V output 1, NUM is ignored | | ATS+ P2OFF NUM | Turn off Controlled 5V output 2, NUM is ignored | **Topic: HOME/SA01/IO/FB Type:Publish** ^ Commands ^ Description ^ | R1ON | Confirmation for Relay 1 turning on | | R1OFF | Confirmation for Relay 1 turning off | | R2ON | Confirmation for Relay 2 turning on | | R2OFF | Confirmation for Relay 2 turning off | | P1ON | Confirmation for Controlled 5V output 1 turning on | | P1OFF | Confirmation for Controlled 5V output 1 turning off | | P2ON | Confirmation for Controlled 5V output 2 turning on | | P2OFF | Confirmation for Controlled 5V output 2 turning off | **Topic: HOME/SA01/SENSOR/SOIL1/FB Type:Publish** ^ Commands ^ Description ^ | NUM | Raw ADC data from AD4 | Note: NUM is unsigned integer in string. ==== Server-side Software ==== ===Prerequisites=== ^ Item ^ Description ^ Link ^ | Ubuntu Server | Ubuntu 20.04.2 LTS |https://ubuntu.com| | Node-RED | 2.0.5: Maintenance Release |https://nodered.org| | Mosquitto | Version 2.0 |https://mosquitto.org| | node-red-contrib-ui-time-scheduler | [v1.15.2] - 2021-08-13 |https://github.com/fellinga/node-red-contrib-ui-time-scheduler| ===Node-RED Flows=== | Node-RED Flows Screenshot | {{ :esp32:smart_agriculture_for_cats_node_red_flows.jpg?linkonly |}} |Version: 15 Aug 2021| | Node-RED Flows JSON | {{ :esp32:smart_agriculture_for_cats_node_red_flows_json.zip |}} |Version: 15 Aug 2021| ===User Interface=== {{ :esp32:smart_agriculture_for_cats_node_red_ui.jpg?nolink&900 |}} ^ No. ^ Description ^ | 1 | 7-Day Programmable Scheduling | | 2 | Irrigation Time Duration for each Connector | | 3 | Once enabling this option, the scheduled tasks will be preformed if and only if the soil moisture exceeding the threshold. | | 4 | Irrigation Statistics: 0 means idle, 1 means watering. | | 5 | Moisture data from soil moisture sensors. | ---- =====Accessories===== ==== Soil Moisture Sensor ==== {{ :esp32:smart_agriculture_for_cats_soil_moisture_sensor.jpg?direct&200|}} Low-cost capacitive soil moisture sensor was connected to the soil moisture sensor 1 connector in this project. Specifications: * Operating Voltage: DC 3.3-5.5V * Output Voltage: DC 0-3.0V * Interface: PH2.0-3P * Size: 99x16mm/3.9x0.63" ==== Mini Water Pump ==== {{ :esp32:smart_agriculture_for_cats_mini_water_pump.png?direct&400|}} 4.5VDC Mini Water Pump was connected to the controlled 5V output 1 connector in this project. ---- ===== Harvest Season ===== {{ :esp32:harvest_season.jpg?direct&900 |}} It seems no cat can refuse barley grass. ===== Resource ===== ==== Downloads ==== |Schematics|{{ :esp32:smart_agriculture_for_cats_sch.pdf |}}|Version: 15 Aug 2021| |Gerber Files|{{ :esp32:smart_agriculture_for_cats_gerberfiles.zip |}}|Version: 15 Aug 2021| | Firmware | {{ :esp32:smart_agriculture_for_cats_firmware.zip |}}|Version: 15 Aug 2021| | Node-RED Flows Screenshot | {{ :esp32:smart_agriculture_for_cats_node_red_flows.jpg?linkonly |}} |Version: 15 Aug 2021| | Node-RED Flows JSON | {{ :esp32:smart_agriculture_for_cats_node_red_flows_json.zip |}} |Version: 15 Aug 2021| ==== Related Projects ==== ^ Project Name # ^ Description ^ Project Home Page^ |ESP32 Flash Download Tool | | [[esp32:flashdownloader|ESP32 Flash Download Tool]]| ---- ===== Reference=====