Arduino song playback from analog input

Hello!

Im pretty much a beginner with arduino boards. I have nano and mega, but i have only used them to control some RGB LEDs in a past.

Current Parts:

  • Neato Controlled robot vacuum
  • Arduino Nano & Mega 2560
  • Neato stock piezo speaker

Idea:

I want the vacuum robot to play back several custom sounds during different situations. I have already thought a two "easily" executable situations.

When robot is docked, it's both two state leds either lit white or orange.

When they are white, robot is ready to clean, when they are orange, robot needs dust bin empty, or filter clean. When they blink orange, robot is charging and is not ready to clean.

At first, i when i start normal cleaning, only the robots "house clean button is lit white, Spot clean button is not on. I want the robot to start playing Terminator 2 Main Theme only the house clean button (white) is on. And i only want it to play once.

When i start spot cleaning, only the robots "spot clean button" is lit white, house cleaning button is not on. I want the robot to start playing Terminator 2 "Trust Me" theme. And i only want it to play once.

What kind of hardware and what kind of code i need to project like this?

Some kind of audio shield to arduino with microsd card? Better speaker? Wires from leds, wired to arduino analog inputs?

Sorry for my english, its not my main language.

  • J

That sounds completely possible. Reading the status LEDs shouldn't be too hard. You may need to use an optoisolators to isolate the Arduino from the robot.
There are a couple of ways you can play audio. There is a library called TMRh20pcm that can be used to playback audio straight from the Arduino itself, all you need is an SD card and maybe an external amplifier.
You could also use the Adafruit Wave Shield. This is nice because it is a complete unit that doesn't need additional circuitry.
. Another option is a external player like the DFPlayer Mini, which has a built-in amplifier and SD card holder. It is easy to control with an Arduino with serial commands.

If you are wanting to play tunes then you should search for MP3 players like this;
http://www.hobbytronics.co.uk/mp3-arduino-shield

If you want the system to have sound effects there was a link posted not that long ago that sounded good as it let several sound effects happen simultaneously - but I cannot find the post :frowning:

Thanks for all the quick replies:

Heres the example video of my idea: