Another Interactive Art Project

A local artist, David Burton, asked if I could add some electronics to his art so that it will play a song when a person stands in front of it.  So of course I immediately set to work on making a shopping list of parts and built a prototype.  Luckily there is already a single circuit board you can buy from Adafruit that has onboard storage for sound files (WAV and OGG) and an amplifier so you can screw in a speaker directly and play the sounds/music.  It’s made for props like blasters or swords to make laser sounds when you pull a trigger or swooshing sounds when you swing a sword.  You can also put music on it and play the different songs based on which button you press (numbered pins you connect to ground) which all I needed was a single song and a single button.

I also needed a way to detect when someone stands in front of it.  In order to detect when the person is within a specific distance (exactly 1 foot or less away for example) I decided to use a sonar distance detector.  This returns a number that represents the distance.  But now I needed another piece in the middle that could turn that number into a simple on/off that the sound board needed to start and stop the music.  I chose an Arduino Nano since it was small and inexpensive and I didn’t really need any bells or whistles or many I/O pins.

I had to write some code for the Nano that would read in the number from the ultrasonic sonar distance sensor.  Then if the number was less than 1 foot away it would turn another pin on itself to OFF (connect to ground) and back to ON (5 volts) if the number was more than 1 foot away.  I then just connected that pin on the arduino to the pin on the sound board that plays the song.

Finally, the speaker just screws into the sound board and is ready to play!  Total cost of the project is around $50 to $75 depending on how many of each thing you buy or if you have any of this laying around.  You can get speakers from broken electronics for example. And to make it even easier, the whole thing is powered from any USB external phone charger battery like this one.

Click here for all the photos and a video showing how it works:  https://photos.app.goo.gl/UeAbLiLBqPiRFuNP8

 

About Joshua Pritt

Taught myself how to program Applesoft BASIC when I was 12. Been programming in various languages ever since.