Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Heng Jing SengTypical UserJia HongLisa Joseph
Published

Agrosmart Monitoring and Watering System

Our project is designed for monitoring humidity, temperature, and moisture levels, with the added capability of regulating soil moisture.

BeginnerFull instructions provided12 hours459
Agrosmart Monitoring and Watering System

Things used in this project

Hardware components

M5Stack FIRE IoT Development Kit (PSRAM 2.0)
M5Stack FIRE IoT Development Kit (PSRAM 2.0)
The is the brain to everything. Theres a qr code too you can connect your phone too
×1
PbHUB Unit
M5Stack PbHUB Unit
You can connect 6 units with this unit. And this unit can only connect to Port A
×1
I2C Hub 1 to 6 Expansion TCA9548A Module
M5Stack I2C Hub 1 to 6 Expansion TCA9548A Module
This is PaHub. It is called I2C hub. It can connect 6 units and can only connect to port A of the m5stack
×1
Mini HUB Unit 1 to 3 HUB
M5Stack Mini HUB Unit 1 to 3 HUB
This is the Grove Hub. It can connect to 3 units but sort of with no restrictions of which port of the m5stack
×1
Earth Module Grove Compatible Soil monitoring
M5Stack Earth Module Grove Compatible Soil monitoring
This unit detects the moisture of the soil
×1
M5Stack RGB Unit with NeoPixel RGB LED (SK6812)
M5Stack RGB Unit with NeoPixel RGB LED (SK6812)
This helps the plant grow better.by providing light
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
The servo motor is used to release water depending on the soil moisture. If the earth unit is above 800 it will turn to 0 degrees to stop water from flowing. But if the earth unit is below 800 it will turn 90 degrees and start to water the plant
×1
ENV III Unit with Temperature Humidity Air Pressure Sensor (SHT30+QMP6988)
M5Stack ENV III Unit with Temperature Humidity Air Pressure Sensor (SHT30+QMP6988)
The unit can detect the humidity, temperature and pressure of the environment so user can keep track of the plant
×1
Light Unit with Photo-resistance
M5Stack Light Unit with Photo-resistance
This detects the lighting of the environment and tells the user whether the plant is in a dark/ shady or bright area
×1
iPhone
Apple iPhone
You can use your phone to connect to the m5stack to keep track of the humidity, temperature, pressure and moisture. You can also control the servo and light of the RGB unit
×1

Software apps and online services

M5stack Uiflow V1.13.1

Story

Read more

Schematics

Our slides

This is the slides of our project

Block Diagram

Connections

https://www.canva.com/design/DAF7WXmKaJ4/UCY8L0C4PFVvEc-2ZjzMHg/view?utm_content=DAF7WXmKaJ4&utm_campaign=designshare&utm_medium=link&utm_source=editor (You can go look at the canva link)

the board

We organized the wires and threaded it

flowchart

So here is the flow chart :D

Code

The uiflow code for V1.13.1

Python
This is for AgroSmart Watering and Monitoring System
https://flow.m5stack.com/
from m5stack import *
from m5ui import *
from uiflow import *
from servo import Servo
import unit
remoteInit()
import machine

setScreenColor(0x222222)
env2_0 = unit.get(unit.ENV2, unit.PAHUB0)
earth_0 = unit.get(unit.EARTH, unit.PORTB)
pahub_0 = unit.get(unit.PAHUB, unit.PORTA, 0x70)
pbhub_0 = unit.get(unit.PBHUB, unit.PAHUB1)


switch_value = None
slider_value = None



