Generally, the ultrasonic module is used for motion control project. In this blog, we will apply the music play shield and ultrasonic module together to make a motion control music player. The music play shield has an on-board SD card socket that is used for music files storage. There is also a USB port for external USB flash disk connecting. Ultrasonic module, we use HC-SR04. This module is not the perfect one, and you can visit the comparing ultrasonic module blog to get more details. When HC-SR04 detects different distances, it will send different signals to tell music play shield to play the next song or the previous one.
1. Hook up them together
Plug music play shield into Iteaduino UNO, and connect HC-SR04 to music play shield.
2. Upload demo into UNO
Download the demo here, and upload it to the UNO. Please pay attention to set the parameter of distance. As HC-SR04 has blind spot in less than 7cm, you’d better set the distance beyond 7cm.
After demo uploading, feel free to do the motion control for this music player! As the music play shield has been taken only 4 pins occupied, that means you can add some more ultrasonic module to realize other functions such as voice volume controlling and so on.