Can the arduino create a spectrum analyzer using only one pin?

louyueqing

New Member
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?

yes! FHT

And so I started to read about that

  1. I need to somehow convert the audio signal to 0-5V
  2. 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.



Result:

With a simple analog read I always get 0(ZERO).

NAwC3.png


simulate this circuit – Schematic created using CircuitLab

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.

  1. MC1458 DUAL General-purpose operational amplifier: http://www.ti.com/product/MC1458
  2. TDA2822M DUAL low-voltage power amplifier:http://www.kynix.com/Detail/235962/TDA2822M.html
  3. UA741CN General-purpose single operational amplifier: http://www.ti.com/lit/ds/symlink/ua741.pdf
  4. AD7395 Dual, Serial-Input 12-/10-Bit DAC: https://4donline.ihs.com/images/Vip...4-1.pdf?hkey=EF798316E3902B6ED9A73243A3159BB0
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.

The question:

How to PROPERLY connect a standard headphone jack (mp3 player)/ audio out cable to a 0-5V Analog to digical converter Microcontroller's pin?

Main problems:

  1. With the tested online available circuits I get no readings from analog pin 0. Analog pin 0 works perfectly (tested potentiometer only).
  2. 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.
Extra:

  1. I don't know why I always get reading 0 from Arduino even if I can hear the buzzer?
  2. I never used a op-amp so I don't know what inverting input and non-inverting input is?
  3. What does the C1 capacitor and why does it work if I invert the polarity?(buzzer)
  4. Inverted audio cable pins also produce the same sound on a buzzer, why?
  5. I'm testing on an Arduino micro but the final line in would be used on a Arduino micro, not sure if relevant.
 
Top