Automatic Sprinkling System - EasySprinkle
by aaronbeirlaen in Circuits > Raspberry Pi
250 Views, 2 Favorites, 0 Comments
Automatic Sprinkling System - EasySprinkle
EasySprinkle is an automatic sprinkling system project for grass in your garden.
During hot days with little to no rain it may be possible your grass starts dehydrating and you have to provide it water yourself. The goal for this project is so you never have to do this again and your grass will remain healthy.
This project uses a Temperature, Moisture and Water Level sensor to identify if the grass is dehydrated or not. The system will provide water to the grass if it's dehydrated using a valve connectable to the water pipes of your sprinklers which will open when needed.
Supplies
Microcontroller:
- Raspberry Pi
Sensors:
- LM35 Temperature Sensor
- SparkFun Moisture Sensor
-
T1592 P Water Sensor
-
MCP3008 (ADC converter for sensor readings)
Actuator:
- Rainbird 100-HV Solenoid Valve
- 1-channel Relay Module (or more channels depending on how many valves for your sprinklers you want.)
- Transformer 24V/AC (Solenoid Valve works on AC voltage of 24V)
Optional:
- LCD-display (to display IP Address of Raspberry Pi)
Circuit:
- Breadboard and cables
- Copper wires for the transformer
Case (optional):
- Wooden box
- Drill for making holes in the wooden box
- Glue to put the hardware in the box
Electronics Circuit
You can make the electronic circuit on a breadboard using the circuit schematics attached to the step.
Only for the transformer you will need some copper wires to connect it with the valve and relay module.
Schematic files are downloadable below:
Making the Database
To make the database for the project you have to make a model in MySQL Workbench.
Here are the tables you will need:
Actie
This is where all the actions come of a device.
The 'actie' table contains the Device ID referenced from the 'device' table. The table also contains the status and date.
Device
This is where all the devices come.
The 'device' table contains the type, measuring unit and description of every device. (Sensors and actuators)
Meting
This is where all the measures come.
The 'meting' table also contains the Device ID from the 'device' table and a value and date.
You can also just use the dump file I made which can be found on GitHub: https://github.com/BeirlaenAaron/EasySprinkle
The Code (backend)
You can find the code for the backend on GitHub: https://github.com/BeirlaenAaron/EasySprinkle
How it works:
The backend code is written in Python.
The backend will contain the code for the hardware, the sensors will measure every hour and send these values to the database. The valve will be operated depending on the sensor data and will automatically open for an hour if minimum sensor values are not met. Data is sent from backend to frontend using SocketIO.
Simply run app.py to make it work.
Modifying it to your preferences:
To make the code work you need to change something.
Config.py contains the credentials for the database, change this to your database user, password, etc.
The Code (frontend)
You can again find the code for the frontend on GitHub: https://github.com/BeirlaenAaron/EasySprinkle
How it works:
The frontend will contain the html and css for the web application. The javascript files are to communicate from frontend to backend to get the data on the web page.
Paste the files in the /var/www/html folder of your Raspberry Pi.
Casing
As seen in the pictures above I used a wooden box to put the hardware in with some glue. And drilled holes in it for the power cable, sensor and valve cables. I also cut out a rectangle in the lid to fit the LCD display in.
Obviously you can choose for yourself how you will make your casing, but this is just to give you an example.