Due to the crisis of agricultural land, it is very important to think about rooftop gardening for food security. Regular maintenance is important for any garden. We do rooftop gardening as a hobby. Many of us do not know how to care for the garden properly. An automated system that can help us in our rooftop gardening is presented throughout this project. The top view of the system is given below,
Technically, the Wio terminal is used as the main controller of our system. We have used a soil moisture sensor waterproof temperature sensor for collecting temperature and moisture data. An electrical conductivity probe (EC probe) is used for capturing the pH and salt information of the soil. A color sensor is used for collecting color information of the plant. Automatic watering is supported by this system. A motor is used for pumping the water based on soil moisture data (like intelligent plant watering). The micro-controller (Wio terminal) is responsible for collecting sensor data and transferring the data to the cloud.
Mobile application is developed as a result, Users of this system can easily monitor the status of their plants (remotely without visiting the garden). In critical situations, the system will automatically inform the user about the conditions of the plant.
Let's Build 🛠️Hardware Components- Wio Terminal based on ATSAMD51-based microcontroller with wireless connectivity supported by Realtek RTL8720DN and is equipped with a 2.4” LCD Screen, onboard IMU(LIS3DHTR), Microphone, Buzzer, microSD card slot, Light sensor, and Infrared Emitter(IR 940nm). Realtek RTL8720DN chip supports both Bluetooth and Wi-Fi providing the backbone for IoT projects.
- The DS18B20 communicates with the “One-Wire” communication protocol, a proprietary serial communication protocol that uses only one wire to transmit the temperature readings to the microcontroller. The DS18B20 can be operated in what is known as parasite power mode. Normally the DS18B20 needs three wires for operation: the Vcc, ground, and data wires. In parasite mode, only the ground and data lines are used, and power is supplied through the data line. The DS18B20 also has an alarm function that can be configured to output a signal when the temperature crosses a high or low threshold that’s set by the user. For more details on timing, configuring parasite power, and setting the alarm, see the datasheet.
- The TCS34725, which has RGB and Clear light sensing elements. An IR blocking filter, integrated on-chip and localized to the color sensing photodiodes, minimizes the IR spectral component of the incoming light and allows color measurements to be made accurately. The filter means you'll get much truer color than most sensors since humans don't see IR. The sensor also has an incredible 3, 800, 000:1 dynamic range with adjustable integration time and gain so it is suited for use behind darkened glass.
The Wio Terminal based ATSAMD51-based microcontroller with wireless connectivity supported by Realtek RTL8720DN and is equipped with a 2.4” LCD Screen, onboard IMU(LIS3DHTR), Microphone, Buzzer, microSD card slot, Light sensor, and Infrared Emitter(IR 940nm). Realtek RTL8720DN chip supports both Bluetooth and Wi-Fi providing the backbone for IoT projects.
Key Features
- Powerful MCU: Microchip ATSAMD51P19 with ARM Cortex-M4F core running at 120MHz
- Reliable Wireless Connectivity: Equipped with Realtek RTL8720DN, dual-band 2.4Ghz / 5Ghz Wi-Fi
- Highly Integrated Design: 2.4” LCD Screen, IMU and more practical add-ons housed in a compact enclosure with built-in magnets & mounting holes
- Raspberry Pi 40-pin Compatible GPIO
- Compatible with over 300 plug&play Grove modules to explore with IoT
- USB OTG Support
- Support Arduino, CircuitPython, Micropython, ArduPy(What is ArduPy?), AT Firmware, Visual Studio Code
- TELEC certificated
For more information go to https://www.seeedstudio.com/Wio-Terminal-p-4509.html.
Step 1: Setup Wio Terminal and Arduino IDEFor Setup, you can follow this wonderful guide provide by SeeedStudio. Get Started with Wio Terminal, anyway a short video is given below,
Step 2: Setup soil moisture sensorA grove connector is used for connecting the moisture sensor with the wio terminal development board. Pin reference are given below,
Wio terminal to Grove soil moisture
A6 (33) ------------------> SIG
GND -----------------> GND
3.3V ----------------> VCC
Soil moisture sensor does not require any library.
int sensorPin = A6;
int sensorValue = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.print("Moisture = " );
Serial.println(sensorValue);
if ((sensorValue < 300))
{
Serial.println("DRY" );
}
else if ((sensorValue >= 300) and (sensorValue < 600))
{
Serial.println("Moist" );
}
else
{
Serial.println("WET" );
}
delay(1000);
}
//source collected from internet.
The above source is used for testing the soil moisture sensor.
Step 3: Setup soil temperature sensorThe DS18B20 waterproof digital thermal probe or sensor is connected with our board via jumper cable. The pin connections are given below,
Wio terminal to DS18B20 waterproof digital thermal sensor
D8 (37) ------------------> DQ (Yellow Wire)
GND -----------------> GND (Black Wire)
3.3V ----------------> VCC (RED wire)
DS18B20 sensor requires two libraries to reduce the complexity in parsing the code.
- DallasTemperature.h (Dallas Temperature by Miles Burton)
- OneWire.h (One Wire by Paul Stoffregen)
You can download and install this libraries directly through Arduino IDE or manually from our libraries page.
To install directly from IDE follow the below steps:
- Open Arduino IDE and select the Sketch drop down from menu bar
- Choose Include Library and Select Manage Libraries
- Now type the required library name in the search box, choose from the results and tap on install.
- The library is installed successfully.
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is connected to digital pin 8 on the Arduino
#define ONE_WIRE_BUS 8
// Setup a oneWire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);
// Pass oneWire reference to DallasTemperature library
DallasTemperature sensors(&oneWire);
void setup(void)
{
sensors.begin(); // Start up the library
Serial.begin(9600);
}
void loop(void)
{
// Send the command to get temperatures
sensors.requestTemperatures();
//print the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(sensors.getTempCByIndex(0));
Serial.print("ºC | ");
//print the temperature in Fahrenheit
Serial.print((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);
Serial.println("ºF");
delay(500);
}
The above source is used for testing the temperature separately.
Step 4: Setup water motor switch (Mosfet switch)Directly connected to the grove multi-functional port (Right side) of Wio terminal.
This switch does not require any library.
void setup() {
pinMode(D0, OUTPUT);
digitalWrite(D0,LOW);
}
void loop() {
digitalWrite(D0,HIGH);
delay(1000);
digitalWrite(D0,LOW);
delay(1000);
}
The above source is used for testing the Mosfet switch.
Step 5: Setup Grove Color sensorDirectly connected to the grove multi-functional port (left side) of Wio terminal.
First, we need to set up the TCS3472 for the Wio Terminal
Step 5.1: Download and Install Arduino Libraries
open up the Manage Libraries in Arduino IDE from Sketch -> Include Library -> Manage Libraries.
Then search for Adafruit TCS34725 and click Install.
#include <Wire.h>
#include "Adafruit_TCS34725.h"
/* Example code for the Adafruit TCS34725 breakout library */
/* Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3.3V DC
Connect GROUND to common ground */
/* Initialise with default values (int time = 2.4ms, gain = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();
/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X);
void setup(void) {
Serial.begin(9600);
if (tcs.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No TCS34725 found ... check your connections");
while (1);
}
// Now we're ready to get readings!
}
void loop(void) {
uint16_t r, g, b, c, colorTemp, lux;
tcs.getRawData(&r, &g, &b, &c);
// colorTemp = tcs.calculateColorTemperature(r, g, b);
colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
lux = tcs.calculateLux(r, g, b);
Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - ");
Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - ");
Serial.print("R: "); Serial.print(r, DEC); Serial.print(" ");
Serial.print("G: "); Serial.print(g, DEC); Serial.print(" ");
Serial.print("B: "); Serial.print(b, DEC); Serial.print(" ");
Serial.print("C: "); Serial.print(c, DEC); Serial.print(" ");
Serial.println(" ");
}
The above source is used for testing the color sensor separately. collected from the Adafruit TCS34725 breakout library.
Step 6: Setup pH and salinity sensor (Optional)An electrical conductivity probe is used to measure salinity levels as well as soil pH levels. We could not successfully integrate this sensor (EC probe) with our system.
Building the whole systemThe circuit diagram of our system is given below,
The cloud connection is very straight forward. thinger.io cloud platform is used in this project.
Cloud Device creation (Thinger.io setup) short video, refer the thinger.io documentation for details.
Mobile AppsThe mobile apps collects data from thinger.io cloud and visualize them via image and charts. According to the data; the apps provides a push notification. The video demonstration shows everything. I have shared the APK (check the git repository as well as the download link). Note. the apps does not work if the device is not connected with thinger.io cloud. The apps used my cloud credential for communication with thinger.io. refer the thinger.io documentation for more details about credentials.
We have developed a mobile apps for monitoring the plant remotely. You can download the mobile apps (android version) from here.The login email and password are hackster@gmail.com and hackster respectively.
The demo is given below,
Another demonstration video-
ConclusionWe have developed an automatic plant monitoring system for rooftop tomato plants. Several sensors will be used to capture environmental and soil parameters. Micro-controller will be used to manipulate and analyze the sensor data. Manual systems are not very useful for round-the-clock maintenance. Automatic systems are more efficient and economically feasible than manual ones.
Future planWe have plan to implement an algorithm (machine learning based) to automatically determine whether soil properties are suitable for tomato plants. Will apply another ML algorithm for early disease detection of tomato plants. An automatic technique will also be added to protect tomato plants from insects. Several researches and field works are mandatory to achieve those objectives.
Reference1.https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/
2.https://www.circuitbasics.com/raspberry-pi-ds18b20-temperature-sensor-tutorial/
3. https://www.circuitschools.com/interfacing-ds18b20-temperature-sensor-with-arduino-esp8266-esp32/
*Most of the images are collected from internet sources
Comments