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) Amazon

Additional Materials:

(1x) usb cable Amazon
(1x) breadboard (this one comes with jumper wires) Amazon
(1x) jumper wires Amazon

Step 1: Preparing audio signals for Arduino

If  you've ever recorded audio on your computer, you may have seen it represented as a waveform like the one in fig 1.  If you zoom in on this wave (as in fig 2) you will see that the shape is made of thousands of tiny oscillations back and forth.  This is called an audio signal and when we are dealing with audio signals in electronics, these oscillations represent oscillating voltages over time.

When we look at an audio signal with an oscilloscope, we see a similar picture (fig 3).  Notice how the audio signal in fig 3 oscillates around a center voltage of 0V; this is typical of audio signals.  The amplitude of an audio signal is the distance between its center voltage and its high or low peak.  The amplitude of the wave in fig 3 is 2V: it reaches a maximum voltage of +2V and a minimum voltage of -2V.  This is a problem if we want to measure the audio signal with one of the Arduino's analog inputs because the Arduino can only measure voltages between 0 and 5V.  If we tried to measure the negative voltages in the signal from fig 3, the Arduino would read only 0V and we would end up clipping the bottom of the signal.  In this Instructable I'll show you how you can amplify and offset audio signals so that they fall within this 0-5V range.  Ideally you want a signal with an amplitude of 2.5V that oscillates around 2.5V (like in fig 7) so that its min voltage is 0V and its max voltage is 5V (see the calculations below).

Min voltage = Center Voltage - Amplitude
Min voltage = 2.5V - 2.5V = 0V

Max Voltage = Center Voltage + Amplitude
Max Voltage = 2.5V + 2.5V = 5V

Fig 4 shows the signal coming straight out of the microphone on an oscilloscope.  The signal is relatively weak, with an amplitude of only 200mV, you may find that signals from other sources (ipods, guitars, record players...) also produce audio signals with small amplitudes.  These signals need to be amplified to get them up to the amplitude we want (2.5V).  Amplification means increasing the amplitude (distance between the center point and max or min) of a signal.  Amplification also buffers the audio source (in my case this was a microphone) from any loads that you may put on it later in the circuit, which is a good thing because it prevents distortion.

Fig 5 shows the same microphone signal after amplification, you can see how the height of the peaks has increased so that the wave has an amplitude of 2.5V.  But since the center voltage of the wave is still 0, the wave is oscillating between -2.5 and +2.5V.  It will need to be DC offset to correct this.  DC offset means changing the center voltage that the wave oscillates around (the average voltage of the wave).  Fig 6 shows the signal after it has been DC offset; it still has an amplitude of 2.5V, but the center voltage is 2.5V instead of 0V, so the wave never drops down below 0V.  (Note- the slight change in shape between the signals in figures 5 and 6 is dues to changes in my voice between the two pics, it has nothing to do with the circuit).  The signal in fig 6 is ready to go to an Arduino analog input pin.

Step 2: Prepare audio jack

In this Instructable, I'm only going to talk about how to route one channel of audio into an Arduino.  It is possible to copy the same circuit I've proposed here many times to add multiple channels, but it can complicate/slow things down in the code and at some point you will probably have to lower your sampling rate.  I'll leave it up to you to figure out the details, but please post what you learn in the comments!  Almost all microphones and electronic instruments are mono, meaning they only have one microphone element or pickup which is generating a signal (as opposed to stereo).  You can tell for sure by looking at the plug and comparing it to the image above.  My microphone has a 1/4" plug on it so I used a 1/4" jack for this instructable, you may find that you need a 1/8" jack, but the main ideas here still apply.

Solder a black wire to the ground pin of the mono jack.  The ground pin is usually the larger pin on the jack, test for continuity with the threaded portion of the jack to make sure that you have located the ground pin correctly (see fig 3).  Solder a green wire to the signal pin of the mono jack.  Test for continuity with the clip that extends out from the jack (fig 3).

If you have an oscilloscope handy, connect the reference to the black wire, connect the probe tip to the green wire, plug the microphone in the jack and look for a signal (fig 5).  The signal from my microphone has an amplitude of about 200mV.

