Arduino - Motion Sensor - MP3 Player
In this tutorial, we'll delve into the utilization of Arduino, an HC-SR501 motion sensor, and an MP3 player to trigger the playback of a recorded audio file upon detecting motion. This project is versatile and can be tailored for applications like automatically delivering recorded audio instructions or warnings whenever a human presence is detected.
Hardware Required
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
About MP3 Player and Motion Sensor
If you do not know about MP3 player and motion sensor (pinout, how it works, how to program ...), learn about them in the following tutorials:
Wiring Diagram
This image is created using Fritzing. Click to enlarge image
Motion Sensor Initial Setting
Time Delay Adjuster | Screw it in anti-clockwise direction fully. |
Detection Range Adjuster | Screw it in clockwise direction fully. |
Repeat Trigger Selector | Put jumper as shown on the image. |
Preparation
- Pre-store the recorded mp3 file that we want to play to the micro SD Card.
- Insert the micro SD Card to the MP3 player module
- Connect the MP3 player module to Arduino
- Connect the speaker to the MP3 player module to a
- Connect the speaker to a power source.
- Connect the motion sensor to the Arduino.
Arduino Code - Motion Sensor Controls MP3 Player
Quick Steps
- Connect Arduino to PC via USB cable
- Open Arduino IDE, select the right board and port
- Copy the above code and open with Arduino IDE
- Click Upload button on Arduino IDE to upload code to Arduino
- Move your hand in front of sensor
- Check out the audio from MP3 player
Video Tutorial
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.