Yeah - it doesn’t have to be accurate. Just amplify the audio.Thanks for the explanation. Also, now we know a bit more about the application, which does not require precision.
Yeah - it doesn’t have to be accurate. Just amplify the audio.Thanks for the explanation. Also, now we know a bit more about the application, which does not require precision.
What you are looking for is what we called a color organ which as was mentioned was a popular toy back as far as the 60s. I thought that is what you had in mind.If your objective with an audio signal is just to drive a LED which changes intensity with the music volume (what we called a color organ) your audio signal out from whatever you have may be adequate less any amplification, just pass the AC Audio in but using the resistive divider on the A0 input of the Arduino.
Thanks for the reply. Googling what you said, the first thing I found was this: https://www.instructables.com/id/Arduino-Color-Organ/Well alrighty then, that is what I had in mind back in post #43 or so where I wrote:
What you are looking for is what we called a color organ which as was mentioned was a popular toy back as far as the 60s. I thought that is what you had in mind.
With that in mind I suggest you look at amplification circuits you will find with a simple Google of color organ. Early circuits drove 120 VAC or 220 VAC incandescent lamps using a simple triac circuit and filtering the input for Bass, Midrange and Treble or simply put low, medium and high frequencies. Today, as mentioned, the old classic color organ is enjoying a resurgence. Today the use of micro controllers has become popular and driving LED strings. There is no shortage of designs out there to get where you want to be, likely with parts you have laying around. I suggest you start with a simple Google of " Arduino Color organ circuits" to find something you have parts for and does what you are looking to do. You can have simple response to audio VU level to LED intensity or filter the audio to drive PWM Arduino out based on amplitude and frequency of an analog input signal.
Start with a Google of Color Organ Circuits and get a handle on what is going on and how assorted amplifiers are doing what they do. Then once you understand the applied circuits try another Google but this time add the Arduino as in "Arduino Color Organ Circuits". The key words here are "color organ".
Ron

Thanks for the reply. I will spice it first to save time, then breadboard it.That circuit would be for taking a speaker level output as input.
This simple circuit will work if you use a rail-to-rail opamp like I suggested centuries ago. From a 100mV peak input it produces 0 to 5V output. which you should subtact 2.5V from to get the actual amplitude. If you want to use an LM358 with a 9V supply you would only have to change the biasing resistors to make sure there is 2.5V at the + input.
View attachment 181112
Bob
Arent you curious as why it doesnt work for you? Did you forget a step? Double check every wiring? That circuit is as simple as it get, testing code is straight forward. The only way to learn is to try and figure out why/how it works.Unfortunately, it didn't work. I will look around for others.
I believe it could be my connections to the pot.Arent you curious as why it doesnt work for you? Did you forget a step? Double check every wiring? That circuit is as simple as it get, testing code is straight forward. The only way to learn is to try and figure out why/how it works.
This could also be the reason.It probably didn't "work" because he is taking a 100mV input and the circuit has no gain.
Bob
Do you know what the settling value will be?If you get it to "work" it will give you a range of 471 to 553 counts on your ADC.
My circuit, with the gain of 25 will give you 0 to 1023 counts for a 100mV signal.
Bob
Thanks for the reply.The kid in the video has a chaser circuit driving a strip of LEDs and he is changing the colors by using an audio spectrum analyser circuit. His circuit works poorly at low levels because his peak detector uses a transistor that does nothing until the amplitude is high.
I agree that your circuit needs another non-inverting opamp (the second opamp in the LM358) so that the output is a much lower impedance.
An opamp has gain when it has TWO resistors at its (-) input.
I think your arithmetic is not correct when selecting resistor and capacitor values. See here:

That would be it. You need to get a low level signal amplified a little. You also need to get it into a usable range for the Arduino. Below are two images of a 1 KHz signal running into an Arduino Analon Input.It probably didn't "work" because he is taking a 100mV input and the circuit has no gain.
Bob
I think this is what MrChips was stating in post #28.Best approach is using just 1/2 of the waveform, since you are just detecting freq and amplitude to light the LED. This is better because now your voltage per scaling step is much higher thus, more accurate. There is no need for a peak detector circuit, since that can be done in your code
Something like this:
View attachment 181130
Yes - that is exactly what I am looking for. Mainly trying to use the LM358's because I have those to hand.The idea is you want amplification and you want an offset so your Arduino is not clipping the negative peaks as in the first image.
Ron