Project Overview:
The problem: Plants are important, but sometimes growing plants can be hard!
The proposed solution: Gather copious amount of data to observe a plant's health and find out when their health starts to decay.
The focus of this project is to collect environmental data and analyze the NDVI (photosynthesis) value of a plant. With this data on a plant's life, one can learn what is good, or bad for their plants (For example, figure out when the plant health starts to decay).
The objective for this project is to have a system which will connect to WiFi, collect and store images/data, and display them to a user via a GUI. Depending on the user's preference, PlantAnalyzer will also send email alert notifications as well as trigger physical action, such as automated watering or shielding from the sun.
PlantAnalyzer's uses could range from teaching children about growing plants, to agricultural uses on crops.
Highlights of this project are:
- Observe plant's NDVI value and how stressed a plant is
- Display the complete history of a plant, including a graph of environmental data and timelapse photos
- Custom planter with glass front that will allow user to view roots
- Python Web Application (FLASK) to process and store images
Hardware:
This project will utilize an Arduino MKR1000 to collect environmental data/images and then send them to a Flask WebApp.
A complete list of hardware can be found (and will be updated) in the "Components" section.
Schematic for PlantAnalyzer (In work, potentially need to add extra sensors):
Software:
Arduino Code:
For this project, I plan on using the following Arduino libraries:
- "Default" Libraries:
- Wire.h - I2C library
- SPI.h - SPI library
- SD.h - Library to manage SD cards
- Custom Libraries:
- ArduCAM.h - Used to control ArduCAM camera
- memorysaver.h - Included with ArduCAM's library, contains registry values for the OV5642 sensor
- WiFi101.h - Manages WiFi configuration and connection
- WiFiUdp.h - Used to send and receive UDP messages
- RTCZero.h - Manages MKR1000's onboard Real Time Clock
- SparkFunHTU21D.h - Sparkfun's library for their weather shield
- SparkFunMPL3115A2.h - Sparkfun's library for their weather shield
- Firmata.h - Manages Firmata protocol which communicates with GUI
Flowchart for PlantAnalyzer's Arduino Code:
Python Flask Web Application:
The Python Flask web application will be used to process HTTP request from the MKR1000 and process infrablue images. Flask can be used to execute Python scripts, such as image processing scripts, and store images.
Flowchart for PlantAnalyzer's Flask WebApp:
Graphical User Interface (GUI):
The intended GUI for this project will be a Universal Windows Application (UWA) coded in C#. The GUI will have three modes (Live Mode, Project Mode, and Configure).
- Live Mode will connect the GUI to the Arduino MKR1000 and allow the user to view the environmental data and pictures of the plant.
- Project Mode will display the history of a selected project (time lapse of images and graph of environmental data)
- Configure will allow the user to configure the user's email address, email triggers and physical triggers
Sample layout of GUI:
Technologies:
Normalized Difference Vegetation Index (NDVI):
A plant's NDVI is a graphical representation of a plant's photosynthesis capacity. Thanks to various open communities (such as Public Lab) technology once confined to outerspace is now able to be used by Makers/Hackers using open source technology. Utilizing a modified infrablue camera, PlantAnalyzer will be able to gauge how stressed a plant is based on the plant's photosynthesis value.
Hypertext Transfer Protocol (HTTP):
In order to send data and images to the flask webapp this project will use HTTP POST requests sent from the Arduino MKR1000.
Sample POST request to send image to Flask WebApp:
POST / HTTP/1.1 HOST: FLASK_HOSTNAME Content-Type: multipart/form-data; boundary = AaBb00 Content-Length: (length of content) --AaBb00 Content-Type: image/jpeg Content-Disposition: form-data; name="file"; filename=imagefilename Content-Encoding: binary <Binary data of the image!> --AaBb00--
Sample POST request to send data to Flask WebApp:
POST /tables/table_name HTTP/1.1 HOST: mobile_app_name X-ZUMO-APPLICATION: moible_app_key Content-Type: application/json Content-Length: (length of content) "index":"table_index_var","soilmoisture":"soilmoisture_var","airtemp":"airtemp_var",....
Serial Peripheral Interface (SPI):
Will be used to control both the camera as well as an Adafruit SD card reader. SPI works off of three "control" wires and a slave select that the "MASTER" uses to indicate which "SLAVE" it wants to talk to.
I2C (pronounced I-squared-C):
Used to write to the camera's registries for configuration and also to communicate with SparkFun's weather shield (currently only used for temperature and humidity). I2C is a two wire protocol that also uses a MASTER/SLAVE relationship, but instead of a slave select, each SLAVE has an address to which the MASTER can "address".
Firmata:
Firmata protocol will be used to allow communication between the Arduino MKR1000 and the GUI. The send string function will be used to communicate.
Open-source Licenses / Third-party Licenses / Restrictions:
- Arduino Code Libraries (Open-source):
- Wire.h - Creative Commons Attribution-ShareAlike 3.0 License
- SPI.h - Creative Commons Attribution-ShareAlike 3.0 License
- SD.h - Creative Commons Attribution-ShareAlike 3.0 License
- ArduCAM.h - MIT License (MIT)
- WiFi101.h - Creative Commons Attribution-ShareAlike 3.0 License
- WiFiUdp.h - Creative Commons Attribution-ShareAlike 3.0 License
- RTCZero.h - Creative Commons Attribution-ShareAlike 3.0 License
- SparkFunHTU21D.h - Beerware license (Nathan Seidle)
- SparkFunMPL3115A2.h - Beerware license (Nathan Seidle)
- Firmata.h - Creative Commons Attribution-ShareAlike 3.0 License
[To be updated as more licenses are added]
Challenges:
Some potential challenges for this project could be:
- Need to properly calibrate the infrablue camera to accurately obtain a plant's photosynthesis value. To accomplish this I have found to possible solutions:
- Manually adjust the Auto White Balance (AWB) calibration of the Arducam module to adjust for the blue filter
- Merge the normal image and the infrablue image, with an QR code to overlay the two, to better process the image
- Need to figure out a design for measuring the soil's nutrient level.