User Tools

Site Tools


esp32:smartagriculture

Smart Agriculture for Cats

Neil Hao

Starts from 2021/Aug/15 to 2023/02/11 17:30 (Last Modification)

Overview

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

Schematicssmart_agriculture_for_cats_sch.pdfVersion: 15 Aug 2021
Gerber Filessmart_agriculture_for_cats_gerberfiles.zipVersion: 15 Aug 2021

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 Flash Download Tool Connector

Software Design

Firmware

Firmware smart_agriculture_for_cats_firmware.zipVersion: 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 smart_agriculture_for_cats_node_red_flows.jpg Version: 15 Aug 2021
Node-RED Flows JSON smart_agriculture_for_cats_node_red_flows_json.zip Version: 15 Aug 2021

User Interface

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

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.9×0.63“

Mini Water Pump

4.5VDC Mini Water Pump was connected to the controlled 5V output 1 connector in this project.


Harvest Season

It seems no cat can refuse barley grass.

Resource

Downloads

Schematicssmart_agriculture_for_cats_sch.pdfVersion: 15 Aug 2021
Gerber Filessmart_agriculture_for_cats_gerberfiles.zipVersion: 15 Aug 2021
Firmware smart_agriculture_for_cats_firmware.zipVersion: 15 Aug 2021
Node-RED Flows Screenshot smart_agriculture_for_cats_node_red_flows.jpg Version: 15 Aug 2021
Node-RED Flows JSON smart_agriculture_for_cats_node_red_flows_json.zip Version: 15 Aug 2021
Project Name # Description Project Home Page
ESP32 Flash Download Tool ESP32 Flash Download Tool

Reference

esp32/smartagriculture.txt · Last modified: 2023/02/11 17:30 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
CC Attribution-Noncommercial-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki