|
Wio-TerminalSeeed
|
x 1 | |
|
Wio-Terminal-Chassis-BatterySeeed
|
x 1 | |
|
DHT11 Temperature and Relative Humidity Sensor Module |
x 1 | |
|
watering-unitM5Stack
|
x 1 |
|
arduino IDEArduino
|
|
|
Blynk |
|
|
3D Printer (generic) |
Smart Indoor Harvesting Using Wio Terminal & Blynk
Motivation
This project is basically designed and programmed by my daughter, Sashrika with little help from me. She participated in 2021 do-your-bit contest where she prototyped indoor plant harvesting system using Micro:bit. Since then, she was asking me how enhance her project so that she can control certain things in a smarter way.
I suggested her to use Wio Terminal for some obvious reasons.
1. In-Build Display
2. In-Build WiFi
3. Rich community support
4. Easy integration with Blynk
Basically all you need to get started with cloud connected IoT solution. For more information about Wio Terminal, visit this
Though Wio Terminal has 40 pins where you can connect multiple analog and I2C sensors, it's nice to have an expansion board with in-build battery pack. I have used this chassis from Seeed's studio which has four additional digital/analog, one UART Grove connectors.
How To Integrate Wio Terminal With Blynk
I am not going to document the steps here as there is a superb documentation already available on seeedstudio wiki. Follow the tutorial and you will be all set to build your own Blynk app.
Once you create your Blynk app, upload the code ( maalee.ino in code section ) after putting blynk auth code and your wifi credential.
Blynk Widgets
When you build your Blynk app, you need to add following widgets
1. One Gauge with Virtual Pin 1 for temperature
2. One Gauge with Virtual Pin 2 for humidity
3. One Gauge with Virtual Pin 3 for soil moisture
4. One Super Chart with 2 data streams - one for moisture and one for soil moisture
5. One Slider with Virtual pin 6 to control moisture threshold
6. One Slider with Virtual pin 7 to control darkness threshold
7. One Timer, choose your own timer to start and stop LED strip
8. One Notification
Hardware Connections
Connections used in this project can't be easier. I have used all grove sensors which are just plugged into grove sockets. No wiring, no soldering needed except LED strip.
#define PIN_PUMP 3
#define PIN_SOIL 2
#define DHTPIN 4
#define PIN_LIGHT 6
#define PIN_RELAY 0
Integrated pump and soil moisture sensor connected to top-right socket ( pin 2 & 3 )
DHT11 sensor connected to bottom-right socket ( pin 4 )
Relay is connected to top-left socket ( pin 0 )
Light sensor is connected to bottom-left socket ( pin 6 )
LED strip is connected to the relay via battery charging module.
Features
Real time display ??
Realtime display of room temperature, humidity, ambient light and soil moisture level on Wio Terminal's display. Same data can be viewed from Blynk app from anywhere. No matter how far you are from home.
Automatic Watering ??
When soil gets dry, system automatically turns the pump on and water the plants. This threshold can be updated from the Blynk app based on your plants need. You don't need to change your code for different plants.
Automatic Lightings ??
LEDs are on and off based on predefined schedule. You can set the schedule on Blynk app without touching the code. When the schedule is on, system also checks for ambient light. If it's bright, such as very sunny day, system automatically turn the LEDs off to save energy. This light threshold can also be adjusted from the Blynk app.
I hope this project will inspire some of you to try out Wio Terminal and start harvesting your own plants ??
#define BLYNK_PRINT Serial
#include "TFT_eSPI.h" //TFT LCD library
#include "DHT.h" // DHT library
#include <Wire.h>
#include <rpcWiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleWioTerminal.h>
char auth[] = "your_blynk_token";
char ssid[] = "your_wifi_name";
char pass[] = "your_wifi_password";
//Definitions of pins
#define PIN_PUMP 3
#define PIN_SOIL 2
#define DHTPIN 4
#define PIN_LIGHT 6
#define PIN_RELAY 0
#define DHTTYPE DHT11 //Define DHT sensor type
//Initializations
DHT dht(DHTPIN, DHTTYPE); //Initializing DHT sensor
TFT_eSPI tft; //Initializing TFT LCD'
TFT_eSprite spr = TFT_eSprite(&tft); //Initializing buffer
//Variables
int sensorValue = 0;
int inBetweenTimer = 0;
long lastNotification = 0;
int moistureThreshold = 50;
int lightThreshold = 750;
long moistureAvr = 0;
long moistureReadingCounter = 0 ;
/**
This method is called from Blynk Timer settings.
When the timer starts, relay is turned on
When the timer stops, relay is turned off
*/
BLYNK_WRITE(V5)
{
int value = param.asInt();
//value 1 is sent from Blynk when timer starts
if (value == 1 ) {
Serial.println("Turn on LEDS");
digitalWrite(PIN_RELAY, HIGH);
inBetweenTimer = 1;
} else {
//value 0 is sent from Blynk when timer stops
Serial.println("Turn off LEDS");
digitalWrite(PIN_RELAY, LOW);
inBetweenTimer = 0;
}
}
//slider to change moistureThreshold from Blynk
BLYNK_WRITE(V6)
{
moistureThreshold = param.asInt();
}
//slider to change lightThreshold from Blynk
BLYNK_WRITE(V7)
{
lightThreshold = param.asInt();
}
void setup() {
//Start serial communication
Serial.begin(9600);
pinMode(PIN_PUMP, OUTPUT);
pinMode(PIN_SOIL, INPUT);
pinMode(PIN_LIGHT, INPUT);
pinMode(PIN_RELAY, OUTPUT);
//turning the LEDs off at startup
digitalWrite(PIN_RELAY, LOW);
//Start DHT sensor
dht.begin();
//Start TFT LCD
tft.begin();
//Set TFT LCD rotation
tft.setRotation(3);
tft.setTextSize(2);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_LIGHTGREY);
tft.drawString("Connecting to ", 70, 80);
tft.setTextSize(4);
tft.drawString("Blynk", 80, 120);
//connecting to Blynk cloud
Blynk.begin(auth, ssid, pass);
//Syncing all variable values from Blynk cloud to device
Blynk.syncAll();
tft.fillScreen(TFT_BLACK);
//Setting the title header
tft.fillRect(0, 0, 320, 50, TFT_YELLOW); //Rectangle fill with dark green
tft.setTextColor(TFT_BLACK); //Setting text color
tft.setTextSize(3); //Setting text size
tft.drawString("Maalee", 100, 10); //Drawing a text string
tft.drawFastVLine(150, 50, 160, TFT_DARKGREEN); //Drawing verticle line
tft.drawFastHLine(0, 130, 320, TFT_DARKGREEN); //Drawing horizontal line
tft.drawFastHLine(0, 210, 320, TFT_DARKGREEN); //Drawing horizontal line 2
tft.setTextColor(TFT_LIGHTGREY);
tft.setTextSize(1);
tft.drawString("Temperature", 10, 60);
tft.setTextSize(1);
tft.drawString("Humidity", 10, 140);
tft.setTextSize(1);
tft.drawString("Soil Moisture", 160, 60);
tft.setTextSize(1);
tft.drawString("Darkness", 160, 140);
}
void loop() {
int t = dht.readTemperature(); //Assign variable to store temperature
t = t * 1.8 + 32;
int h = dht.readHumidity(); //Assign variable to store humidity
//Setting temperature
spr.createSprite(100, 30);
spr.fillSprite(TFT_BLACK);
spr.setTextColor(TFT_LIGHTGREY);
spr.setTextSize(3);
spr.drawNumber(t, 5, 5);
spr.drawString("F", 45, 5);
spr.pushSprite(35, 80);
spr.deleteSprite();
//Setting humidity
spr.createSprite(100, 30);
spr.fillSprite(TFT_BLACK);
spr.setTextColor(TFT_LIGHTGREY);
spr.setTextSize(3);
spr.drawNumber(h, 5, 5);
spr.drawString("%", 45, 5);
spr.pushSprite(35, 160);
spr.deleteSprite();
//Setting soil moisture
sensorValue = analogRead(PIN_SOIL); //Store moisture sensor value
//map moisture reading to 0-100 %
int moistPct = map(sensorValue, 450, 560, 0, 100);
if (moistPct > 100) {
moistPct = 100;
} else if (moistPct < 0) {
moistPct = 0;
}
moistPct = 100 - moistPct;
moistureReadingCounter = moistureReadingCounter + 1;
moistureAvr = moistureAvr + moistPct;
spr.createSprite(150, 50);
spr.fillSprite(TFT_BLACK);
spr.setTextColor(TFT_LIGHTGREY);
spr.setTextSize(3);
spr.setTextColor(TFT_LIGHTGREY);
spr.drawNumber(moistPct, 5, 5);
spr.drawString("%", 45, 5);
spr.setTextSize(1);
spr.drawNumber(sensorValue, 105, 25);
spr.pushSprite(165, 80);
spr.deleteSprite();
//Setting light
int light = analogRead(PIN_LIGHT); //Store light sensor value
spr.createSprite(150, 30);
spr.fillSprite(TFT_BLACK);
spr.setTextColor(TFT_LIGHTGREY);
spr.setTextSize(3);
spr.drawNumber(light, 5, 5);
spr.pushSprite(165, 160);
spr.deleteSprite();
//take moisture reading for 2 minutes and calculate average
if (moistureReadingCounter > 120 ) {
moistPct = (int) (moistureAvr / moistureReadingCounter);
//turn on the pump for 2 seconds if moisture level goes below threshold
if (moistPct < moistureThreshold ) {
// String msg = "Pump is on. Moisture level is " + String(moistPct);
// Blynk.notify(msg);
digitalWrite(PIN_PUMP, HIGH);
delay(2000);
digitalWrite(PIN_PUMP, LOW);
}
moistureReadingCounter = 0;
moistureAvr = 0;
}
//send notification if moisture level goes below 25%
if (moistPct < 25) {
if (lastNotification == 0 || (millis() - lastNotification) > 60 * 60 * 1000) {
lastNotification = millis();
Blynk.notify("Soil is too dry. Check the reservoir.");
}
}
//turn off the LEDs when ambient light is bright and Blynk timer is on.
if (inBetweenTimer == 1) {
if (light > lightThreshold) { //DARK
digitalWrite(PIN_RELAY, HIGH);
}
else { //BRIGHT
digitalWrite(PIN_RELAY, LOW);
}
}
Blynk.virtualWrite(V1, t);
Blynk.virtualWrite(V2, h);
Blynk.virtualWrite(V3, moistPct);
Blynk.virtualWrite(V4, light);
delay(100);
}
Smart Indoor Harvesting Using Wio Terminal & Blynk
- Comments(1)
- Likes(3)
- 1 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
-
7design
-
8usability
-
8creativity
-
7content
More by mithundotdas
- Mahout - Save The Elephants ?? Save The ElephantsLet's work together and save the beautiful elephants using cutting edge technol...
- Smart Indoor Harvesting Using Wio Terminal & Blynk MotivationThis project is basically designed and programmed by my daughter, Sashrika with little hel...
- A. Eye - Watch out for vehicles This is a getting started guide for beginners to Intel Compute Stick and OpenVINO. I will be using p...
- Touchless ATM using Augmented Reality Stop The SpreadPrevent spreading of COVID-19 is very critical to flatten the curve. Research has fou...
- Basement Monitoring Using Wio Terminal and Blynk MotivationI live in East Coast of USA where most of the houses have basements, some are finished, so...
- Buddy - A personal home office assistance What Problem Are We Talking About ?Corona virus out-break has put our lives upside dow, creating new...
- AI powered thermal camera for safe camping The ProblemI like camping but I am not a "camping enthusiast", I usually camp once or twice a year w...
- Pet Activity Tracker using XIAO BLE Sense & Edge Impulse StoryWhy should human have all the fitness trackers? Our pets deserve more to stay active. I am usin...
- Protect Peatlands for people and planet with help of SensiML The 1997 Indonesia fire burned 9.7– 11.7 million ha on Borneo and Sumatra, destroying 4.5–6 million ...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
125 0 0 -
DIY Laser Power Meter with Arduino
182 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
165 0 2 -