Rasheeda BanuLiwei SuStrength-of-spear-Gerdy
Published

3 in 1 Sanitiser Dispenser

We have devised with an innovation that dispenses hand sanitiser, measures the temperature of user, shows the count of people in vicinity.

AdvancedFull instructions provided2 days339
3 in 1 Sanitiser Dispenser

Things used in this project

Story

Read more

Schematics

Fritzing circuit

This is our fritzing circuit for the above-mentioned project

Code

Python coding for project

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

setScreenColor(0x222222)
env22 = unit.get(unit.ENV2, unit.PAHUB0)
servo5 = unit.get(unit.SERVO, unit.PORTB)
pir6 = unit.get(unit.PIR, unit.PORTB)
pahub2 = unit.get(unit.PAHUB, unit.PORTA)
tof2 = unit.get(unit.TOF, unit.PAHUB5)


Total = None
PWM0 = machine.PWM(26, freq=50, duty=3, timer=0)


label0 = M5TextBox(46, 49, "Temp :", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(142, 49, "0", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(113, 112, "Please Hold", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label3 = M5TextBox(135, 165, "0", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label4 = M5TextBox(55, 162, "Total :", lcd.FONT_Default, 0xFFFFFF, rotate=0)




Total = 0
while True:
  label1.setText(str(env22.temperature))
  while Total < 5:
    rgb.setColorFrom(1 , 5 ,0x33cc00)
    if (tof2.distance) < 1000:
      if (pir6.state) == 1:
        label2.setText('Please Hold')
        wait(2)
        PWM0.duty(12)
        wait(2)
        PWM0.duty(3)
        Total = Total + 1
        label3.setText(str(Total))
        wait(0.5)
      else:
        label2.setText('Not Detected')
  rgb.setColorFrom(1 , 5 ,0x000000)
  rgb.setColorFrom(6 , 10 ,0xff0000)
  if btnB.isPressed():
    wait(1)
    Total = 0
    rgb.setColorFrom(6 , 10 ,0x000000)
    rgb.setColorFrom(1 , 5 ,0x33cc00)
  wait_ms(2)

Credits

Rasheeda Banu

Rasheeda Banu

1 project • 0 followers
Liwei Su

Liwei Su

1 project • 0 followers
Strength-of-spear-Gerdy

Strength-of-spear-Gerdy

1 project • 0 followers

Comments