Step 3: Non-Inverting Amplifier

The amplifier is the first step in the circuit, it increases the amplitude of the signal from around + or - 200mV to + or - 2.5V (ideally).  The other function of the amplifier is to protect the audio source (the thing generating the audio signal in the first place) from the rest of the circuit.  The outgoing amplified signal will source all its current from the amplifier, so any load put on it later in the circuit will not be "felt" by the audio source (the microphone element in my case).  Do this by setting up one of the op amps in the TL072 or TL082 package in a non-inverting amplifier configuration

The datasheet of the TL072 or TL082 says that it should be powered with +15 and -15V, but since the signal will never be amplified above + or - 2.5V it's fine to run the op amp with something lower.  I used two nine volt batteries wired in series to create a + or - 9V power supply.

Wire up your +V(pin 8) and -V(pin 4) to the op amp.   Wire the signal from the mono jack to the non-inverting input (pin 3) and connect the ground pin of the jack to the 0V reference on your voltage supply (for me this was the junction between the two 9V batteries in series).  Wire a 100kOhm resistor between the output (pin 1) and inverting input (pin 2) of the op amp.  In this circuit I used a 10kOhm potentiometer wired as a variable resistor to adjust the gain (the amount that the amplifier amplifies) of my non-inverting amplifier.  Later in this Instructable, I'll show how you can add an LED indicator to Arduino pin 13 to let you know when you have this pot turned up too high (resulting in clipping of the incoming signal by the Arduino); this way you know when you should turn the pot down and get the signal back in the range you want (amplitude of ~2.5V).  Wire this 10K linear taper pot between the inverting input and the 0V reference.

The following equation describes the relative amplitudes of the signal before and after the non-inverting amplifier:

Vout =~ Vin * (1 + R2/R1)
Vout/Vin =~ 1 + R2/R1
where R2 is the feedback resistor (between the output and non inverting input), R1 is the resistor to ground, Vout is the amplitude of the outgoing signal (the output from the amplifier), and Vin is the amplitude of the incoming signal (the input to the amplifier)

In this circuit R2 is a 100kOhm resistor and R1 is a 10kOhm potentiometer (variable resistor).  By turning the pot you can change the resistance of R1 from 0Ohms to 10KOhms.  Here are some example calculations:

When the pot is turned all the way to the left the resistance of R1 is 10kOhms and the ratio of Vout to Vin is about:
1+ 100/10 = 11
A signal coming out of the microphone with an amplitude of 200mV (which is fairly loud on my microphone) will be amplified to:
200mv * 11 = 2200mV = 2.2V
this is right in the range we want (amplitude close to 2.5V without going over)

Turning the pot to its halfway position will give it a resistance of 5kOhms, we can calculate the ratio of Vout to Vin again:
1+ 100/5 = 21
now the amplitude gets multiplied by 21
this is too much amplification for the 200mV signal:
200mV * 21 = 4200mv = 4.2V >> 2.5V
but this amplification would be perfect for a 100mV signal:
100mV *21 = 2100mV = 2.1V =~ 2.5V

Turning the pot farther to the right will keep decreasing the resistance of R1 and increase the amplification (also called gain) of this amplifier theoretically to infinity.  Obviously at some point the amplifier will not be able to power a signal with a huge amplitude, but you get the idea.  By adjusting the potentiometer you can adjust the gain of the amplifier and tune the sensitivity of the microphone while still keeping it in a range that the Arduino likes.

Note: As you can see in the circuit above, this project only uses one of the two available op amps in the TL072/TL082 package.  I used this chip because they are easily sourced (you can even buy the TL082 at Radioshack these days), they are basically the same price as the single op amp packages (TL071 and TL081), and you may want to use the extra op amp somewhere else on your circuit (another channel of input, an audio out circuit...).  But if you have a TL071 or TL081, it will do fine for this project.

Step 4: DC Offset

The next portion of the circuit DC offsets the output from the amplifier.  As I explained in step 1, this +2.5V DC offset causes audio signal to oscillate around 2.5V so that it stays within the acceptable range for the Arduino's analog inputs (0-5V).  Compare the non dc offset signal is fig 2 with the dc offset in fig 3.  Specifically, notice how the signal in fig 3 always stays within the 0-5V range.

