yanyi wongTenh Qin ZhengJonathan Nggermaine
Published

EGC177_C7_Sustainable Monitoring system for vertical farming

MeetGreenGuard: the ultimate vertical farming monitor. Real-time data on light intensity and soil moisture. Maximise yields, minimise waste.

IntermediateShowcase (no instructions)243
EGC177_C7_Sustainable Monitoring system for vertical farming

Things used in this project

Story

Read more

Schematics

Powerpoint Slides

Code

Light Monitoring System

Python
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
rgb2 = unit.get(unit.RGB, unit.PORTA)
light3 = unit.get(unit.LIGHT, unit.PORTB)
earth1 = unit.get(unit.EARTH, unit.PORTD)
servo0 = unit.get(unit.SERVO, unit.PORTE)






title0 = M5Title(title="Smart Environmental Monitoring System ", x=3, fgcolor=0x000000, bgcolor=0x9cd0ff)
LightText = M5TextBox(0, 142, "text", lcd.FONT_Ubuntu, 0xFFFFFF, rotate=0)
label1 = M5TextBox(0, 208, "Indoor Brightness :", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
label0 = M5TextBox(240, 208, "Text", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
image2 = M5Img(0, 30, "res/default.jpg", True)


while True:
  if (light3.analogValue) / 10 > 5 and (light3.analogValue) / 10 <= 25:
    image2.changeImg("res/default.jpg")
    LightText.setText('Turning on LED light to 200units')
    label0.setText(str(light3.analogValue))
    rgb2.setColorFrom(1, 3, 0xffff66)
    rgb2.setBrightness(200)
  elif (light3.analogValue) / 10 > 25 and (light3.analogValue) / 10 <= 50:
    image2.changeImg("res/default.jpg")
    label0.setText(str(light3.analogValue))
    LightText.setText('Turning on LED light to 100units')
    rgb2.setColorFrom(1, 3, 0x999900)
    rgb2.setBrightness(100)
  elif (light3.analogValue) / 10 > 50:
    image2.changeImg("res/default.jpg")
    label0.setText(str(light3.analogValue))
    LightText.setText('Natural light is at the perfect level')
    rgb2.setColorFrom(1, 3, 0x333300)
    rgb2.setBrightness(0)
  else:
    image2.changeImg("res/default.jpg")
    speaker.tone(1800, 500)
    label0.setText('OFF')
    LightText.setText('Night time, LED light is switched off')
    rgb2.setColorFrom(1, 3, 0x333300)
    rgb2.setBrightness(0)
    wait(6)
  wait_ms(2)

Soil Moisture System

Python
from m5stack import *
from m5ui import *
from uiflow import *
from servo import Servo
import unit

setScreenColor(0x222222)
servo_0 = unit.get(unit.SERVO, unit.PORTA)
earth_0 = unit.get(unit.EARTH, unit.PORTB)






label0 = M5TextBox(14, 152, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
title0 = M5Title(title="Smart Environmental Monitoring System", x=3, fgcolor=0x000000, bgcolor=0x9cd0ff)
image0 = M5Img(14, 39, "res/default.jpg", True)
label1 = M5TextBox(16, 195, "Moisture Level:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(140, 195, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label3 = M5TextBox(194, 195, "unit", lcd.FONT_Default, 0xFFFFFF, rotate=0)


servo0 = Servo(26,50,500,2500,180)
servo_0.write_angle(0)
while True:
  label2.setText(str(earth_0.analogValue))
  if (earth_0.analogValue) <= 100:
    label0.setText('Allow Water To Flow')
    image0.changeImg("res/drysoil.jpg")
    servo_0.write_angle(0)
  elif (earth_0.analogValue) > 200:
    label0.setText('Stopping Water Flow')
    image0.changeImg("res/wetsoil(2).jpg")
    servo_0.write_angle(90)
  wait_ms(2)

Credits

yanyi wong
1 project • 1 follower
Tenh Qin Zheng
2 projects • 2 followers
Jonathan Ng
1 project • 2 followers
germaine
1 project • 3 followers

Comments