Motion activated mp3 player
This is a very simple motion activated mp3 player. The goal is to let the sound start after the sonic sensor has detected a presence and stop when the person goes away.
Is a piece of an artistic installation.
My programming skills are very low, so I've made a cut&past work... It still needs to be refined!
Is more or less a proof of concept!
Since the ultrasonic sensor sometimes detects a presence, even if there's none, I've added a control variable "check".
The idea is: everytime the sensor detects an obstacole (in this setup, the distance is intentionally very low, but once installed it should be around 1mt) the variable "Check" is incremented by 1. When there's no detection, check is decremented by 1. When "check" is > 380 the playback starts. When the listener goes away, "check" is decremented and when it reaches 0, the mp3 stops.
Right now the code is very poorly implemented, I will refine it later. But it works.
The next step is to build a wooden box and use a led stripe to create a fading light (the light increases while the person stands in front of the box, and will stays at full during playback, when the person goes away the light will switches off.)