The DC offset circuit has two main components:  a voltage divider and a capacitor.  The voltage divider is made from two 100k resistors wired in series from the Arduino's 5V supply to ground.  Since the resistors have the same resistance, the voltage at the junction between them equals 2.5V.  This 2.5V junction is tied to the output of the amplifier via a 10uF capacitor.  As the voltage on the amplifier side of the capacitor rises and falls, it causes charge to momentarily accumulate and repel from the side of the capacitor attached to the 2.5V junction.  This causes the voltage at the 2.5V junction to oscillate up and down, centered around 2.5V.

As shown in figs 3-8 and the schematic, connect the negative lead of a 10uF capacitor to the output from the amplifier.  Connect the other side of the cap to the junction between two 100k resistors wired in series between 5V and ground.  Also add a 47nF capacitor from 2.5V to ground.

Step 5: Simple Analog In

Load the following code onto the Arduino.  This code reads the voltage of the incoming audio signal using analogRead(A0) as a number between 0 and 1023 and stores it as the variable "incomingAudio."  From here you could store this value for later use, perform mathematical operations to it, or do any other manipulations you can think of.
In the images above I set up a really simple 8 bit digital to analog converter (read more about it here, or check out fig 4) so that I could visualize the data points that the Arduino was storing as the variable "incomingAudio" and see how close it was to the original signal.  You can see from fig 2 (zoomed in view of fig 1) that the Arduino is taking one sample every 125us from A0.  We can calculate the sampling rate as follows:

sampling rate = 1/125us = 1/0.000125s = 8000hz

To give you a point of comparison, normal audio sampling rates are at least 40kHz.  If a sampling rate of 8kHz or less is good enough for your purposes then you should probably go ahead and use analogRead() to measure your signal, as it keeps things very simple.  You can see in fig 1 that it actually does a pretty good job of tracing out the path of the incoming 360hz signal.  In order to get above 8kHz, we'll have to bypass the analog read function.  It may sound daunting, but it's actually not too bad, just a matter of copying some setup() code that I've written in the next step.

I also want to point out the behavior of the Arduino in response to a signal that rises over 5V and dips under 0V.  In fig 3 you can see how the Arduino clips the incoming signal so that it is always bounded by 0 and 5V.  This causes the tops of the peaks and the bottom of the valleys to get flattened.  In step 8 I'll talk some more about this and how to set up a clipping indicator light to let you know to turn the amplifier down.

Some notes about the 8 bit digital to analog converter (DAC):  I used the command "PORTD = " to send a value between 0 and 255 out of the Arduino and into the DAC where it is converted back into a voltage between 0 and 5V.  The code I used can be found below.  I've written a whole instructable about the 8 bit DAC here.

Step 6: Sampling rate of ~40kHz

In the code below I bypassed the function analogRead() in order to increase my sampling rate. The code required to do this is fairly advanced, maybe it can be the subject of another instructable if there's interest (leave a comment if you are interested), but for now it's only important to understand how to use this code in the loop() function, not how I set it up.

Here's simple explanation (all you need to know for now):
Basically in the setup() function I've told the Arduino that I want it to continuously measure pin A0 and forget about the other analog inputs all together.  So while other things are going on in the loop() function, the Arduino is constantly updating a variable called "ADCH" with new values from A0 at a rate of 38.5kHz (that's one sample every 26us, you can see it in fig 2).  When I want to get one of these values I can just set a variable equal to ADCH, or as I wrote in my code:

incomingAudio = ADCH;

I did have to lower the resolution of these analog measurements a little bit to get a higher sampling rate.  In the last step we were using analogRead() to measure the voltage of the signal as a value between 0 and 1023, now these values will always be between 0 and 255.  Also, continuous monitoring of A0 means that the other analog pins are now useless, but if you really need to measure a potentiometer or sensor, check out how you can do it with a digital pin using RCTime  It's possible that the analog pins can still be used as digital I/O pins, but I haven't actually tested this yet, leave a comment if you try it!

