Yash Chandra
Published

Smart Irrigation System (using M5STACK)

This project is a machine that will water your plants for you without any human input.

IntermediateShowcase (no instructions)290
Smart Irrigation System (using M5STACK)

Things used in this project

Hardware components

SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
AC/DC Adapter
×1
Pump (for water)
×1
Light Pipe, 12.7 mm
Light Pipe, 12.7 mm
×1
Relay (generic)
×1

Software apps and online services

Python

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Python Code

Python
from m5stack import *
from m5ui import *
from uiflow import *
import machine
from easyIO import *
import unit
 
setScreenColor(0x000000)
pbhub1 = unit.get(unit.PBHUB, unit.PORTA)
 
 
 
 
title0 = M5Title(title="Smart Plant", x=3 , fgcolor=0xFFFFFF, bgcolor=0x0b9bd3)
label0 = M5TextBox(77, 28, "Smart Plant", lcd.FONT_Comic,0xffffff, rotate=0)
label1 = M5TextBox(15, 70, "This machine will", lcd.FONT_Comic,0x0aea47, rotate=0)
label2 = M5TextBox(19, 102, "help you take care of", lcd.FONT_Comic,0x0aea47, rotate=0)
num = M5TextBox(5, 208, "getting...", lcd.FONT_Comic,0x04b4d5, rotate=0)
label3 = M5TextBox(17, 134, "your plants", lcd.FONT_Comic,0x0aea47, rotate=0)
 
 
while True:
 pin0 = machine.Pin(26, mode=machine.Pin.IN, pull=machine.Pin.PULL_UP)
 if (digitalRead(26)) == True:
   num.setText('Water not present')
 else:
   num.setText('Water present')
 if (digitalRead(26)) == False:
   wait_ms(500)
 if (digitalRead(26)) == True:
   pbhub1.digitalWrite(0, 0, 0)
   wait_ms(325)
   pbhub1.digitalWrite(0, 0, 1)
   wait(60)
 wait_ms(2)

Credits

Yash Chandra

Yash Chandra

1 project • 0 followers
Hi

Comments