Automatic Water Dispenser
ECE 4180 Final Project - by Roy Blatt and Yarin Gurfel
Introduction
What happens when people need to be away from home for extended periods of time and cannot take care of their plants? The current solution involves asking for favors from friends or family members, which is a hassle for both the plant owners and the people they must seek help from. The Automatic Water Dispenser is an automatic watering system that allows users to specify the degree of moisture they wish to maintain in the soil of a given flower pot.
Here's how it works: This device is simple to use with our 3-step approach to monitoring your soil's moisture level.
Step 1- CONNECT. Users simply connect to the device using Bluetooth on their smartphone or mobile device through an easy-to-use mobile application.
Step 2- CONTROL. Users specify the desired percentage of moisture in the soil, which our Automatic Water Dispenser will periodically measure. This method of measurement saves energy to keep power bills at bay.
Step 3- MONITOR. When the water saturation drops below the user's threshold amount, our device replenishes water in the soil until the desired percentage of soil moisture is achieved. The device will send the user notifications as it waters to keep the users updated and informed.
Components
The Automatic Water Dispenser is comprised of the following MBED-friendly parts :
Adafruit BLE UART Friend
This low cost BLE board features an ARM Cortex M0 core running at 16MHz with 256KB flash memory and 32KB SRAM. It is used for user-device interaction. The board takes a 5V input from the MBED microcontroller and is connected to its TX/RX pins. For more information about the part visit https://developer.mbed.org/users/4180_1/notebook/adafruit-bluefruit-le-uart-friend---bluetooth-low-/.
SparkFun MOSFET Power Control Board
This MOSFET board uses the RFP30N06LE MOSFET transistor rated at 60V and 30A for higher current loads, and has a very low gate input voltage that works well with MBED's 3.3V logic signals. It is used as a power control unit to the water-flow-control solenoid. The board is connected to a 12V external power supply and a DigitalOut MBED pin on one end, and to the flow-control solenoid on the other. More information about this board can be found at https://developer.mbed.org/users/4180_1/notebook/relays1/.
DIGITEN 12V Water Solenoid Valve
This solenoid is used to dispense water from a water tank to a flower pot. It is a normally off part that allows water flow only when given enough energy. The solenoid's nominal operational voltage is 12V, but it will also operate at lower voltages. It is indirectly connected to a power source through the MOSFET board above in order to provide logic control for turning it on/off. More about this solenoid can be found at https://www.amazon.com/DIGITEN-Solenoid-Connect-normally-Closed/dp/B016MP1HX0/ref=sr_1_3?ie=UTF8&qid=1493405070&sr=8-3&keywords=solenoid%2012v%20water.
Phantom YoYo High Sensitivity Moisture Sensor
This sensor measures the moisture of soil by testing the conductivity between its two pins. The sensor takes a 3.3V input, and outputs analog data to the MBED microcontroller. For more specifics about this part see https://www.amazon.com/Phantom-YoYo-compatible-Sensitivity-Moisture/dp/B00AFCNR3U/ref=sr_1_18?ie=UTF8&qid=1493405198&sr=8-18&keywords=digital%20moisture%20sensor.
Set-Up
Below we can see an image of the breadboard set-up of the Automatic Water Dispenser.
Since the connections cannot be shown in a clear manner on a breadboard, we created a schematic to depict device's layout.
Demo
Let's take a better look at the project. Below you can see a short video demonstrating the use of the Automatic Water Dispenser.
Code
main.cpp
#include <mbed.h> #include <math.h> #include <vector> #include <stdlib.h> RawSerial dev(p28,p27); // BLE TX/RX connections DigitalOut led(LED1); DigitalOut Switch(p19); // Solenoid enable pin PwmOut TurnOnSensor(p25); // Moisture sensor enable pin AnalogIn ReadSensor(p20); // Moisture sensor data pin std::vector<char> vec; int setValue=0; int powers[4]= {1,10,100,1000}; float value; void dev_recv() { while(dev.readable()) vec.push_back(dev.getc()); if (vec.size() >=3) { for (int c=vec.size()-2; c>=0; c--) setValue = (vec[c]-'0')*powers[(vec.size()-c-2)]+ setValue; } } int main() { myPC.baud(9600); dev.baud(9600); dev.attach(&dev_recv, Serial::RxIrq); TurnOnSensor = 1.0; wait(2); value = ReadSensor; TurnOnSensor = 0.0; dev.printf("The current moisture level is: %.3f %% \n", value*100); while (setValue==0) { dev.puts("Please Input your desired two digit moisture level %\n"); wait(4); } dev.printf("You set the value at %d % \n", setValue); while (true) { TurnOnSensor = 1; wait(2); value = ReadSensor; wait(1); TurnOnSensor = 0; if((float)setValue>value*100) { Switch=1; dev.printf("Moisture level: %.3f %% Watering now! \n", value*100); wait(5); Switch=0; dev.printf("Valve off!\n"); wait(5); } else { dev.printf("The current Moisture level is at %.3f %%. \n Next check will be in 10 minutes.", value*100); wait(600); } wait(5); } }
1 comment on Automatic Water Dispenser:
Please log in to post comments.
hello, does this code works on frdm kl25z ?