The complicated explanation (not necessary, but for those who are interested):
I manually set the Arduino's internal analog to digital converter (ADC) counter to 500kHz and read an 8 bit value from analog input 0 from the ADCH directly (I just read the most significant 8 bits of the 10 bit ADC to save time in the code).  I set the ADC counter to 500kHz because the ADC takes 13 clock cycles to read a new analog value.  500/13 =~ 38.5kHz which gets me pretty close to 40kHz (standard audio sampling rate) without introducing extra noise.  As you can see in fig 2, this gives me one sample every 13/500000 = 26us.  A lot of the ideas here (prescalers and counters) are similar to the setup for Arduino timer interrupts, and you can read more about how that works here.
As in the previous step, I sent the values of the variable "incomingAudio" out an 8 bit DAC so that I could visualize the data as it was being stored in the Arduino.  You can see the incoming signal (yellow) and output from the DAC (blue) in the images above.  Notice how much better the Arduino follows the signal compared to the last step.  In fig 2 you can see that the step size is down to 26us (compared to 125us when using analogRead).  Again you can see the effects of clipping at 0V and 5v in fig 3.

The code for sampling rate of 38.5kHz with DAC output is given below.

Step 7: Interrupt

In this piece of code, I set up the Arduino to continuously monitor pin A0 at 38.5kHz, but now I've added a piece of code that automatically updates the variable "incomingAudio" each time a new value from A0 has been calculated.  Instead of putting the line:

incomingAudio = ADCH;

in the loop() function of the Arduino sketch, I've put it in a special function called an "interrupt routine."  The interrupt routing looks like this:

