joashBestian TanJevier LauOng Jun Yang
Published

Hydrobuddy | Smart Hydration Reminder System

Hydrobuddy is a smart device that prompts users to drink water at regular intervals, ensuring consistent hydration throughout the day.

BeginnerFull instructions providedOver 2 days207
Hydrobuddy | Smart Hydration Reminder System

Things used in this project

Story

Read more

Schematics

Main Poster Board

Full Walkthrough in Youtube

Driving Question and Project Intro

Workflow Diagram

WaterLevel Calculations

Code

Main M5Stack Code

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


setScreenColor(0x222222)
tof_0 = unit.get(unit.TOF, unit.PAHUB0)
env2_0 = unit.get(unit.ENV2, unit.PAHUB5)


waterlevel = None
timer = None



WaterLevel = M5TextBox(39, 50, "Water Level :", lcd.FONT_Ubuntu, 0x36e9ff, rotate=0)
temp = M5TextBox(39, 109, "Temperature :", lcd.FONT_Ubuntu, 0x36e9ff, rotate=0)
label0 = M5TextBox(227, 55, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(227, 112, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label3 = M5TextBox(86, 168, "Congrats on finishing!", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(90, 203, "Time to Drink Water!", lcd.FONT_Default, 0xFFFFFF, rotate=0)

from numbers import Number




while True:
  waterlevel = 8467 - 387 * (tof_0.distance)
  timer = (timer if isinstance(timer, Number) else 0) + 1
  label2.hide()
  label3.hide()
  rgb.setColorAll(0x33ccff)
  label0.setText(str(waterlevel))
  label1.setText(str(env2_0.temperature))
  wait(10)
  rgb.setColorAll(0xff0000)
  label2.show()
  speaker.tone(1800, 5000)
  if waterlevel == 0:
    label3.show()
    label2.hide()
    rgb.setColorAll(0x33ff33)
  wait_ms(2)

Credits

joash
1 project • 0 followers
Contact
Bestian Tan
1 project • 0 followers
Contact
Jevier Lau
1 project • 0 followers
Contact
Ong Jun Yang
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.