Maker.io main logo

SEAM [Safe-Entry Access Machine]

2022-03-02 | By M5Stack

License: General Public License Temperature Temperature (IR) Arduino

* Thanks for the source code and project information provided by @Team SEAM: Poh Lawrance, Syyaffff, Daniel Ong

 

Youtube Video Link: https://youtu.be/uq1aktEwZaE

 

2

SEAM [Safe-Entry Access Machine]

 

Design an Automatic Safe-Entry system that require little or no manpower to facilitate the Safe-Entry for all retail shops, offices, buildings, etc.

Most equipment in use for Safe-entry are convenience and require less manpower to operate. But the Team realized that it can be improved.

1. There are thermometer that is mounted on tripod but either it suits your height or you have to lower your head to get your temperature measured. If you are shorter than the tripod, like children. Ambassadors will need to use the handheld Thermometer. Why not make the thermometer height adjustable?

2. Different mode of check in, QR code for mobile app check in/out mounted on the queue poles or walls. QR code scanner for TraceTogether token and ID scanner for ID check in. We place all the check in and out into 1 location just after you get your temperature scanned.

3. Ambassador deployed at the Safe-Entry site to remind the public about maintaining safe distancing when checking in. We can use the available sensors to help them.

4. More often, we do not know the number of people restricted in the retails shop, especially during busy hours when the staff are busy with customers. Why not have a counter system that denies entry if the shop has reached the maximum capacity allowed?

The whole idea works similarly to a carpark gantry system. It has a counter to inform the driver of the number of lots available. If full, it will deny entry until someone scans out. Scanning the ERP in-vehicle unit upon entry and exit will be similar to temperature taking and checking in via Mobile apps / ID / token.

 

 

SEAM Circuits Design

1

 

Block Diagram

2

 

Code

SEAM (Main Code)Python
This code is programed to:
1. Set the total number of visitors allowed at any one time.
2. Adjust thermometer height to suit user.
3. Take Temperature of user
4. Check in via access card or QR code
 
Copy Code
from m5stack import *
from m5ui import *
from uiflow import *
import time
import machine
import unit

setScreenColor(0x222222)
servo1 = unit.get(unit.SERVO, unit.PORTB)
env24 = unit.get(unit.ENV2, unit.PAHUB1)
rfid4 = unit.get(unit.RFID, unit.PAHUB2)
pahub4 = unit.get(unit.PAHUB, unit.PORTA)
pir0 = unit.get(unit.PIR, (13, 5))


count = None
Pax = None
X = None
Totalcount = None
A1 = None
PWM0 = machine.PWM(26, freq=50, duty=7, timer=0)