title0 = M5Title(title="remote temp sensor", x=3, fgcolor=0xFFFFFF, bgcolor=0x0000FF)
temperature = M5TextBox(13, 47, "temp:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(57, 47, "label1", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(90, 73, "label2", lcd.FONT_Default, 0xFFFFFF, rotate=0)
condition1 = M5TextBox(13, 73, "Condition:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
humidity = M5TextBox(13, 112, "humidity:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label3 = M5TextBox(83, 112, "label3", lcd.FONT_Default, 0xFFFFFF, rotate=0)
rectangle1 = M5Rect(13, 101, 120, 1, 0xFFFFFF, 0xFFFFFF)
pressure = M5TextBox(13, 140, "pressure:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label4 = M5TextBox(83, 140, "label4", lcd.FONT_Default, 0xFFFFFF, rotate=0)
moisture = M5TextBox(190, 122, "moisture:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label5 = M5TextBox(267, 122, "label5", lcd.FONT_Default, 0xFFFFFF, rotate=0)
condition2 = M5TextBox(184, 140, "Condition:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label6 = M5TextBox(256, 140, "label6", lcd.FONT_Default, 0xFFFFFF, rotate=0)
rectangle2 = M5Rect(13, 163, 120, 1, 0xFFFFFF, 0xFFFFFF)
darkness = M5TextBox(13, 170, "darkness:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label7 = M5TextBox(10, 194, "label7", lcd.FONT_Default, 0xFFFFFF, rotate=0)
title1 = M5Title(title="AgroSmart PlantCare System", x=3, fgcolor=0xFFFFFF, bgcolor=0x0000FF)
condition3 = M5TextBox(5, 216, "Condition:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label8 = M5TextBox(83, 216, "label8", lcd.FONT_Default, 0xFFFFFF, rotate=0)
circle0 = M5Circle(132, 194, 15, 0xffff01, 0xffff00)
image0 = M5Img(220, 0, "res/dry.jpg", True)
degrees = M5TextBox(105, 47, "'C", lcd.FONT_Default, 0xFFFFFF, rotate=0)
percent = M5TextBox(153, 112, "%", lcd.FONT_Default, 0xFFFFFF, rotate=0)
unit = M5TextBox(64, 194, "unit", lcd.FONT_Default, 0xFFFFFF, rotate=0)
hpa = M5TextBox(147, 140, "hPa", lcd.FONT_Default, 0xFFFFFF, rotate=0)








def gauge_Temperature_callback():
  global switch_value, slider_value, env2_0, earth_0, pahub_0, pbhub_0 
  return env2_0.temperature
def label_humidity_callback():
  global switch_value, slider_value, env2_0, earth_0, pahub_0, pbhub_0 
  return env2_0.humidity
def label_pressure_callback():
  global switch_value, slider_value, env2_0, earth_0, pahub_0, pbhub_0 
  return env2_0.pressure
def label_darkness_callback():
  global switch_value, slider_value, env2_0, earth_0, pahub_0, pbhub_0 
  return pbhub_0.analogRead(0)
def label_moisture_callback():
  global switch_value, slider_value, env2_0, earth_0, pahub_0, pbhub_0 
  return earth_0.analogValue
def switch_servomotor_callback(switch_value):
  global slider_value, env2_0, earth_0, pahub_0, pbhub_0 
  if switch_value == 1:
    if (earth_0.analogValue) < 50:
      speaker.setVolume(1)
      servo0.write_angle(90)
    elif (earth_0.analogValue) > 800:
      servo0.write_angle(0)
    else:
      servo0.write_angle(90)
  else:
    servo0.write_angle(0)

def slider_redgreenblue_callback(slider_value):
  global switch_value, env2_0, earth_0, pahub_0, pbhub_0 
  if slider_value > 66:
    rgb.setColorAll(0x3333ff)
    pbhub_0.setColor(5, 0, 3, 0x3366ff)
  elif slider_value == 0:
    rgb.setColorAll(0x000000)
    pbhub_0.setColor(5, 0, 3, 0x000000)
  elif slider_value < 33:
    rgb.setColorAll(0xff0000)
    pbhub_0.setColor(5, 0, 3, 0xff0000)
  else:
    rgb.setColorAll(0x009900)
    pbhub_0.setColor(5, 0, 3, 0x009900)

lcd.qrcode('https://flow.m5stack.com/remote?id=944542085745344512', 200, 155, 85)
servo0 = Servo(26,50,500,2500,180)
servo0.write_angle(0)
while True:
  label1.setText(str(env2_0.temperature))
  label3.setText(str(env2_0.humidity))
  label4.setText(str(env2_0.pressure))
  label5.setText(str(earth_0.analogValue))
  label7.setText(str(pbhub_0.analogRead(0)))
  if (env2_0.temperature) > 27:
    label2.setText('too warm!')
  elif (env2_0.temperature) < 15:
    label2.setText('Too Cold!')
  else:
    label2.setText('Just Nice!')
  if (pbhub_0.analogRead(0)) > 700:
    circle0.setBgColor(0x000000)
    circle0.setBorderColor(0xffffff)
    label8.setText('darkness')
  elif (pbhub_0.analogRead(0)) < 650:
    circle0.setBgColor(0xffff00)
    circle0.setBorderColor(0xffffff)
    label8.setText('light')
  else:
    circle0.setBgColor(0x663366)
    circle0.setBorderColor(0xffffff)
    label8.setText('shade')
  if (earth_0.analogValue) < 50:
    image0.changeImg("res/dry.jpg")
    label6.setText('dry')
  elif (earth_0.analogValue) > 800:
    image0.changeImg("res/verywet.jpg")
    label6.setText('too wet')
  else:
    image0.changeImg("res/justnice.jpg")
    label6.setText('justnice')
  wait_ms(2)

Credits

Heng Jing Seng
1 project • 0 followers
just a student
Contact
Typical User
1 project • 1 follower
Contact
Jia Hong
1 project • 1 follower
Contact
Lisa Joseph
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.