ISR(ADC_vect) {
  incomingAudio = ADCH;

Think of it as a normal sketch, the Arduino first goes through the setup() function then it starts the loop(), but every 26us (when a new value is ready from A0) the Arduino stops what it is doing in the loop and does whatever is encapsulated in the interrupt routine (in this case just the line "incomingAudio = ADCH;").  Once the interrupt routine has finished, the Arduino picks up again where it was in the loop() for another 26us.  Then the interrupt routine executes again.... this goes on repeating forever.  If you want, you can read more about Arduino interrupts here

This interrupt code generally a better way of reading the incoming signal than the way I wrote it in the last step because you are only updating the variable incomingAudio once each time a new value comes in.  Updating the variable multiple times, before the value has even had time to change is redundant.  Also, if you want to record these values you can put the storage code in the interrupt routine so you know that your storage sampling rate is exactly 38.5kHz.

Step 8: Clipping Indicator

A clipping indicator LED is useful so that you know if you need to turn the gain down on your amplifier.  If your signal is clipping as it comes into the Arduino, you are losing information about the signal.  Figs 2 and 3 show the incoming signal (yellow) and the data stored in the Arduino (blue) for both 8kHz and 38.5kHz sampling rates.  Notice how the Arduino completely misses the behavior of the peaks and valleys due to clipping.

To set up the clipping counter I created a few new variables.  "clipping" has a state of 1 when the Arduino detects clipping (the incoming signal is measured to be 0 or 5V) and a state of 0 when the Arduino does not detect clipping.  In the code below (for 8kHz sampling rate) I also set up a variable called clippingCounter.  The purpose of this variable is to keep the indicator LED on for a moment after the clipping was detected so that it is visible to the human eye.  In the 38.5kHz code (at the bottom of this step) I used a delay(100) to achieve the same effect.
and below is the code for 38.5kHz with interrupts:

<p>Thank you for posting this instructable, </p><p>This is exactly what I needed to get my LED lamps to start dancing to music. I have been using the arduino to make interactive lamps and have been wanting to get audio into the mix. The concept makes sense about needing a mid range of 2.5v rather than 0v from the original audio source. I have done my best to duplicate what you posted, and it all looks right, but am not getting the best results. </p><p>An absence of audio reads about 190 to 210. Attaching audio with a beat results range from 140 to 1023 when the bass hits. As the bass note goes out it will drop from 1023 slowly back down. What this makes me think of is that I have too much input. </p><p>The POT is a 10kA and with a multimeter I can read it varies between 0v and 1v. This does not make any difference on the audio out of the amplifier. Even if changed the gain I am not convinced I would get a good signal.</p><p>With the multimeter on DCv I can read a range of 0.002 to 0.03v on the original audio source. The multimeter then reads a range of 5v and higher to 0.6v going out of the amp. </p><p>I would like for the POT to fix the gain but I dont know what Im doing wrong. </p><p>Any Ideas out there? </p>
<p>My major issue was that I am using a single supply. I did not understand that your circuit uses two 9v batteries and one is used to ref -9v. After lots of research on op amps, thanks to texas instruments documents, and then finding this gem (http://www.rason.org/Projects/opamps/opamps.htm) I was able to create a fine amplified circuit with one single 12v power source. </p><p>I modified this linked circuit so that R2 is the 10k pot allowing me to control the gain. Everything looks perfect on my oscilloscope which I bought so that I could analyze this circuit. The price was about 30$ on amazon, highly recommend it to anyone who is reading this and does not have one. Here is the link for that.(http://www.amazon.com/JYE-DSO-138-Open-Source/dp/B... </p><p>Now my issue is that I am unable to shift the graph up 2.5 volts so it oscillates between 0 and 5 volts. I have hooked up the arduino for 5v ref with the DC offset and cap just like you have in the circuit you made for this tutorial. My multimeter reads a perfect 2.5v in the junction. My oscilloscope reads the same as it does with out the DC offset oscillating on 0 rather than 2.5v. </p><p>Does anyone have any ideas why adding this 2.5v DC offset is not shifting the oscillation from 0v to 2.5v? </p>
<p>RexHex,</p><p>Do you mind sharing a diagram of how you wired the project with one 12v power supply?</p>
look to the rason.org link I posted above. it's the schematic I found that uses a single source with the same chip.
<p>Did you utilize the DC offset in addition with the single source?</p>
yes you still need to use the DC offset. the arduino only reads 0-5v so it needs to be offset to 2.5 to get solid data.
<p>So using the oscilloscope on AC mode will always oscillate on 0v. putting it to DC brings it up to 2.5v. It would have been nice to have gotten a response at some point but Im thankful for this intractable. I hope that my additions may help someone at some point. </p>
<p>RexHex, your link to the Op Amp design page was very helpful! Good addition to this instructable</p>
<p>I am trying to use this but I also want to be able to save the audio file to a micro SD card, can anyone help please?</p>
<p>Nice post. Well detailed and explained. I like how you built up the code, adding optional features with each version.</p><p>The link to the source code is not working. It looks like it was moved to 'SuperAwesomeRobots'. Please update the link for others.</p><p>Thanks.</p>
<p>Hi! Thank you for this really detailed instructable! <br>I am planning on connecting my analogue synth to my arduino. I'm afraid I am a bit of a novice when it comes to this so my question is, once I have input the audio into the arduino using your tutorial, how do I get sound back out of the arduino? I have seen you put up a tutorial on how to do this whilst generating wave forms inside the arudino but I was wondering if there was a way of having the sound come out of my computer speakers? </p><p>Thanks again!</p>
<p>can I use an electret microphone with amplifier(<a href="https://www.adafruit.com/products/1063" rel="nofollow">https://www.adafruit.com/products/1063</a>) to get an audio reading instead of the microphone and circuit?</p>
<p>Hey! Thanks a lot for this tutorial!</p><p>I did it, it works great! Now I'm trying to read stereo signal, but it seems very complicated, since arduino appears to read only one AI at a time... Have you ever made it to work nicely? Because I cannot even read separate signals, even delaying between analogReads.</p><p>Oh, a suggestion: you actually don't need the amplifier. Just set an offset of ~0.5V (R1 = 9xR2) and set analogReference(INTERNAL). :)</p><p>Thanks again!</p>
<p>Can you explain a bit more your suggestion of not using the amplifier, please </p>
<p>Thank you for posting this project. It looks like a very interesting project! However, while making this, I ran into a slight head-scratcher ...</p><p>I set up the circuit like the schematic in Step 4: DC Offset. Feeding into the 10uF capacitor, I have a mono input from my MP3 player with the common from the plug going to ground.</p><p>I loaded the code from Step5: Simple Analog In but modified the setup and loop functions to do some Serial.print's to see what values are being assigned to the variable incomingAudio.</p><p>On my Uno it works fine - I see varying numbers in, what I assume are a reasonable range. However, when I tried to use my Arduino Micro in place of the Uno the code only prints numbers ranging between 494-507 for incomingAudio.</p><p>So I set up my Uno on one breadboard and the Micro on a second breadboard each with their own complete set of components/input circuits. So the boards are exact duplicates except for the Arduino boards. I went over the wiring several times to ensure both were correct.</p><p>The Uno board still works and the Micro does not. So I ran the 5V, gnd, A0 inputs from the Micro board to the Uno breadboard and it the Uno works fine. Then I ran the inputs from the Uno board to the Micro board and still not good. I switched the wires back and the Uno still works while the Micro still refused to cooperate.</p><p>Additionally I compiled the same code from your sample and loaded it to both boards - selecting the correct board/port in the Arduino IDE.</p><p>So I'm not sure why the Micro cannot see/read what is coming into pin A0 when the Uno acts fine. Maybe something different in how the Uno performs the analogRead(A0) vs the Micro?</p><p>My main reason for trying to migrate to the Micro is I have this project working: <a href="http://www.instructables.com/id/Arduino-Powered-Musical-Christmas-Lights/" rel="nofollow">http://www.instructables.com/id/Arduino-Powered-Mu...</a> and now I am trying to migrate to the Micro to use transistors or MOSFETs to switch some 5v DC lights I have. The main goal is to set up a small Christmas tree on my desk at work and run it off a small wall-wart power supply or even a USB type backup battery.</p><p>Any ideas on why the Micro is so fussy?</p><p>Thanks,</p><p> Mike</p>
not sure but the teensy board is a great one. I would buy one of those because its also small and should work just fine.
<p>should I keep my Oscilloscope source as AC or DC, to check the audio signal after dc offset has given ...</p>
<p>Thank you very much for your reply...It helps me a lot...</p>
glad to be able to help. that threw me off for a little bit too.
<p>Hey, I was just wondering can we use PWM pins of arduino for DC offset generation and if so will it be more power efficient?</p>
<p>Thanks a lot Amanda..Mine working fine....</p>
<p>Hi there! Thank you very much for this tutorial. </p><p>I am thinking about implementing a guitar tuner with my Arduino for a class project, but my professor only have access to simple microphones and Grove kits. Do you think that I can determine the sound frequency with that?</p><p>Thank you again!</p>
<p>Hi! Thank you so much for this tutorial. Only one thing I do not get. If I wan to make the VU meter with this, how do I work around the offset? If I just subtract the value and make it absolute the thou out put is far from precise and sometimes its all over the place. Please can someone help me with this?</p>
<p>I might be able to help but I dont understand the question. </p>
<p>excellent thank you</p>
<p>Hi !!<br>I have a project where i want to give input to arduino through 3.5mm cable.<br>i want to play a music on my hone or laptop or ipod and send it to arduino through AUX cable !!<br>Is it possible to detect the beats in the music ?<br>THANKS<br><br>PS : I'm very new to practical electronics </p>
<p>Hi! Thank you so much for this tutorial. Only one thing I do not get. If I wan to make the VU meter with this, how do I work around the offset? If I just subtract the value and make it absolute the thou out put is far from precise and sometimes its all over the place. Please can someone help me with this?</p>
<p>Hi! Thanks for this post (and the next ones!) it's just what i'm looking for<br>But, you know you can make the circuit more versatile, by making an adder device where one pin of R1 is the input for the offset, and where is R2 is the input of the signal I fed the OP AMP with +-10V, this circuit amplifies the signal with offset (is an inverter too so thats why I added another inverter at the end)<br>and BTW Can I do a filter with the arduino?</p>
<p>Thank you for this Instructable. I'm so excited to get started! I have a question regarding your choice of microphone, though I'm not sure if I read anything pertaining to it in particular. Would it be possible to use an electret microphone? Perhaps something similar: https://www.adafruit.com/products/1063</p>
<p>Hi , I have builded the same circuit and i have used the copde which mentioned in Arduino frequency detection.</p><p>And Can see -1hz always in serial as an ouput,what could be the reason,Kindly help.</p>
<p>hi </p>
<p>Amazing Instructable! Thanks for sharing! really nice!</p>
<p>What arduino board are you using?</p>
<p>Hay amanda</p><p>Great instructable. I would like to seek your help for taking this one step further. I am working on a project that carries out some audio processing from a mic and another audio input at the same time and outputs them to two separate DACs, so i would need to use two analog pins (say A0 and A1 for mic input and the other audio input respectively), and use two of the arduino ports(say D and B) as the DAC. Your code for using the interrupts on pin A0 was difficult for me to understand how I could use the same thing for pin A1. which part of the code in the setup() that specifies which pin to sample from. </p>
<p>Hello, great tutorial, question regarding the audio output portion, i have built the R2R ladder in your other tutorial and upon hooking it up, i notice that the audio coming out is +/- about 100mv for some reason (the input i have verified with my oscilloscope at 0-5v) but the code for both the 10 and 40k processing output the audio to the ladder at a significantly lower voltage, anyone else have this problem? thanks in advance</p>
What does the 47nF capacitor do?
<p>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</p>
<p>I enjoyed reading this instructable, as I just today experienced the effect of a missing DC offset with my mic input to my Arduino. Great work!<br>However, I also stumbled over the AC bypass cap: Isn't 47nF an order of magnitude too large for audio signals in this case? If I am not completely wrong, the bypass cap forms a low pass with the 50k impedance of the voltage divider (again parallel to the Arduino's input impedance which should be negligible here). The 3dB point of such an LPF is ~68Hz. Wouldn't it be better to take a value in like 220pF or even smaller? That would increase the 3dB point to be higher than 10kHz at least.<br>I am asking this not to be pedantic, but I am just still learning basic electronics and therefore try to analyse building blocks like RC filters when I come across them. It could be that I made a fundamental mistake here, something that renders my result completely wrong. So I would be really happy, if someone could explain to me, if and why I am wrong! :)</p>
<p>there is still noise in my input. how do i fix it? as you said the capacitor function to filter the noise. but mine is still unstable</p>
helps remove noise in the input signal
<p>Hey Amanda, I haven't yet had time to go through all of the comments so I apologize if you have already answered this.</p><p>I've done everything in your instructable and it works fantastically, thank you for such a detailed walk through, it definitely helped. What I'm not trying to do is manipulate a LED's with certain audio frequencies and I was wondering if you know how I could go about doing this. I am trying to make three output lines reacting with low, mid, and high frequencies. Should I use byte reading and select a range for each and depending on the byte data, it determines which pins are output?</p>
<p>Do you mean you want to have an LED to indicate high, medium and low frequency volumes? It wasn't too clear from your comment. If you want to do that, you need to run a FFT (Fast Fourier Transform) on the incoming signal, which lets you see the incoming frequencies, and then average the frequency bands you want to use as 'high', 'medium', and 'low'.</p><p>I think these could help you a lot:</p><p><a href="https://learn.adafruit.com/piccolo" rel="nofollow">https://learn.adafruit.com/piccolo</a></p><p><a href="https://learn.adafruit.com/fft-fun-with-fourier-transforms" rel="nofollow">https://learn.adafruit.com/fft-fun-with-fourier-tr...</a></p>
<p>A simple way to use only one 9 volts bat:</p><p><a href="https://drive.google.com/open?id=0B2Nd3eQ---IJUEpZVy0yQU1TWHc&authuser=0" rel="nofollow">https://drive.google.com/open?id=0B2Nd3eQ---IJUEpZ...</a></p>

About This Instructable




Bio: I'm a grad student at the Center for Bits and Atoms at MIT Media Lab. Before that I worked at Instructables, writing code for ... More »
More by amandaghassaei:OTCA Metapixel - Conway's Game of Life"9 Degrees of Freedom" IMUTwitter Controlled Pet Feeder
Add instructable to: