Instructables
Picture of Arduino Audio Input
Send sound into your Arduino.  This Instructable will show you how to prepare audio so that it can be sampled and processed by an Arduino to make sound responsive projects and audio effects.  (This article is a companion to another Instructable I've written about building an audio output circuit for an Arduino, find that here)

Some ideas that come to mind include:

beat detection- trigger lighting effects, build a set of turntables that beat match themselves, or make a robot that dances along with the music you play for it
amplitude detection- make a simple vu meter with LEDS
frequency analysis- you could make a project that reacts to different frequencies in different ways, recognizes certain melodies, turns audio into MIDI data, or translates incoming frequencies into square waves with the tone() library
digital effects boxes/digital signal processing- check out what I did with my vocal effects box (all processing done with Arduino), lots of possibilities here: pitch bending, distortion, sampling, delay, reverb, granular synthesis, mixing, and much more...  I've provided code in this Instructable that lets you sample at up to 38.5kHz.  Here is another instructable describing how to set up a simple audio out circuit with Arduino.
digital recorder- with the addition of an SD card of course (the Arduino has very limited memory by itself), this opens up the possibility of looping large samples and doing lots of other digital manipulations to pieces of stored audio  The circuits and code provided here are compatible with SD card shields that communicate via SPI.
graphical representations of sound- Arduino oscilloscope/visualizer

Feel free to use any of the info in this Instructable to put together an amazing project for the DIY Audio Contest!  We're giving away an HDTV, some DSLR cameras, and tons of other great stuff!  The contest closes Nov 26.

Parts list:
(x1) Microphone Radioshack 33-3038
(x1) TL072 Digikey 296-14997-5-ND or TL082 Digikey 296-1780-5-ND (TL081/TL071 are fine too)  I used a tl082 in my examples
(x2) 9V battery
(x2) 9V battery snap connector Radioshack 270-324
(x1) mono audio jack 1/4" Radioshack 274-340  or Radioshack 274-252 or 1/8" Radioshack 274-333 or Radioshack 274-251
(x1) LED Digikey C513A-WSN-CV0Y0151-ND
(x1) 10kOhm potentiometer linear Digikey 987-1301-ND
(x3) 100kOhm 1/4watt resistors Digikey CF14JT100KCT-ND
(x1) 10uF electrolytic capacitor Digikey P5134-ND
(x1) 47nF ceramic capacitor Digikey P4307-ND
(x1) Arduino Uno (Duemilanove is fine too) Sparkfun DEV-09950

Additional Materials:
22 gauge wire
solder
 
Remove these adsRemove these ads by Signing Up
1-40 of 207Next »

Hi Amanda,

First of all, thank you for writing such a detailed instructable.

If you have time and still monitor this thread, I would quite like to understand what is actually going on in the setup code and was wondering how you came up with this solution, how did you approach the problem and did you acquire all of the information you needed for configuring the uno chip from the datasheet alone or did you use multiple sources?

Thanks once again.

Sorry, forgot to say before, my query is regarding the 40 (38) kHz configuration.

Thanks

mkssnwbrd1 month ago

I am working on a similar project but can't seem to figure out how to write to an SD card fast enough, could you share your SD card code as well? I have been using the SD.h library, but it is just too slow for audio.

pierattilio1 month ago

Hi Amanda, good job for this instructable :D I would know if i can use a OPA2134PA instead of the tl072, and if yes do I have to change something of important? (i'm afraid about the amplificatiopn gain, I don't wanto to burn some arduino pin :) ). Thanks a lot

roc_931 month ago

hi Amanda

Thats a great tutorial :)

Is there a possibility to use only one battery/ power supply instead of the two 9v batterys ?

asubaşı1 year ago
What does the 47nF capacitor do?

This 47nF capacitor is called a bypass capacitor, its role is to filter out to ground undesirable AC noise that is inherent to any circuit. In this case it is important to have it here so that this noise is no mixed with the input signal. This page gives a good description of what they are and how they fit in a circuit: http://www.seattlerobotics.org/encoder/jun97/basics.html

amandaghassaei (author)  asubaşı1 year ago
helps remove noise in the input signal
pmenghani2 months ago

You have a Arduino Audio Output instructable as well....i just wanted to ask if the bits that i sent using that circuit ,instead of connecting it to a speaker i connected to this circuit,can be identified using this circuit...can i use LM358 as an OPAMP

