F15: Plant Control
Contents
Automated Plant Control System
Abstract
The Plant Control project introduces a plant incubator which allows for resource and energy efficiency while producing healthy flowering and vegetation. The incubator will utilize an SJOne development board, its on-board sensors (light/temperature), a moisture sensor, and LEDs in order to autonomously provide the optimal moisture level for growth in any lighting. The owner of the plant control system can be confident that his or her plant is growing in perfect conditions and will be notified otherwise via an LCD screen.
Objectives & Introduction
This project is a self watering, self lighting, and temperature alerting plant grower.
The entire system is controlled via an SJOne Board which utilizes an LPC1758 Microprocessor.
In addition to the onboard sensors, the project will require interfacing to:
- RGB LCD Screen
- Moisture Sensor
- Water Pump
- PWM controlled LED
Team Members & Responsibilities
- Moises Negrete
- LED and Water Pump Driver Circuit Design
- Temperature, Light Sensor, PWM software
- Design and Build Planter
- Eduardo Lemus
- LCD Interface
- Software Design and Implementation
- Source Code Task and Timing Cleanup
- David Chiu
- Moisture Sensor Interface
- Power Regulator Circuit
- Design and Build Planter
Schedule
Week# | Date | Task | Actual |
---|---|---|---|
1 | 10/24 | Research best lighting, temperature, moisture conditions | Completed |
2 | 10/30 | Purchase necessary equipment, and begin testing equipment (sensors) | Completed |
3 | 11/06 | Interface Sensors | Completed |
4 | 11/13 | Interface LEDs and Water Pump | Completed |
5 | 11/20 | Begin Building Planter | Completed |
6 | 11/27 | Finish Building Planter & Begin RT Code | Completed |
7 | 12/2 | Functionality Testing and Prototype Verification | Completed |
8 | 12/9 | Plant Flower and Field Test | In Progress |
Parts List & Cost
Part Name | Cost | |
---|---|---|
Water Pump | $6.99 | http://www.amazon.com/gp/product/B00MP4Q6K2?psc=1&redirect=true&ref_=ox_sc_act_title_1&smid=AAOUP5IQ82N49 |
Soil Hygrometer | $6.11 | http://www.amazon.com/gp/product/B00KKQYW76?psc=1&redirect=true&ref_=ox_sc_act_title_1&smid=AIOZ1JWV33B58 |
1/2 gallon Water Reservoir | $7.00 | Auto Zone |
Faux-Ceramic Planting Pot | $5.00 | Home Depot |
Baby Mums (Flowers) | $2.00 | Trader Joes |
SJone Board | $80.00 | SJSU |
Soil | $10.00 | Home Depot |
12V Power Adapter | $6.00 | Anchor Electronics |
LCD Screen | $13.90 | http://www.seeedstudio.com/depot/grove-lcd-rgb-backlight-p-1643.html |
7805 Voltage Regulator | $0.50 | Anchor Electronics |
Total | $136.6 |
Design & Implementation
Hardware Design
The hardware design for this projects will be split into the different sections of our project. The different hardware components include a power circuit and water pump/LED drivers. The
Hardware design will then be followed by the design of the Plant Pot and finally the Hardware interfacing components.
Power Circuit
Due to the low power outputs of the LPC1758. in order to drive the LED and the the water pump,
an external power source strong enough to do so is necessary.
Figure 1. Power Regulator Circuit (12V-5V)
In figure 1, the power circuit uses 2 capacitors (100uF and 220 uF) to maintain stability of the regulator. The LM7805 is used to convert 12V to 5V as needed to power the LCD screen, drive the LED, and the motor. A switch was added at the 5V node in order to be able to switch on and off the 5V.
Water Pump/LED Driver
FIgure 2. PWM Mosfet Driver for water pump
The figure above (Figure 2) displays the circuit design used in our plant control system for driving the water pump via PWM. The PWM input from the LPC1758 enters the gate of the 2n7000 mosfet which allows the Source-to-Drain circuit completion. When the Source-to-Drain circuit is complete, the current will flow though the water pump and thus pump water into the dry soil when needed. The LED in the circuit is used to polarize the current so that it only flows in one direction disallowing the pump to receive current in a reverse direction. The circuit for driving the plant lighting LED is similar to the water pump driving circuit other than that the leads to the water pump are connected to a 5V LED. The plant lighting LED is connected in parallel to the forward current directing diode. A 10K Resistor connected from the Gate to the Drain in order to ensure gate is grounded if drive is ever disconnected.
Plant Casing
The Plant casing was designed to look like a classic ceramic/adobe plant pot. A water reservoir was connected to the back of the plant pot and the water pump was placed inside of the water reservoir. A hose was connected to the water pump and connected to go around the plant pot to drip water around the pot whenever a signal is received from the soil moisture sensor. An LED was mounted to the top of the plant pot in order to provide light whenever the light is in a dark environment. A figure showing the mounting is shown below.
Figure 3. Plant Control Casing (Mounted LED and Water Reservoir)
Hardware Interface
For the hardware implementation we used the I2C and the PWM communications as well as GPIO. The I2C bus was used in order to communicate from the board to the LCD screen, which is used to display the temperature of the room that the plant is in. PWM was used to control the water pump and the lighting LED. GPIO pins were used to interface sensors that required AtoD conversion as well as for the switches on the board which are used for testing.
Figure 4. LCD interface
The LCD screen is interfaced to the SDA and SCL lines of the LPC1758 to act as a slave under I2C communication.
Figure 5. Soil Moisture Sensor Interface
The soil moisture sensor was connected to the ADC pin of the LPC1758 in order to convert the analog signal of the sensor into a digital signal that the LPC1758 can process.
The interface for the PWM can be seen in the Hardware Design sections where the Driver Circuit is explained. In that scenario, the PWM output is connected to the gate of a mosfet that is used as a switch to control how fast the water pump pumps water and how dim or bright the lighting LED shines.
As for the other sensors used, they are part of the SJOne Board and also use I2C communication similar to the LCD and therefore are connected to the SDA and SCL in the same manner.
Software Design
Below are flow charts for the software algorithm combining the tasks that are performing the reading and the tasks that are enabling/disabling the IO devices. In order to share the values of the readings we are utilizing queues to pass values from one task to another.
Figure 3. Water Pump Flow Chart
In the figure above, we have two tasks that control the water pump. The first task (MoistureSensorTask) reads the sensors and the second task (WaterPumpTask) determines whether to turn on the water pump or not. Each Moisture level check is timed for 30 minute intervals because we know that the rate of change in moisture levels in the soil will not change drastically over short periods of time. This allows the CPU to utilize it's resources to perform other tasks.
Figure 4. LED Flow Chart
In the figure above, we also have two tasks that control the LED. The first task (LightSensorTask) reads the sensors and the second task (LightPWMConsumerTask) determines whether to turn on the LED or not. We will be monitoring the amount of light must more frequently because a constant healthy level of lighting is necessary in order to maximize plant growth.
Hence, for each of the the necessary readings needed,(such as temperature, moisture levels, etc) a task was created. The tasks gathered the necessary information and sent them to another task (through a queue) that processed the information. The task that receives the information ("consumer task") analyses the information received and executes the necessary steps to resolve a problem if there is one. Using queues instead of xsemaphores allowed us to context switch between task at a much faster rate.
The use of queues made it easier to create a context switch between task. In addition a time delay was added to each
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
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:
My Issue #1
Discuss the issue and resolution.
Throughout the project we have come across many challenges that we were able to overcome because we started early. We made many mistakes in both the software and the hardware implementations of our design and it slowed our progress greatly. Some advice would be to pick a project quick and start early. It is recommended that you fail early so that you can have time in the end to make up for it.
My Issue #1
One of the main issues that slowed our progress is that none of our group have ever worked with an LCD screen and we did not know how to initialize or print to the screen. We spent many days researching for solutions but everything online pointed to arduino libraries, which we are not allowed to use. For one of the attempts we tried to take a look into previous projects that utilized the LCD however that also did not make any sense to us because we had no idea what was going on inside the LCD screen. After trying for so long, we decided to give up and ask for help. If given the opportunity to work on another project I will definitely ask for help earlier in the process, getting stuck and not knowing what to do was a big waste of time and if you can draw knowledge from someone it helps speed up the learning process.
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 both Preetpal Kang and Dr. Haluk Ozemek, for their limitless support and encouragement throughout the semester.
The knowledge and skills gained in CMPE146 were paramount to the completion of this project.
References Used
Soil Hygrometer
LCD RGB Backlight
2N7000 Transistor
Voltage Regulator
Appendix
You can list the references you used.