Some days ago I have made a multiplexed 3x8 LED grid based on Arduino RGB Controller. In my case I don't use RGB but row1, row2 and row3. While I already made some nice animations but I'm not really happy with the result. The matrix is 1m x 2,8m, I'm planing to append it over some sort of "home music studio". As you know visualizing audio stuff is cool! So the static animations on that LED matrix would be useless if not following the beat. I need to add a spectrum analyer. Luckly all the analog I/O are free to use. Another point that makes this grid perfect for a 8 channel spectrum analyzer is the fact that I'm allowed to use PWM on the 3 rows. This means I have a theoretical spectrum grid of 256*3 x 8. Naturally the curve from 0-100% of the LED's brighness is not linear, that can be solved by using a simeple exponential function. Anyway the animation should be nicer than just fully turning on/off the LEDs.
First of all let me tell you again, I'm not an electronical enginer and I doing my best to understand stuff by myself, but in this case I'm not able to do it properly. My only measuring system is a very slow limited multimeter. I also broke an arduino some months ago, so I don't just connect stuff.
Can the arduino create a spectrum analyzer using only one pin?
And so I started to read about that
- I need to somehow convert the audio signal to 0-5V
- I need to read the data on the ADC0 (left audio channel) and do some math and send it to the LEDs.
I'm stuck at point 1.
Every Audio device headphones output's max defer so I need a potentiometer. The audio voltage is low milliamps but also most of the time lower voltage.
From the various circuits I choosed the following one. Before I connected it to the arduino I used a buzzer to test if I get something out. Yes but, I get sound if I invert GND with signal(Jack in) and I also get sound if I invert the polarity of the capacitor C1. There is also no type of protection in this circuit, I am stucked.
Note.: I also tested differnt other circuits and got alwasy the same results, except in this the potentiometer has no effect.
With a simple analog read I always get 0(ZERO).
Reading more about the problem I found many posts that use op-amps. Since my local electronics component store has only a limited number of IC's, I sometimes buy random IC's if they are compatible with Arduino and other microcontrollers. And I also salvage old stuff. Here is a list of components I could use.
- MC1458 DUAL General-purpose operational amplifier
- TDA2822M DUAL low-voltage power amplifier
- UA741CN General-purpose single operational amplifier
- AD7395 Dual, Serial-Input 12-/10-Bit DAC
As I have no oscilloscope and other professional stuff to measure electronic current, I hope you can show me how to properly connect an audio signal to my microcontroller's ADC.
Consider the fact that I know nothing. Complex explaination without a schematic wouldn't help to solve the problem for me and probably many other people.
How to PROPERLY connect a standard headphone jack (mp3 player)/ audio out cable to a 0-5V Analog to digical converter Microcontroller's pin?
- With the tested online available circuits I get no readings from analog pin 0. Analog pin 0 works perfectly (tested potentiometer only).
- Now, I don't want to connect something to the MC's pins without knowing for sure that I output 0-5V at the correct amperage.
- I don't know why I always get reading 0 from Arduino even if I can hear the buzzer?
- I never used a op-amp so I don't know what inverting input and non-inverting input is?
- What does the C1 capacitor and why does it work if I invert the polarity?(buzzer)
- Inverted audio cable pins also produce the same sound on a buzzer, why?
- I'm testing on an Arduino micro but the final line in would be used on a Arduino micro, not sure if relevant.
This uses the same op-amp I have
Noise can be horrible !
Arduino Prescaler: up to 19kHz, not 17 what I have written in the comments.
But by knocking down the 128-prescaler to 32, we now increase the sample rate by the same factor up to 38.4kHz. Thanks to Nyquist again, that gives us an audio bandwidth of 19.2kHz, which is close enough to 20kHz-perfection.