Automated Garden System - Mechatronics Group 7
by architect5830 in Workshop > Science
1716 Views, 26 Favorites, 0 Comments
Automated Garden System - Mechatronics Group 7


Mechatronics Group 7
The goal of this project was to create an automated garden watering system using Arduino IDE coding. The system uses an ESP 8266 to control an ultrasonic sensor and a soil moisture sensor that monitor the water level and the moisture of the plant soil. In turn, these sensor readings control the amount of water delivered from the reservoir via the peristaltic pump. The ESP 8266 also allows for automated emails to be sent that give the user the moisture content and the water level in the reservoir.
Below are the .stl files and the Arduino IDE code to upload onto the ESP8266:
Link to access IDE Code:
https://drive.google.com/drive/folders/1JFSv5BY1WBEy9Hn9zYRpI8BQcxXkX8p1?usp=sharing
Supplies

Electronics:
- ESP 8266
- 12V DC Dosing Pump Peristaltic Dosing Head with Connector For Arduino
- Soil Moisture Sensor
- Ultrasonic Sensor
- 12V Battery Holder Case Box Wired ON/Off Switch w Cover Pack of 2
- 8 AA Batteries
- S8050 Transistor
- 5V power supply Module*
- 9V Battery Snap on Connector
- 9V Battery*
- Alligator Clip Cables
- Jumper Cables (MM, FF, FM)
- USB C cable
- Breadboard
- 12 DC Male and Female Power Connector,
Hardware:
- Tupperware (large enough to accommodate devices)
- #4 Woodscrews x 4
- #8 Woodscrews x 4
- 4-40 3/8" screws x 4
- Duct and Electrical Tape
- Zip-ties
- 3m Silicone Tube 2mm ID x 4mm OD
Tools
- Screwdriver
- Ruler
- Utility Knife
- Scissors
- 3D Printer
Attaching the ESP 8266 Board






On the top lid of your container, make 4 small holes located on the corners of a 2in x 2.6 in rectangle.
Take you ESP8266 and fit it on the 3D printed ESP holder so that the pins are facing up.
Use 2 zip ties to secure the ESP onto the holder using the slots on the holder's sides.
Align the holes on the ESP holder with the small holes created onto the lid and use the #8 screws to secure the holder and the ESP to your lid.
Attaching the Ultrasonic Sensor




Use the utility to cut a 1.75 x 0.9 in rectangle on top of the container lid with 2 small holes beside it.
Fit the 3D Ultrasonic sensor holder on the rectangle. (flat side touching the lid)
Align the holes on the holder with the small holds on the sides and attach the holder using the #4 wood screws
NOTE: if your container has a flip-up lid we recommend attaching your Ultrasonic sensor on that since it is a lighter component (space permitting of course)
Attaching the Peristaltic Pump






Using the utility knife make two 0.2 inch holes that are about 0.8 inches apart. They should be wide enough to fit the rubber tubing from the pump through.
Thread the pump tubing through the holes so you can see where the pump attachment bracket aligns on the surface.
Make 2 small holes that align with the pump's bracket
And now, use the #4 screws to secure the pump onto the Tupperware using the 2 small holes
Finally, another 0.2 in hole to allow a tube to come out the container. This will be where the water comes from.
NOTE: The default pump tubing comes with a nozzle to extend the length. Remove the nozzle before threading through the whole.
Attaching the Relay



Attach the 3D printed 12V Relay holder onto the Tupperware using tape. Be sure its somewhere close to the pump. then use the 4-40 3/8 screws to attach the 12V Relay onto the holder. You want to orient it so that the blue box on the relay is towards the bottom.
Attaching the Power Supplies and Board





Fill the 12v battery holder with the 8 AA batteries.
Take the 9V battery and 12v battery holder and tape them onto the side of the Tupperware, opposite of the side with housing the really and the pump (for weight balancing reasons). For the 12v, have it oriented so the cable can run along the bottom
Attach the snap-on-battery connector onto the 9V battery. Then connect the male end of the connector into the power supply module. The power supply module can then be attached on the breadboard. For our example, the breadboard is simply placed on the top of our Tupperware using the sticky adhesive on the underside of the breadboard.
Attach the female DC power connector to the male end of the 12V battery pack. Once done, use electrical tap to wrap around to connector reach the side with the relay and the pump.
NOTE: You can place the breadboard on any location to suit your particular Tupperware container, just keep in mind you may need to extend your cables to be able to reach every device during wiring
Wiring the Board and Attaching the Soil Moisture Sensor




With all the sensors, the pump, the power, and the ESP8266 attached, you can follow the wiring diagram to connect them all via bread board.
For this example, the breadboard was placed on top using the breadboard sticky adhesion on the back to attach it. The wiring diagram was then followed and all the connections were made with a combination of male-male, female-male, and female-female cables as the alligator clips for connecting power to the pump.
NOTE: For more stable connections, you can solder connections to the pump, ESP, and 12V power Connector.
Uploading and Adjusting the Code




Create an email for the ESP8266 to send messages from. It can be something easier, a "throwaway" account.
Using the USB C cable, upload the Arduino Code onto the ESP8266.
In the code edit the following (highlighted in the pictures):
- Type in your WIFI routers SSID and password.
- Type in the "throwaway" email's handle and password. This is where the messages with be coming from
- Type in the recipient's email and password.
- Make sure DEBUG value is 0 to set the interval to 4 emails per day. DO this after you have confirmed you system is running properly (wiring wise and is sending emails)
NOTE: The system only works for gmail accounts.
Final Product



When your wiring and code is successfully tested, you can put your loose rubber tube and soil capacitor into a plant pot. Plug in the USB C cable into the ESP8266 and power it on through a wall outlet adapt or a computer. Make sure all your batteries are fully charged and on.
The emails will notify you how much moisture is being detected as well as how much water is in the reservoir. When the water gets too low, you will see in the email and refill promptly.
Now you have your own automated garden watering system!