Hand Hygienics
2021-06-20 | By M5Stack
License: General Public License Arduino
* Thanks for the source code and project information provided by @Jian Quan@lee sheng kai@Leong Xuan Hao@Teng Hang
About
With the Covid-19 situation, we have decided to build a project that can encourage people to wash their hands. Through researching online publications and news, we found out that majority of people washed their hands incorrectly and ineffectively.
With Hand Hygienics, we aim to solve these problems:
- Remind people to wash their hands
- Ensure that soap, an essential germ-killing ingredient, is available
- Ensure that soap is used
- Ensure that people wash their hand for at least 20 seconds
- Show people the correct way to wash their hands
Driving Question
How can we design a device to ensure that people wash their hands thoroughly and properly?
Product Information
Hand Hygienics aims to reduce spread of Covid-19 through contact. By encouraging users to exercise proper hand-washing techniques, it will improve the overall hygiene of people, reducing the chances of spreading Covid-19.
How it works (Watch Video for more details)
If there is no soap:
- M5 Stack will tell the user to use another sink
If there is soap:
- M5 Stack will remind the user to wash his/her hand, via audio and visual prompts
If user ignores the M5 Stack:
- M5 Stack will return to standby mode if the PIR sensor do not detect motion for a set period of time
If user washes his/her hand:
- M5 Stack will start a 20 seconds countdown (for soaping of hands)
- After which, another 10 seconds countdown will start (for rinsing of hands)
- During countdown, LED Bars at the side slowly change from red to green
- Finally, M5 Stack will display a "Your hands are now clean" message
- Returns to standby mode
Summary of process (with soap, following instructions)
YouTube Link:
Flow Chart
Circuit Implementation
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
setScreenColor(0x305161)
pir0 = unit.get(unit.PIR, (17,16))
tof0 = unit.get(unit.TOF, unit.PAHUB0)
tof1 = unit.get(unit.TOF, unit.PAHUB1)
earth5 = unit.get(unit.EARTH, unit.PORTB)
hide = None
usedsoap = None
washedhands = None
i = None
count = None
label0 = M5TextBox(0, 83, "Wash Your Hands", lcd.FONT_DejaVu56, 0xFFFFFF, rotate=0)
circle0 = M5Circle(297, 22, 10, 0xFFFFFF, 0xFFFFFF)
label1 = M5TextBox(203, 17, "Used Soap", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(202, 44, "Soap Level", lcd.FONT_Default, 0xFFFFFF, rotate=0)
circle1 = M5Circle(297, 50, 10, 0xFFFFFF, 0xFFFFFF)
label4 = M5TextBox(13, 70, "For", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label10 = M5TextBox(3, 19, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label11 = M5TextBox(13, 200, "Fingers", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
label3 = M5TextBox(13, 33, "Soap Your Hands", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label5 = M5TextBox(60, 58, "20", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=0)
label6 = M5TextBox(120, 70, "Seconds", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label7 = M5TextBox(13, 149, "Remeber To", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
label8 = M5TextBox(14, 179, "Scrub Your Hands", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
image0 = M5Img(203, 135, "res/step2.jpg", True)
label9 = M5TextBox(3, 2, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
from numbers import Number
def mainitems(hide):
global usedsoap, washedhands, i, count
if hide:
circle0.hide()
circle1.hide()
label0.hide()
label1.hide()
label2.hide()
label9.hide()
label10.hide()
else:
circle0.show()
circle1.show()
label0.show()
label1.show()
label2.show()
label9.show()
label10.show()
def countdownitems(hide):
global usedsoap, washedhands, i, count
if hide:
label3.hide()
label4.hide()
label5.hide()
label6.hide()
label7.hide()
label8.hide()
label11.hide()
image0.hide()
else:
label3.show()
label4.show()
label5.show()
label6.show()
label7.show()
label8.show()
image0.show()
def CountDown():
global hide, usedsoap, washedhands, i, count
mainitems(True)
countdownitems(False)
label3.setText('Soap Your Hands')
for i in range(20, 0, -1):
if i == 20:
rgb.setColorAll(0x990000)
rgb.setBrightness(100)
if i == 18:
label8.setText('Rub Your Palms')
image0.changeImg("res/step3.jpg")
rgb.setColorAll(0xff0000)
if i == 13:
label11.show()
label8.setText('Lather Between')
image0.changeImg("res/step4.jpg")
rgb.setColorAll(0x993300)
if i == 8:
label11.hide()
label8.setText('Wash Fingernails')
image0.changeImg("res/step8.jpg")
rgb.setColorAll(0xff6600)
if i == 5:
label8.setText('Scrub The Back')
image0.changeImg("res/step5.jpg")
rgb.setColorAll(0xffff00)
if i >= 10:
label5.setText(str(i))
else:
label5.setText(str((str(' ') + str(str(i)))))
wait(1)
label3.setText('Rinse Your Hands')
for i in range(10, 0, -1):
if i == 10:
label8.setText('Rinse Hands With')
label11.setText('Water')
label11.show()
rgb.setColorAll(0x33ff33)
image0.changeImg("res/step10.jpg")
if i >= 10:
label5.setText(str(i))
else:
label5.setText(str((str(' ') + str(str(i)))))
wait(1)
label11.hide()
countdownitems(True)
mainitems(True)
setScreenColor(0x33cc00)
label0.setText('Your Hands are CLEAN')
label0.show()
rgb.setColorAll(0x33cc00)
wait(2)
setScreenColor(0x336666)
rgb.setBrightness(0)
def soapchecker():
global hide, usedsoap, washedhands, i, count
label10.setText(str(earth5.analogValue))
if (earth5.analogValue) >= 500:
circle1.setBgColor(0x33ff33)
elif (earth5.analogValue) >= 100:
circle1.setBgColor(0xff9900)
if (earth5.analogValue) < 100:
return False
return True
def washing():
global hide, usedsoap, washedhands, i, count
while not washedhands:
if btnB.isPressed():
break
if (tof0.distance) > 80 and (tof1.distance) > 80:
label0.setText('Wash Your Hands')
elif usedsoap and (tof0.distance) <= 80:
CountDown()
washedhands = True
elif (tof1.distance) <= 80:
usedsoap = True
elif (tof0.distance) <= 80:
label0.setText('USE SOAP')
image0.show()
if (tof1.distance) <= 80:
usedsoap = True
if pir0.state:
count = 0
else:
count = (count if isinstance(count, Number) else 0) + 1
wait_ms(100)
if count == 50:
washedhands = True
label9.setText(str(count))
statusupdate()
def statusupdate():
global hide, usedsoap, washedhands, i, count
if usedsoap:
circle0.setBgColor(0x33ff33)
else:
circle0.setBgColor(0xff0000)
countdownitems(True)
while True:
mainitems(False)
usedsoap = False
washedhands = False
if (pir0.state) == 1:
lcd.setBrightness(100)
label0.show()
if soapchecker():
speaker.tone(1800, 200)
label0.setText('Wash Your Hands')
washing()
else:
label0.setText('Use the next sink')
circle1.setBgColor(0xff0000)
rgb.setColorAll(0xff0000)
else:
label0.hide()
lcd.setBrightness(0)
usedsoap = False
washedhands = False
statusupdate()
wait_ms(2)
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum