xianpeng zhang
Published © CERN-OHL2

Wio Terminal Automatic watering device

Use Wio Terminal to design a device to automatically monitor soil moisture, and start the water pump when the soil moisture is low.

BeginnerShowcase (no instructions)2 hours422
Wio Terminal Automatic watering device

Things used in this project

Hardware components

Wio Terminal
Seeed Studio Wio Terminal
×1
Grove - Relay
Seeed Studio Grove - Relay
×1
Grove - Capacitive Moisture Sensor (Corrosion Resistant)
Seeed Studio Grove - Capacitive Moisture Sensor (Corrosion Resistant)
×1
RS365Sump pump(5V~12V)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Custom parts and enclosures

backplane

Schematics

Connection diagram

Code

watering program

Arduino
#include"TFT_eSPI.h"
#include"Free_Fonts.h" //include the header file
#define dwq PIN_WIRE_SCL
#define turang A0
TFT_eSPI tft;
unsigned long soilTimer ;
void setup() {
  // put your setup code here, to run once:
  pinMode( turang , INPUT );
  pinMode ( dwq , OUTPUT );
  Serial.begin( 115200 );
   tft.begin();
  pinMode(WIO_LIGHT, INPUT);
  tft.setRotation(3);
  tft.fillScreen(TFT_BLACK); //Black background
 
  tft.setFreeFont(&FreeSansBoldOblique12pt7b); //select Free, Sans, Bold, Oblique, 12pt.
}

void loop() {
  // put your main code here, to run repeatedly:
  int trVale= analogRead( turang );
  
  if( trVale > 600 ){
     tft.fillScreen(0xF800);
     tft.drawString("Soil water shortage", 70, 100);
     tft.drawString("Start irrigation", 110, 140);
     digitalWrite( dwq , HIGH );
     delay ( 2000 );
    
  }
  
  else if( trVale > 510 &&  trVale <=580  ){
    tft.fillScreen(0x45CF);
    tft.drawString("Continue to", 70, 100);
    tft.drawString("supplement irrigation", 50, 140);
    digitalWrite( dwq , HIGH );
    delay ( 1000 );
  }
  else{
    digitalWrite( dwq , LOW );
    
    
    tft.fillScreen(0x07E0);
    tft.drawString("Soil humidity", 70, 100);
    tft.drawString("is normal", 110, 140);
  }
   delay ( 1000 );
}

Credits

xianpeng zhang
1 project • 1 follower

Comments