line2 = M5Line(M5Line.PLINE, 160, 40, 160, 200, 0xfe0404)
Cover = M5Img(0, 10, "res/SEAM1.jpg", True)
divider = M5TextBox(65, 99, "/", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=0)
line3 = M5Line(M5Line.PLINE, 0, 200, 320, 200, 0xfe0505)
line4 = M5Line(M5Line.PLINE, 0, 40, 320, 40, 0xf80707)
LabelTemp = M5TextBox(180, 59, "Temperature", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
LabelCheckIn = M5TextBox(15, 58, "Checked In", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
LabelQR = M5TextBox(189, 205, "QR Code", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
Degree = M5Img(261, 142, "res/Temp.jpg", True)
Crowd = M5Img(99, 140, "res/Crowd.jpg", True)
Gear = M5Img(72, 63, "res/Gear.jpg", True)
Header = M5Title(title="Welcome to SEAM", x=3, fgcolor=0xFFFFFF, bgcolor=0xff0000)
up = M5Triangle(65, 205, 50, 234, 80, 234, 0xFFFFFF, 0xFFFFFF)
Down = M5Triangle(160, 235, 140, 205, 175, 205, 0xFFFFFF, 0xFFFFFF)
Enter = M5TextBox(210, 205, "Enter", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
LabelCount = M5TextBox(146, 99, "0", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=0)
Instruction = M5TextBox(0, 20, "Instruction", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
LabelTC = M5TextBox(90, 99, "0", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=0)
LabelPax = M5TextBox(22, 99, "0", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=0)
Temp = M5TextBox(189, 99, "Temp", lcd.FONT_DejaVu40, 0xFFFFFF, rotate=0)
QR = M5Img(200, 81, "res/QR.jpg", True)




speaker.setVolume(0.2)
Header.hide()
Cover.hide()
up.hide()
Down.hide()
Enter.hide()
Cover.show()
rgb.setColor(5, 0x6600cc)
rgb.setColor(6, 0x6600cc)
rgb.setColor(1, 0x000000)
rgb.setColor(2, 0x000000)
rgb.setColor(3, 0x000000)
rgb.setColor(4, 0x000000)
rgb.setColor(7, 0x000000)
rgb.setColor(8, 0x000000)
rgb.setColor(9, 0x000000)
rgb.setColor(10, 0x000000)
wait(0.5)
rgb.setColor(4, 0x6600cc)
rgb.setColor(7, 0x6600cc)
wait(0.5)
rgb.setColor(3, 0x6600cc)
rgb.setColor(8, 0x6600cc)
wait(0.5)
rgb.setColor(2, 0x6600cc)
rgb.setColor(9, 0x6600cc)
wait(0.5)
rgb.setColorAll(0x6600cc)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0x6600cc)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0x6600cc)
wait(1)
rgb.setColorAll(0x000000)
Cover.hide()
speaker.sing(988, 1/2)
speaker.sing(784, 1/2)
Header.show()
up.show()
Down.show()
Enter.show()
count = 0
LabelCount.setText(str(count))
Instruction.setText('Set the No of people:')
Pax = 0
X = 0
while True:
if X == 0:
if btnA.isPressed():
count = count + 1
LabelCount.setText(str(count))
wait(0.5)
elif btnB.isPressed():
count = count - 1
LabelCount.setText(str(count))
if count <= 0:
count = 0
LabelCount.setText(str(count))
wait(0.5)
elif btnC.isPressed():
Totalcount = count
Instruction.setText('The total count allow are')
LabelCount.setText(str(Totalcount))
rgb.setColorAll(0x33cc00)
wait(1)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0x33cc00)
wait(1)
rgb.setColorAll(0x000000)
speaker.sing(988, 1/2)
speaker.sing(784, 1/2)
X = X + 1
elif X == 1:
if Pax >= Totalcount:
Instruction.setText('Capacity is Full, Please wait.')
LabelPax.setText(str(Pax))
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
Pax = Pax - 1
elif Pax < Totalcount:
X = X + 1
LabelCount.hide()
Instruction.setText('Adjust the motor')
PWM0.resume()
A1 = 7
LabelTemp.hide()
LabelCheckIn.hide()
line2.hide()
line3.hide()
line4.hide()
LabelPax.hide()
divider.hide()
Crowd.hide()
Degree.hide()
LabelTC.hide()
Temp.hide()
Gear.show()
up.show()
Down.show()
Enter.show()
elif X == 2:
if (btnA.isPressed()) and A1 > 3:
wait_ms(10)
A1 = A1 - 0.1
PWM0.duty(A1)
if A1 <= 3:
up.setBgColor(0x666666)
up.setBorderColor(0xff0000)
wait(1)
up.setBgColor(0xffffff)
up.setBorderColor(0xffffff)
elif (btnB.isPressed()) and A1 < 12:
wait_ms(10)
A1 = A1 + 0.1
PWM0.duty(A1)
if A1 >= 12:
Down.setBgColor(0x666666)
Down.setBorderColor(0xff0000)
wait(1)
Down.setBgColor(0xffffff)
Down.setBorderColor(0xffffff)
elif btnC.isPressed():
Gear.hide()
rgb.setColorAll(0x33cc00)
wait(1)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0x33cc00)
wait(1)
rgb.setColorAll(0x000000)
speaker.sing(988, 1/2)
speaker.sing(784, 1/2)
PWM0.pause()
up.hide()
Down.hide()
Enter.hide()
LabelTemp.show()
LabelCheckIn.show()
line2.show()
line3.show()
line4.show()
line2.setColor(0xff0000)
line3.setColor(0xff0000)
line4.setColor(0xff0000)
Crowd.show()
Degree.show()
divider.show()
Instruction.setText('Please take your Temperature')
LabelPax.show()
LabelTC.show()
LabelPax.setText(str(Pax))
LabelTC.setText(str(Totalcount))
wait(1)
X = X + 1
elif X == 3:
if (pir0.state) == 1:
if (env24.temperature) >= 37.5:
Instruction.setText('Entry denied.')
Temp.setText(str(env24.temperature))
Temp.setColor(0xff0000)
speaker.sing(220, 1)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
wait(0.5)
rgb.setColorAll(0xff0000)
wait(0.5)
rgb.setColorAll(0x000000)
X = 1
LabelQR.hide()
Temp.setColor(0xffffff)
elif (env24.temperature) < 37.5:
LabelQR.show()
wait(0.5)
Instruction.setText('Scanning for Temperature')
wait(0.5)
Temp.setText(str(env24.temperature))
wait(0.5)
Instruction.setText('Check in')
rgb.setColorAll(0x33cc00)
X = X + 1
elif X == 4:
if btnC.isPressed():
Degree.hide()
LabelQR.hide()
LabelTemp.hide()
Temp.hide()
QR.show()
wait(5)
QR.hide()
Pax = Pax + 1
Instruction.setText('Door Open')
wait(2)
Instruction.setText('Door Close')
X = 1
elif rfid4.isCardOn():
Pax = Pax + 1
LabelQR.hide()
Instruction.setText('Door Open')
wait(2)
Instruction.setText('Door Close')
X = 1
wait_ms(2)
SEAM (Sub Code) Python
The code is written to ensure the next person who is waiting behind the user who is checking in is maintaining 1m distancing. If it detects the person behind is less than 1 meter away, it will sound off with flashing LED and display warning.
 
Copy Code
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x030303)
tof0 = unit.get(unit.TOF, unit.PORTA)





