S16: Sprinkler

From Embedded Systems Learning Academy
Revision as of 06:22, 24 May 2016 by Proj user22 (talk | contribs) (Hardware Interface)

Jump to: navigation, search

Grading Criteria

  • How well is Software & Hardware Design described?
  • How well can this report be used to reproduce this project?
  • Code Quality
  • Overall Report Quality:
    • Software Block Diagrams
    • Hardware Block Diagrams
      Schematic Quality
    • Quality of technical challenges and solutions adopted.

Smart Sprinkler System

Abstract

Agriculture consumes the majority of freshwater in the United States, and with growing pressure to conserve water in the agriculture sector, people are looking for newer and better methods in water conservation. The objective of this project is to implement a residential irrigation system that utilizes IoT (Internet of Things) concepts to control and conserve water usage. The irrigation system consists of a microcontroller activates 24 VAC electrical valves to control the water flow of sprinkler devices. The project will consist of using one SJone board that act as an irrigation scheduler that dictates periodic activation of sprinkler devices. The scheduler obtains weather and forecast readings from the internet and use it to make changes (if any) to the scheduling of irrigation events. A relay circuit connected to the SJone board allows the scheduler to turn on/off sprinkler devices. Soil moisture sensors were deployed to local areas to send soil conditions of plants to the scheduler. In a scheduled event, the scheduler check the soil conditions of the local area and determine if it should activate sprinkler devices. The user involvement is to configure the scheduler to activate the sprinkler devices at which specific days and times, but once that is set, the scheduler became automated and acts on its own without requiring additional user’s involvement. The attractive function of the scheduler is that it behaves “smartly” by following a set of predefined rules.to control the irrigation system. For example, on a rainy day, the scheduler will delay or remove a scheduled irrigation event. By having a smart irrigation system in the home, the user will have an easier time saving and conserving water much more efficiently.

Objectives & Introduction

Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.

Team Members & Responsibilities

  • Phi Lam
    • Scheduler
    • WiFi Module Task
    • Order Sprinkler parts
    • Relay Circuit/Sprinkler Task
    • Documentation/Diagrams
  • Alejandro Reyna
    • Relay Circuit/Sprinkler Task
    • Moisture Sensor Task
    • Order Moisture Sensor Task
    • Hardware Setup
    • Documentation/Diagrams
  • Sang Nguyen
    • WiFi Module Task
    • Hardware Setup
    • Documentation

Schedule

The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.

Week# Start Date End Date Task Status Completion Date
1 04/03/2016 04/09/2016 Project Idea confirm, ordering project parts Complete 04/11/2016
2 04/10/2016 04/16/2016 Begin conceptual design of code and schematic Complete 04/16/2016
3 04/17/2016 04/23/2016 Work on designing code for basic sprinkler system and set up physical sprinkler system. Complete 04/23/2016
4 04/24/2016 04/30/2016 Enhance sprinkler system code to work with moisture sensor, refine the physical sprinkler system. Complete 04/30/2016
5 05/01/2016 05/07/2016 Connect the sprinkler system to the internet In process 05/07/2016
6 05/08/2016 05/14/2016 Finish internet connection and get a box to house the components, complete project In process 05/14/2016
7 05/14/2016 05/24/2016 Debug and refine project and demo. In process 05/14/2016

Parts List & Cost

Relay Circuit

Item Quantity Cost Comments
3 VDC Power Relay 1 $3.50 Philmore 86-103
Transistor 1 $0.08 NPN Bipolar P2222A
24 VAC Transformer 1 $16.25
24 VAC Electrical Valve 1 $12.97


Irrigation Materials (from Home Depot)

Item Quantity Cost Comments
15 ft. Water Hose 1 $7.97
Adapters, Fittings for Hose 4 $14.00
Teflon Tape 1 $1.47
Gear Drive Sprinkler 1 $7.97


Miscellaneous

Item Quantity Cost Comments
Wifi Wireless Transceiver 1 $6.55 ESP8266 ESP-01
Soil Moisture Sensor 5 $7.99
25 ft. Cord Extension 1 $9.97

Design & Implementation

The Smart Sprinkler design was based on the idea that a normal sprinkler system would be enhanced to check the weather, and adjust its watering schedule. Also, the sprinkler would be aware of days that are meant for watering, if cities have water usage laws. A moisture sensor was added to further allow watering decisions to the sprinkler.

Hardware Design

The hardware components that were used were a SJOneBoard, an ESP8266 WiFi module, a 24 VAC solenoid valve, a 3v relay, and an analog soil moisture sensor. The relay, moisture sensor, and WiFi module were powered by the 3.3v and GND output pins of the SJOneBoard respectively.

Figure 1. Hardware System Schematic.

Hardware Interface

The WiFi module was connected to the UART bus of the SJone board at pins 2.8 and 2.9. The communication works on a single read and single receive. The internet connection was needed to get current time, user schedule, and weather information.

  • Pin 2.8 is the SJone's TX2 pin that connects to the ESP8266's RX pin to transfer data out out from SJone board to ESP8266.
  • Pin 2.9 is the SJone's RX2 pin that connects to the ESP8266's TX pin to receive data in from ESP8266 to SJone board.
  • Since ESP8266 can operate at 3.3V, its VCC connects to +3.3VDC of SJone board.


