This Arduino project uses ultrasonic sensors to detect people entering or exiting an area. When detected, it plays a welcome or thank you audio message using the DFPlayer Mini MP3 module.
- 🎵 Plays "Welcome" audio when a person is detected at the entry point.
- 🎵 Plays "Thank you" audio when a person is detected at the exit point.
- 📏 Uses ultrasonic distance measurement to detect presence within 5 meters.
- 🔊 Uses DFPlayer Mini for standalone audio playback (no need for internet or computer).
Component | Quantity |
---|---|
Arduino Uno/Nano | 1 |
HC-SR04 Ultrasonic Sensor | 2 |
DFPlayer Mini MP3 Module | 1 |
MicroSD Card (formatted FAT32) | 1 |
Speaker (3W recommended) | 1 |
Jumper Wires | As needed |
Breadboard (optional) | 1 |
Module | Arduino Pin |
---|---|
Entry Trigger | D2 |
Entry Echo | D3 |
Exit Trigger | D4 |
Exit Echo | D5 |
DFPlayer RX (to TX) | D10 |
DFPlayer TX (to RX) | D11 |
DFPlayer VCC | 5V |
DFPlayer GND | GND |
⚠️ Important:
Store the following MP3 files on the SD card:
0001.mp3
→ Welcome message0002.mp3
→ Thank you message
- Format a microSD card as FAT32.
- Add two MP3 files:
0001.mp3
– Welcome message0002.mp3
– Thank you message
- Insert the SD card into the DFPlayer Mini module.
- Wire all components as per the pin configuration above.
- Upload the Arduino code provided in this repository.
- Power the system and test it by walking in front of the entry and exit sensors.
// Entry sensor detects presence and plays welcome message
if (distanceEntry > 0 && distanceEntry <= 500) {
myDFPlayer.play(1); // 0001.mp3
}
// Exit sensor detects presence and plays thank-you message
if (distanceExit > 0 && distanceExit <= 500) {
myDFPlayer.play(2); // 0002.mp3
}
Libraries Used //DFRobotDFPlayerMini
Install via Arduino Library Manager: Sketch > Include Library > Manage Libraries > Search "DFRobotDFPlayerMini"
Author Developed by: MADAN.R GitHub: https://github.com/Madannayak003
License This project is licensed under the MIT License - free to use and modify.