Hi! My name is Rahul, and I am a rising Junior at Dougherty Valley High School. I attended Bluestamp because I have a passion for engineering, and I want to continue to develop my skills in the field. My starter project is the Simon Says Game and my intensive project is an Autonomous Irrigation Controller. The Autonomous Irrigation Controller is an IoT (Internet of Things) controller that uses moisture sensors and temperature sensors to determine if plants are ready to be watered. My project connects to the internet to send a text from the Arduino, alerting the user when their plants are being watered.  

 

Page Map:

Reflection
Project Description
Final Video
Milestone #2
Milestone #1
Major Challenges
Documentation
Starter Project


Reflection

After spending six weeks at Bluestamp, I learned a significant amount about electric engineering, computer science, designing circuits, micro-controllers, documentation, and much more. I now understand what it takes to be an engineer and I have the fundamental skills necessary to continue my journey through engineering. I also understand that in engineering, learning the technical skills are as important as learning how to problem solve. It takes persistence and perseverance to solve a problem, even if it doesn’t work the first time, because it will work eventually.

Autonomous Irrigation System

 

image1 (1)image1

Project Description

My project works by taking input from moisture sensors and using that data to determine if the plants are ready to be watered. When the sensors are out of soil, the LCD will display an error message telling me to place the sensors back in the soil. When the sensors are placed in dry soil, the sensors tell the Arduino to turn the solenoid valve on, allowing water to flow through. When placed in wet soil, the Arduino tells the solenoid valve to stay off, preventing water from flowing through.

Key technology:

Arduino: The Arduino is a programmable microcontroller that is essentially the brain of the system. It coordinates the functions between the various components of my circuit.

Moisture Sensors: The moisture sensors return a value between 0 and 1023 by measuring the resistance between the two probes. I then can determine the soil moisture by calibrating the sensors. 

Solenoid Valve:  The solenoid valve controls the flow of water and is triggered by an electromechanical relay that is connected to the Arduino. 

Xbees:  The Xbees allow my Arduinos to communicate wirelessly so that my system can display information on the LCD. 

Wifi Shield: Connects my system to the internet, allowing me to send notifications or text messages to my phone when the relay is triggered.

RTC (real time clock):  Ensures that the water is not running during the daytime by keeping track of time. It is very effective and easy to set up because it will always run as long as the battery is plugged in.

Temperature sensor:  Returns the current Temperature in Fahrenheit and Celsius.

Final Video

July 27th 2016

Project Update: Since my last milestone I have built enclosures for both Arduinos, set up a server with the Sparkfun Wifi Shield, and soldered all of my wiring onto a proto board. I also cleaned up my wiring to make debugging very easy. I did a lot of testing of my program through various scenarios to ensure that it works consistently and accurately. In the future, I plan on having the Wifi shield send a notification to my phone when the relay is triggered. Overall, the project has been working very well, and I will continue working on it in the future.

Milestone #2

July 12th, 2016

My second milestone involved testing the autonomous water program, programming and connecting the LCD(Liquid Crystal Display) and RTC(Real Time Clock) boards, and connecting two Arduinos to communicate through Xbees.

Hardware:The hardware for this milestone was very straight forward. I used an I2C bus to limit the amount of digital pins the LCD and the RTC would use. I2C allows one master device (the Arduino) to communicate with multiple slave devices through two analog pins. imagesThese two pins are SDA and SCL. SDA is the data pin which sends data to the Arduino and SCL is the clock pin which tells the Arduino the speed at which the devices are communicating. In addition, connecting the Xbees to the Arduino was simple because I used an Xbee shield. No other hardware for the Xbees was required.

Software:Software took the majority of the time for this milestone. For the RTC and LCD, I first had to import their github libraries. Then, using their built in functions, I was able to display the current time on the LCD. The RTC is very useful because once the time is initially set, it functions whether or not it is plugged into the Arduino. For the Xbees, I had to first configure them to each other by using X-CTU (computer program used to connect devices such as Xbees) and setting their PAN ID and DESTINATION addresses. Once they were connected, I had to create two different programs. One program would have the Arduino send information via serial connection to the other, and the other program then reads the data and determines what to print on the LCD.

Challenges:Since this milestone was mainly firmware driven, my challenges were programming related. Specifically, connecting the Xbees to each other was difficult because I was unfamiliar with how to use them. At first, I was unable to send data from one Arduino to the computer, however I quickly learned that I had to update the firmware on the Xbees. Once I configured one of the Xbees to the ROUTER setting and the other to COORDINATOR setting, I was able to communicate between the two.