Warning = M5TextBox(15, 32, "warning", lcd.FONT_Comic, 0xff0000, rotate=0)
Warning2 = M5TextBox(7, 208, "warning 2", lcd.FONT_DejaVu18, 0xfff302, rotate=0)
title0 = M5Title(title=" Safe-Distancing", x=3, fgcolor=0x350707, bgcolor=0xff009a)
image0 = M5Img(53, 67, "res/Safe-3.jpg", True)


rgb.setBrightness(200)
lcd.setBrightness(200)
Warning.setText('Please step back!')
Warning2.setText('Maintain Social-Distancing :)')
while True:
if tof0.distance:
if (tof0.distance) <= 200:
image0.hide()
title0.hide()
Warning.show()
Warning2.show()
speaker.sing(147, 1/4)
rgb.setColorAll(0xff0000)
wait(0.1)
rgb.setColorAll(0xffff00)
wait(0.1)
else:
title0.show()
image0.show()
rgb.setColorAll(0x33ff33)
Warning2.hide()
Warning.hide()
wait_ms(2)
 
制造商零件编号 K007
M5STACK FIRE IOT DEV KIT (PSRAM)
M5Stack Technology Co., Ltd.
制造商零件编号 K007-V26
DEV KIT FIRE IOT PSRAM V2.6
M5Stack Technology Co., Ltd.
制造商零件编号 U001-C
ENV III UNIT WITH TEMPERATURE HU
M5Stack Technology Co., Ltd.
制造商零件编号 U004
PIR MOTION SENSOR (AS312)
M5Stack Technology Co., Ltd.
制造商零件编号 U040-B
I2C HUB 1 ~ 6 EXPANSION PCA9548A
M5Stack Technology Co., Ltd.
制造商零件编号 U031-B
MINI RFID UNIT 2 WS1850S
M5Stack Technology Co., Ltd.
制造商零件编号 U010
TIME-OF-FLIGHT UNIT VL53L0X
M5Stack Technology Co., Ltd.
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.