IOT WorkshopSpring 2017
What is Cannabisitter?
Cannabisitter is an automatic home irrigition solution for plants. It provides you the opportunity to grow your plants at home or in your garden with no need to water it on your own. Cannabisitter monitors your plants' soil moisture (individually for each plant), along with the temperature in the plants' area, and assures that your plants will receive water right on time, and only when they need! Moreover - you can monitor your plants using our Android app. Using the app, you are able to add a new plant to your plants list right when you get it (by scanning a special QR code), monitor your plants statistics, and more.
Raspberry Pi 2
The Raspberry Pi 2 (RP2 in short) is a credit card sized mini personal computer that lets software developers dive right in and start coding - no additional components needed. Raspberry has its roots in education but should be considered for any purposes where you would otherwise use a PC. Cannabisitter uses the RP2 as its main core: the RP2 controls the different hardware components connected to it through the GPIO pins, allowing the user to collect data and to water the plants when needed. The RP2 runs a Windows 10 IoT Core operating system, on which we run our UWP app which monitors the plants. Connectivity is achieved using a WiFi dongle.
SparkFun Digital Temperature Sensor Breakout - TMP102Datasheet
The TMP102 temperature sensor is connected to the RP2 via the I2C GPIO pins. It measures the temperature and sends the data to the RP2, which passes it forward to the data to the database through Azure IoT Hub.
SparkFun Soil Moisture SensorDatasheet
The soil moisture sensor is an analog device which measures the soil moisture (namely, it measures how wet the plant's soil is). Since the output signal of that sensor is analog while the RP2 can only handle digital signals, we convert the analog signal to a digital signal using an ADC (Adafruit MCP3008). Just like the TMP102, this sensor also sends the measurments to the RP2, which passes them to the database through Azure IoT Hub.
Tap Irrigation System
Tap Irrigation Actuator
A solenoid valve is an electromechanically operated valve. The valve is controlled by an electric current through a solenoid. We used a 12V power supply controlled by a BJT.
The actuator allows water to go through when our Azure Logic Function sends a watering command to the RP2. The command is being sent according to the data collected by the sensors (temperature and soil moisture measurments).
In order to give the user another indication that an irrigation occurs, we provide a red LED that lights whenever the actuatur is open.
The server side has basically 4 components, all of them are part of Microsoft Azure environment:
- SQL Database - this component allows us to keep the data collected from the plants, along with our plants database (which contains the threshold values that determine when a plant should be watered), our users database, and the individual plants list of each user.
- IoT Hub - a component responsible for communicating with the RP2 - it allows to perform device-to-cloud and cloud-to-device telemetry (namely, we use it to get the data sent from the RP2 to the cloud, and send the open/close water messages to the RP2).
- Logic Function App - this component reads the telemtry sent from the RP2 to the IoT Hub, and stores it in the corresponding database (in the SQL Databse component). It also determines whether a plant needs irrigation (or to stop an occuring irrigation), and sends the command through the IoT Hub. Eventualy, this is a bridge component which allows communication between the IoT Hub and the SQL Database.
- Mobile App - this component allows the communication of the Cannabisitter mobile app with the SQL database, allowing the user to see the relevant data in the mobile app.
This app operates the RP2, along with giving the user an interface where he or she can constantly monitor the values measured by the RP2.
The main UI component of the system - a mobile (Android) application which provides the user lots of functions:
The user can login to his personal zone and view his plants list. Adding a new plant to the list is done simply by scanning a QR code (which can be attached to the plant in any plants store). Monitoring the user's plants is simple as well - viewing a single plant, the user can see the last irrigation time, along with graphs of the recent measurments of that plant (graphs were created using the android-graphview library).
Putting it all together...
The following scheme shows how all the different components mentioned above are being put together in order to run the Cannabisitter. It shows how the different parts of the system are connected and communicate with each other.