Mask Detection System using ESP32 Cam and M5Stack Core2
In this project, we will make a device to detect if a person is wearing a mask and has a healthy heart rate using M5Stack Core2, ESP32-CAM, AWS IoT, and Edge Impulse.
- Suitable forB.Tech IoT students
- Build time3-4 weeks
- LevelIntermediate
- Available atAjvika Labs, Kakinada
About this project
In this project, we will make a device to detect if a person is wearing a mask and has a healthy heart rate using M5Stack Core2, ESP32-Cam, AWS IoT, and Edge Impulse. After the pandemic, most of the offices will start for on-site work and schools will start, during this time we also need to take care of any employee or student is having correct body temperature and is wearing a mask. Instead of hiring someone and risking their life to check the temperature and mask for so many employees and students, is a tough task. So to solve this problem, we want to create a device that monitors their heart rate and checks wearing masks using the Edge Impulse model on AWS IoT Edukit and Embedded Camera.
Previously, we have used Heart Rate Sensor in many projects, you can check them out
Arduino Based Heartbeat Monitor
Designing a Smartwatch using ESP32 Part 2 - Ambient Light and Heart Rate Sensors
IoT Based Heart Rate Monitor using MAX30100 Pulse Oximeter and ESP32
Heart Beat Monitoring using PIC Microcontroller and Pulse Sensor
A fully Functional DIY ESP32 Smartwatch with multiple Watch Faces, Heart Rate Sensor, Compass and Games
Compact Arduino Based Pulse Oximeter Sensor Circuit
Also learn more about M5Stack Core2 by going through Introducing M5Stack Core2 - An ESP32 based IoT Development Kit.
Component Required for Mask and Health Management System
Project Used Hardware
KY-039 Heart Rate Sensor,
KY-039 Heart Rate Sensor,
Perf Board and Wires
Perf Board and Wires
Project Used Software
Project Hardware Software Selection
All the Computer Vision will be completely done over ESP32 Cam using a Deep Learning model. The Mask Detection model is trained on Edge Impulse and the generated library is used in ESP32 CAM. The Data is sent to AWS IoT using MQTT and major alerts like Person is Not Wearing Mask is sent as an email to Admin using AWS SES Flow:
The IR Distance sensor will check when the user is standing in front of the Device and start the camera and heart sensor
The IR Distance sensor will check when the user is standing in front of the Device and start the camera and heart sensor
Read the Image and inference it on Mask Model.
Read the Image and inference it on Mask Model.
Check whether Employee/Person is wearing Mask using Mask Classification Model trained on Edge Impulse
Check whether Employee/Person is wearing Mask using Mask Classification Model trained on Edge Impulse
Send Predictions to M5Core2 using UART communication.
Send Predictions to M5Core2 using UART communication.
Then Check the Pulse Rate using Pulse Sensor and send it to M5Core2 to display on the screen.
Then Check the Pulse Rate using Pulse Sensor and send it to M5Core2 to display on the screen.
If results are showing that the person is not healthy then that case will be reported to the admin using AWS IoT and SMTP via SES.
If results are showing that the person is not healthy then that case will be reported to the admin using AWS IoT and SMTP via SES.
Whenever the user is detected the predictions are sent to AWS via MQTT to AWS IoT Cloud and when there are any people who are not wearing masks then it will also be send via eMAIL using SMTP of AWS SES service.
Initially Create Thing in AWS IoT and set up the certificate and MQTT URL.
Initially Create Thing in AWS IoT and set up the certificate and MQTT URL.
It will generate a unique URL for the host URL and also give a topic in form of \"$aws/things/NAME/FUNCTION\"
It will generate a unique URL for the host URL and also give a topic in form of \"$aws/things/NAME/FUNCTION\"
Set Up the Credentials in code as: int PORT = 8883; char MQTT_SUB[] = \"$aws/things/NAME/shadow/update\"; char MQTT_PUB[] = \"$aws/things/NAME/shadow/update\"; Also set up the credentials of certificates of CA Certificates, Client Certificate and private Key downloaded earlier.
Set Up the Credentials in code as: int PORT = 8883; char MQTT_SUB[] = \"$aws/things/NAME/shadow/update\"; char MQTT_PUB[] = \"$aws/things/NAME/shadow/update\"; Also set up the credentials of certificates of CA Certificates, Client Certificate and private Key downloaded earlier.
Using the Pubsubclient library the M5Stack publishes data to IoT Cloud.
Using the Pubsubclient library the M5Stack publishes data to IoT Cloud.
Verify your email and set up the HTTPS API of AWS SES.
Verify your email and set up the HTTPS API of AWS SES.
The requested URL is of the form: https://EMAIL.us-east-1.amazonaws.comAction=SendEmail&Source=DESTINATIONEMAIL
Sent the request with other parameters like the subject of mail and body of the mail.
Sent the request with other parameters like the subject of mail and body of the mail.
First the OV2640 Camera on ESP32Cam reads the image of the user's face and stores it in a buffer. That buffer is then transferred to neural network and processed. The Predictions are sent to M5COre2 via UART ( 13, 14 Pins on M5COre2). The Heart Rate sensor Data pin is connected to pin 36 of M5Stack Core2 and power is 5V and Ground The IR Distance sensor Data pin is connected to pin 35 of M5Stack Core2 and power is 5V and Ground.
Complete Project Code
Previously, we have used Heart Rate Sensor in many projects, you can check them out
Arduino Based Heartbeat Monitor
Designing a Smartwatch using ESP32 Part 2 - Ambient Light and Heart Rate Sensors
IoT Based Heart Rate Monitor using MAX30100 Pulse Oximeter and ESP32
Heart Beat Monitoring using PIC Microcontroller and Pulse Sensor
A fully Functional DIY ESP32 Smartwatch with multiple Watch Faces, Heart Rate Sensor, Compass and Games
Compact Arduino Based Pulse Oximeter Sensor Circuit
Also learn more about M5Stack Core2 by going through Introducing M5Stack Core2 - An ESP32 based IoT Development Kit.
Component Required for Mask and Health Management System
Project Used Hardware
KY-039 Heart Rate Sensor,
KY-039 Heart Rate Sensor,
Perf Board and Wires
Perf Board and Wires
Project Used Software
Project Hardware Software Selection
All the Computer Vision will be completely done over ESP32 Cam using a Deep Learning model. The Mask Detection model is trained on Edge Impulse and the generated library is used in ESP32 CAM. The Data is sent to AWS IoT using MQTT and major alerts like Person is Not Wearing Mask is sent as an email to Admin using AWS SES Flow:
The IR Distance sensor will check when the user is standing in front of the Device and start the camera and heart sensor
The IR Distance sensor will check when the user is standing in front of the Device and start the camera and heart sensor
Read the Image and inference it on Mask Model.
Read the Image and inference it on Mask Model.
Check whether Employee/Person is wearing Mask using Mask Classification Model trained on Edge Impulse
Check whether Employee/Person is wearing Mask using Mask Classification Model trained on Edge Impulse
Send Predictions to M5Core2 using UART communication.
Send Predictions to M5Core2 using UART communication.
Then Check the Pulse Rate using Pulse Sensor and send it to M5Core2 to display on the screen.
Then Check the Pulse Rate using Pulse Sensor and send it to M5Core2 to display on the screen.
If results are showing that the person is not healthy then that case will be reported to the admin using AWS IoT and SMTP via SES.
If results are showing that the person is not healthy then that case will be reported to the admin using AWS IoT and SMTP via SES.
Whenever the user is detected the predictions are sent to AWS via MQTT to AWS IoT Cloud and when there are any people who are not wearing masks then it will also be send via eMAIL using SMTP of AWS SES service.
Initially Create Thing in AWS IoT and set up the certificate and MQTT URL.
Initially Create Thing in AWS IoT and set up the certificate and MQTT URL.
It will generate a unique URL for the host URL and also give a topic in form of \"$aws/things/NAME/FUNCTION\"
It will generate a unique URL for the host URL and also give a topic in form of \"$aws/things/NAME/FUNCTION\"
Set Up the Credentials in code as: int PORT = 8883; char MQTT_SUB[] = \"$aws/things/NAME/shadow/update\"; char MQTT_PUB[] = \"$aws/things/NAME/shadow/update\"; Also set up the credentials of certificates of CA Certificates, Client Certificate and private Key downloaded earlier.
Set Up the Credentials in code as: int PORT = 8883; char MQTT_SUB[] = \"$aws/things/NAME/shadow/update\"; char MQTT_PUB[] = \"$aws/things/NAME/shadow/update\"; Also set up the credentials of certificates of CA Certificates, Client Certificate and private Key downloaded earlier.
Using the Pubsubclient library the M5Stack publishes data to IoT Cloud.
Using the Pubsubclient library the M5Stack publishes data to IoT Cloud.
Verify your email and set up the HTTPS API of AWS SES.
Verify your email and set up the HTTPS API of AWS SES.
The requested URL is of the form: https://EMAIL.us-east-1.amazonaws.comAction=SendEmail&Source=DESTINATIONEMAIL
Sent the request with other parameters like the subject of mail and body of the mail.
Sent the request with other parameters like the subject of mail and body of the mail.
First the OV2640 Camera on ESP32Cam reads the image of the user's face and stores it in a buffer. That buffer is then transferred to neural network and processed. The Predictions are sent to M5COre2 via UART ( 13, 14 Pins on M5COre2). The Heart Rate sensor Data pin is connected to pin 36 of M5Stack Core2 and power is 5V and Ground The IR Distance sensor Data pin is connected to pin 35 of M5Stack Core2 and power is 5V and Ground.
Complete Project Code
Technologies used
Hardware components
- ESP32
- ESP8266
- Arduino
- DHT22
- Relay
- OLED
- NodeMCU
Software & tools
- Arduino IDE
- Blynk
- Firebase Console
- Node-RED
- MQTT Broker
Project demo video
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.