pmenghani2 months ago

You have a Arduino Audio Output instructable as well....i just wanted to ask if the bits that i sent using that circuit ,instead of connecting it to a speaker i connected to this circuit,can be identified using this circuit...can i use LM358 as an OPAMP

when i print the incomingAudio value, i get fluctuations around 512, but when i adjust the potentiometer nothing happens. i have checked the diagram many times, and even have the same ground connections and Vin connection. have i missed something in the wiring? newbie here : )

Hey, I have the same problem, did you find a solution at all?

amandaghassaei (author)  luis_cordova1 year ago
the print function might not be fast enough to give you a lot of information about what is going on. do you have an oscilloscope?
xavierm12 months ago

hola amigo, para monitorear la salida de audio de arduino que pines usas, leo que dice el puerto D,podrias explicarme ,

LMario2 months ago

Instead of the microphone input can I use as input the signal generated by the pickup of a guitar?

flaviowd2 months ago

Can I use this idea to plug my guitar and output sound via USB or P2 to plug on my computer to use with some software like Amplitube or Garageband?

sparkyluki3 months ago

would this circuit work using and electret microphone rather than the radioshack one?

amandaghassaei (author)  sparkyluki2 months ago

yes it should work with any oscillating signal, but you might need to change the level of amplification to get it in the 0-5V range for the Arduino.

asheble3 months ago

Is it okay if i use an LM741 or LM358 opAmp?

amandaghassaei (author)  asheble2 months ago

yes

opaulyc2 months ago

Hi! Great project! I just built it, and I think it is working fine since the clipping LED functions well. I have a question... How can I add a second input audio source? What do I need to add to the last code you uploaded? My intention is to use both audio sources at the same time but with different clipping LEDs.

Thanks in advance!

amandaghassaei (author)  opaulyc2 months ago

that's a little tricky, you may have to lower the sampling rate to achieve that. It involves changing the code in the setup that puts A0 in continuous sampling mode, you'll have to get into the atmega's datasheet to find the answer. I'm not sure.

mabdulaziz3 months ago

thanks for this instructable,

If I want to send this audio signal via bluetooth using BT-Shield, do you have any suggestions what should I do?

amandaghassaei (author)  mabdulaziz2 months ago
never tried, please post it if you get it to work!
kleina3 months ago

Thanks for your great work. I'm thinking about testing a mono summer circuit before it comes to the opamp stage. However i'm a bit concerned with accidentally feeding more than 5v to the adc.. Would a simple 5v zener do the trick here, tied to the A0?

amandaghassaei (author)  kleina3 months ago

yes that would work

I can only assume because the opamp stage doesn't work with my summed output, but works with each one of my stereo signals.. I need to find an alternative solution (the summer is just a couple of resistors in line with the signal)

sniffrumble4 months ago

I made it yay! although I cannot make the output tutorial since the op amp / chip is now discontinued.... can you please update that tutorial or update where to buy the chip? Thanks!

that's a good point about the op amp, I hadn't thought of that.

super

tpoe24 months ago

I made it yay! although I cannot make the output tutorial since the op amp / chip is now discontinued.... can you please update that tutorial or update where to buy the chip? Thanks!

marxys5 months ago

¡¡excelente trabajo!! :D

asc81175 months ago

best explanation ever. Any newcomer can easily understand.

Can you please guide me about any command/code performing following action...

1. If ADC output count is 0-250 then write HIGH on output pin-1( LOW on others, 251-500 then write HIGH on OP pin 2 etc...)

Thanks again

lynettequek5 months ago

is it possible for the arduino to analogread negative voltage (eg. -5V) input? and change them to become positive numbers?

amandaghassaei (author)  lynettequek5 months ago

no, you will have to offset the voltage before sending it in

Osias Cesar5 months ago

Awesome explanation about the project! I'm wondering if it's possible to using communication (as UART or I2C) whithout decrease the sampling rate, like to tell to the PC every 100ms how much reads it have already did

amandaghassaei (author)  Osias Cesar5 months ago

not sure about UART or I2C, let me know if you try

jiffymanager5 months ago

super

calmlunch6 months ago

good

sheepbars6 months ago

that's a good point about the op amp, I hadn't thought of that.

1-40 of 207Next »