The 3V SPDT Relay was controlled by SJone's GPIO pin, 2.1. The pin would output 3.3v to trigger the relay circuit to turn on the sprinkler. A NPN transistor was used to act as a switch to control current flow from Terminal B to Terminal A to energized/de-energized the coil in the relay module.

  • Pin 2.1 is SJone's output GPIO pin that connects to the base (B) of the PN2222A transistor. A current-limiting resistor is placed between the connection.
  • The Collector (C) is the positive lead of PN2222A that connects to Terminal A of the relay.
  • The relay's Terminal B connects to +3.3VDC of SJone board.
  • The Emitter (E) is the negative lead of PN2222A that connects to the GND of SJone board.


The Solenoid Valve was controlled by the 3V SPDT Relay module, which connects/disconnects the Solenoid Valve from the 24 VAC source.

  • One lead of the Solenoid Valve connects to Terminal COM (Common) of the relay. The COM terminal is connected to Terminal NC (Normally Closed) when the relay is not activated.
  • The other solenoid lead connect to one end of the 24 VAC source, which the other end of 24 VAC source connect to the Terminal NO (Normally Open) of the relay. When the relay's coil is energized ( current flow from Terminal B to Terminal A), Terminal COM connects to Terminal NO of the relay.


The moisture sensor was used to read the levels of moisture in the lawn, where the sprinkler would be utilized. The sensor was connected to Pin 1.30 of the board.

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

Schedule Time

7:30 PM

Implementation

Flow chart

Figure 1. Flow Chart of the System

Testing & Technical Challenges

Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.

Include sub-sections that list out a problem and solution, such as:

Technical Challenges

Getting Proper Hose Fittings

Since our group didn’t have any hoses already installed at our own place, we have to buy the necessary parts from scratch to setup a proper water hose. This is a challenge for us since we didn’t have any mechanical background regarding fitting hoses. It is recommended to consult with experts first before buying any parts. We suggest going to Home Depot to consult with their experts and get the necessary parts there. There are many variations of hose fittings: depending on what parts you already have and which part you started building with. For us, we started with a solenoid valve and proceed from there in getting parts that satisfy the valve’s requirement. Here are the steps we took to complete a water hose setup:

  • Started with the solenoid valve, obtain 2 set of water hoses to attach to both end of the valve. Obtain any adapters/fittings to connect both end of the valve to hoses if required.
  • Obtain a water sprinkler device to connect to one end of a water hose. Obtain any adapters/fittings to connect the sprinkler device to a water hose.
  • Make sure the other end of the water hose fit with the water faucet that is used as the water source for your project. Obtain any adapters/fittings if required.


Water Leakage

After buying all the necessary parts to fit the water hoses with the electrical valve, sprinkler device, and water faucet, it was time to connect all these parts together and test out the connections. There were issues encountered with water leaking out from a few connecting joints due to combination of loose fittings and high water pressure. Attempts to resolve this particular issue include using PTFE tapes or thread seal tapes to ensure a tighter fittings on the adapters. Other precautions were made including isolating electrical components away from possible contacts to leaking waters.


Challenges with the WiFi Module

  • Coding the Wifi Module proved alot more daunting than originally expected. At first, there was issues with the device not being powered properly. This part was resolved by routing all the pins that weren't being used to 3.3v.
  • The second challenge was establishing a communication. the receive data was checked before it was available and the timeouts had to be adjusted.
  • Once the Wifi Module was working, there is another challenge in reading data from a webpage. Parsing the data was a hassle because the original websites that were checked for weather werent formatted nicely. Once this was debugged, the information was successfully parsed, the weather data was sent to the irrigation scheduler.
  • Attempts to connect the wifi module to SJSU's campus wifi (SJSU_premier) proved to be challenging. SJSU_premier uses WPA2 Enterprise and Protected EAP (PEAP) for user authentications, and since the ESP8266 wifi module doesn't support these configurations, another workaround was used to connect the ESP8266 to the access point when working on SJSU campus. Alternatively, wifi-hotspot was created by using PDAnet and Connectify softwares, which can serve as the access point for ESP8266 to connect to.

My Issue #1

Tasks not waking up after sleep

Conclusion

Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?

Project Video

Upload a video of your project and post the link here.

Project Source Code

References

Acknowledgement

We would like to thank Preetpal Kang, Dr. Ozemeck and all the fellow engineering students who helped out with this project, both educational and moral support.

References Used

List any references used in project.

SJ One Board LPC 1758 Schematics http://www.socialledge.com/sjsu/images/d/de/2012SJOneBoardSchematic.pdf

LPC176x/5x User Manual http://www.nxp.com/documents/user_manual/UM10360.pdf

WiFi Wireless Transceiver ESP8266 https://nurdspace.nl/images/e/e0/ESP8266_Specifications_English.pdf

3 VDC Power Relay http://www.philmore-datak.com/mc/Page%20266.pdf

NPN P2222A Transistor http://www.jameco.com/Jameco/Products/ProdDS/178511.pdf

Appendix

You can list the references you used.