It's time to make parties with friends, but, in our pandemic era (with new #omicron covid-19 variant), remember to stay with health and safety!
Xmas Party Fever Control#25projectsofchristmas challenge, is a proposal to help people to stay away from other people with fever, blocking them at entrance in public places or house.
This project is mainly based on an Esp32 device as M5Stack Core Grey (or similar) and the IR contactless body sensor, a built-in infrared sensor MLX90614 (M5Stack NCIR Unit), put the sensor on the grove PORT A.
I found this devices very easy to integrate like a "Lego" blocks.
To coding I am using UiFlow for some graphics skeleton (also to load background image), coding the rest in micropython using the useful ide Thonny.
- Operating voltage: 4.5 to 5.5V
- Measuring object temperature range: -70°C ~ 380°C
- Measuring ambient temperature range: -40 to 125 ˚C
- Measurement accuracy at room temperature: ±0.5°C
- Field of view: 90°
- Software Development Platform: Arduino, UIFlow (Blockly, Python)
- Two Lego-compatible holes
Features
So to prevent access to a person (hope not!) in potentially Covid-19 (now Omicron) positive state (cause suspected fever above 37.5 degrees) we can use the Not Contact IR Body sensor to verify his body temperature at wrist
Describing the use cases, other that showing body temperature, we show on display following messages:
IF (NCIR >= 34.50 OR <=37.5) --> Gain access to person, (message "Grant access")
IF (NCIR >=37.6) --> Deny access to person, (message "Grant Denied")
IF (NCIR < 34.50) --> (message "BODY TEMP TOO LOW")
To make the application more flexible and usable to centralizing control, we are using MQTT protocol to simply publish the "topic" temperature value (m5s/fever)
on a remote server, in this case i'm using http://www.hivemq.com/demos/websocket-client/ but every MQTT broker is good, in my case I have this application integrated on OpenHab for domotic IOT control.
The code
As you can see, the code is quite simple and, hope, self explained.
At beginning there is the import section of the M5stack modules, then the MQTT and WIFI settings.
All the main code is into While loop
All the code and the image xmas_party.jpg courtesy of https://www.freeimageslive.co.uk/free_stock_image/xmas-decorations-jpg are available on my github repository
Enjoy it and Happy XMAS 2021!
# Xmas Party Fever control
# ver 1.0
#by gian luigi perrella
from m5stack import *
from m5ui import *
from uiflow import *
from m5mqtt import M5mqtt
import wifiCfg
import time
import unit
#initialize string to publish body temp
a = None
# Using HIVEMQ mqtt broker, point your browser at http://www.hivemq.com/demos/websocket-client/
# and fill the field ADD NEW TOPIC SUBSCRIPTION with the topic m5s/fever
m5mqtt = M5mqtt('m5Fever', 'broker.mqttdashboard.com', 1883, '', '', 300)
lcd.clear()
setScreenColor(0x111111)
image1 = M5Img(0, 0, "res/xmas_party.jpg", True)
label6 = M5TextBox(30, 10, "XMas Fever control", lcd.FONT_DejaVu24,0xFFFFFF, rotate=0)
wait_ms(10000)
label6 = M5TextBox(30, 10, "XMas Fever control", lcd.FONT_DejaVu24,0xFFFFFF, rotate=0)
label4 = M5TextBox(60, 60, "", lcd.FONT_DejaVu24,0x00FF00, rotate=0)
#initialize M5Stack NCIR sensor unit
ncir0 = unit.get(unit.NCIR, unit.PORTA)
#initialize wifi connection
wifiCfg.doConnect('your_SSID', 'your_Password')
m5mqtt.start()
temptext = M5TextBox(40, 180, "BODY TEMP:", lcd.FONT_DejaVu18,0xFFFFFF, rotate=0)
tempval = M5TextBox(210, 180, "0", lcd.FONT_DejaVu18,0xFFFFFF, rotate=0)
label5 = M5TextBox(40, 208, "", lcd.FONT_DejaVu18,0xFFFFFF, rotate=0)
while True:
wait_ms(1000)
temperatura = (str(ncir0.temperature +4)) # sensor NCIR not so precise, add some value to correct
a = temperatura
m5mqtt.publish(str('m5s/fever'),str(a))
tempval.setText(temperatura)
label4.setColor(0x00FF00)
if (str(temperatura) >= '34.50' and str(temperatura) < '37.50'):
label4.setText("GRANT ACCESS")
label5.setText("CHECK BODY TEMP OK")
wait_ms(5000)
elif str(temperatura) >= '37.60': #need correction to body temp
tempval.setColor(0xFF0000)
label5.setText("CHECK BODY TEMP KO")
label4.setColor(0xFF0000)
label4.setText("GRANT DENIED")
speaker.tone(freq=800, duration=1)
wait_ms(5000)
tempval.setColor(0xffffff)
elif str(temperatura) <= '34.50':
label5.setText("BODY TEMP TOO LOW")
label4.setText("")
wait_ms(10000)
Comments
Please log in or sign up to comment.