Milestone #1

June 28, 2016

For my first milestone I used the moisture sensors and the temperature sensor to turn the solenoid valve on and off. My circuit included a 4-channel relay, temperature sensor, two moisture sensors, 7.4 V battery, solenoid valve, and Arduino Uno.

Hardware: In order toIMG_0860 turn the Arduino on and off, I use a simple switch. Once the switch is on, a 7.4 V battery powers the system. The circuit then sends power to a relay when the values of the sensors are below a certain value. When the relay is powered, an electromagnet is energized. This magnet then pulls a switch, closing the circuit. The sensors work by returning a voltage from 0 to 5 Volts and then mapping that voltage to an analog value that is in between 0 and 1023. I can then use this value to calibrate the sensors to return the data I need.

Software: The Arduino is the microcontroller that allows me to program my circuit. For example, the program tells the Arduino to only power the relay when the temperature is below 85 degrees F and when the Volumetric moisture content (Volume of water/volume of soil) is below 40%.  To get the most accurate data set, each sensor collects 5 data points each over 5 seconds. It then takes the average of those points to come up with one value. Since there are two moisture sensors, the Arduino takes the average of the two values and uses that to determine the moisture content.

Challenges: The main challenges for my first milestone included programming the temperature and moisture sensors and connecting the relay to the Arduino. Although all the sensors worked as expected when connected individually, they would not work when multiple sensors were connected to the Arduino. I would get inaccurate and fluctuating data causing the relay to turn on when it was not supposed to. After some research I found that the Arduino needs time to switch from one sensor reading to the other. Below is the code I used to fix this issue:

float sensorAverage(int power, int pin) {

float avgSensor1;
int moistureData1;

for (int i = 0; i < 3; i++) {

digitalWrite(power, HIGH);
int moistureData1 = analogRead(pin);
delay(500);
moistureData1 = analogRead(pin);
delay(500);
sumSensor1 += moistureData1;
digitalWrite(power, LOW);

}

avgSensor1 = sumSensor1 / 3;
return avgSensor1;
}


Project Challenges

I faced two major challenges in my project that I was able to overcome. First, I found out that the soil moisture sensors have a very low resolution. Resolution is basically the range of values returned by the sensor. Therefore, I will not always get consistent and accurate readings. To fix this, I decided to take five readings from the sensors during one iteration, average those readings, and then return a value. This way, I can avoid harmful data that may be affecting my system.

The other major issue I had which took much longer to solve was that the Arduino was constantly resetting because of a large voltage spike caused by the solenoid. This voltage spike is known as flyback voltage, which is caused when the current going to the solenoid is suddenly shut off. The way to fix this is by putting a diode on the solenoid which allows the current to continue flowing until it dies out.


Documentation

Materials:  Bill of Materials

Code: GitHub

Build Plan: Google Docs

Eagle Schematic*

Final Schematic 2
*Does not include Xbees

Starter Project: Simon Says Game

For my starter project I made the Simon Says Game.  The Simon Says game works by processing input from the user into the microcontroller to determine if the user is correctly playing the game. The game has pre-programmed instructions on a microcontroller so that it can respond to all possible inputs from the four buttons.  In the setup, the user can click one of any 4 colored buttons to determine which game mode they want to start in. I placed 4 different colored light emitting diodes (LEDs) under each button so that the user knows which button to click. Once the game mode is selected, the user has 3 seconds to complete the random pattern provided by the game. If they are unable to complete it in that time they lose, however, if they are able to complete all 13 rounds they win. Other components used include the two capacitors, which regulate voltage and the 10K resistor which regulates the current of the circuit. There are 2 switches used to control power and sound and a buzzer used to make sounds.

Challenges for this project were mainly connection issues. The connection between the resistor and the PCB was loose because I had to de-solder the resistor then solder it back on again. Also, the connection with the battery and the battery holders was weak, causing the board to turn off at random times. To fix this I bent the battery holders towards each other allowing for a stronger and more consistent connection.  I learned about soldering, de-soldering, and various electrical components. I also learned that capacitors are used to store voltage, and since their voltage cannot change instantaneously, it can be used to regulate voltage of the circuit.

 

 

Leave a Comment

Start typing and press Enter to search