Audio analyzing circuit only outputs 0 and 1023 - why?

Hi all, I built the attached circuit, except I changed the DC bias resistors to 10k and the feedback resistor to 2k, and removed the 47uF capacitor. I know the DC bias works, since when no sound is played, a value of ~512 is printed to the serial moniter.

But whenever I play any sort of audio, only the values 0 and 1023 are output - why is this? I know I should be getting values in between 0 and 1023.

I tried to troubleshoot the best I could. I don't have an oscilloscope, instead I used a multimeter to measure the AC voltage output from the audio jack. My multimeter only has one decimal place, so I got values between 0.1-0.2 volts when playing at max volume. I'm assuming my problem is that the signal is not "loud" enough, is that the reason I'm only getting analog values of 0 and 1023?

How to post an image

I used a multimeter to measure the AC voltage output from the audio jack.

It's not clear where on your schematic you are measuring.

From the symptoms you describe I would think that the problem is the signal is too 'loud' (to use your terminology) and is clipping, which means it is only ever at the highest and lowest level. Try reducing the level slowly down to 0.

An oscilloscope is really essential for this kind of thing.

Please post your code, using code tags: How to use this forum

47uF capacitor != 47nF

larryd:
47uF capacitor != 47nF

Yeah, that was a typo. Nevertheless I did not include it in my circuit.

What AC level is measured on A0 with ~100Hz input.

With no input do you get 2.5VDC A0 to GND ?


Show us a good image of your ‘actual’ wiring.
Give links to components.
Posting images:
https://forum.arduino.cc/index.php?topic=519037.0


What I.C. is that ?


The 47nF would filter out high frequencies and hold low frequency voltage levels.

PerryBebbington:
It's not clear where on your schematic you are measuring.

I got the 0.1/0.2v AC readings from the ground and one of the other pins from this audio socket: AUDIO 3.5MM – SAYAL Electronics (On the schematic it is between the upside down V's connected to the op-amp terminal.

I then tried another AC reading from the node in between the two 100k resistors (on my circuit they were 10k), and got values ranging from 2.2-2.4v. It never exceeded 2.5v.

PerryBebbington:
From the symptoms you describe I would think that the problem is the signal is too 'loud' (to use your terminology) and is clipping, which means it is only ever at the highest and lowest level. Try reducing the level slowly down to 0.

This is where I am confused. If I am getting multimeter readings of 0.1v at the audio input jack, how can I be getting a signal that is too loud using my amplifier configuration, or did I do the math wrong?

That's a screwy amplifier design.

Try leaving-out the amplifier... What's your signal source?

If you need an amplifier look for a more traditional inverting or non-inverting design and you can add a pot/volume control to the input.

If you just need a small amount of amplification add some "gain" in software, or increase the sensitivity in software. You can increase the sensitivity and add a pot in front of the bias circuit if you need manual adjustability.

My multimeter only has one decimal place, so I got values between 0.1-0.2 volts when playing at max volume

That may, or may not be, "true". Some meters have diodes on the inputs so they don't read low AC voltages accurately, and unless you're using a constant test-tone you're probably not getting the peaks.

larryd:
What AC level is measured on A0 with ~100Hz input.

I'm getting 6.0v, positive to the A0 node and negative to ground with my multimeter on the AC setting.

larryd:
With no input do you get 2.5VDC A0 to GND ?

No, surprisingly I'm getting 5.0v on the dot and I'm not sure why.

larryd:
Show us a good image of your ‘actual’ wiring.

I've compiled a couple of images of the circuitry in an imgur album: https://imgur.com/a/oPlQH9k

larryd:
What I.C. is that ?

It's the TL082CP op-amp. I'm going to create another reply with links to the components that I purchased.

Thank you so much for taking the time to reply and to help me diagnose, Larry.

DVDdoug:
Try leaving-out the amplifier... What's your signal source?

If you need an amplifier look for a more traditional inverting or non-inverting design and you can add a pot/volume control to the input.

I actually found this circuit from this instructable, which seems pretty thorough - to me it makes sense, since I might need to amplify my signal if it is too weak: https://www.instructables.com/id/Arduino-Audio-Input/

My signal source is an iphone 6 plus audio jack, which is connected to my circuit via a male-to-male stereo cable.

I then tried another AC reading from the node in between the two 100k resistors (on my circuit they were 10k), and got values ranging from 2.2-2.4v. It never exceeded 2.5v.

Not withstanding the comments about multimeters not being accurate at low voltages, 2.4VAC is 3.39V peak and 6.78V peak to peak, well into clipping at the input of the Arduino. Your results don't surprise me.

Multimeters measure RMS, your Arduino is seeing the peak to peak voltage, not RMS.

I actually found this circuit from this instructables

Sorry, but that explains everything....

List of components:
10k pot: https://secure.sayal.com/STORE2/View_SHOP.php?SKU=244848
10k resistor: RES 10K 1/2W 5% CF - - SAYAL Electronics
1k resistor: RES 1K 1/4W 5% CF - - SAYAL Electronics
3.5mm audio socket: AUDIO JACK 3.5 STEREO PLASTIC CHMT SOLDER - 24-388-1 - SAYAL Electronics
op-amp: DUAL JFET-INPUT OP AMP 8P DIP - TL082CP - SAYAL Electronics
10uF electrolytic capacitor: CAP LYT RDL 10UF 50V 5X11MM 105C - - SAYAL Electronics

With no input do you get 2.5VDC A0 to GND ?

“No, surprisingly I'm getting 5.0v on the dot and I'm not sure why.”

Fix this.


Show us a good image of your 'actual' wiring.

PerryBebbington:
Not withstanding the comments about multimeters not being accurate at low voltages, 2.4VAC is 3.39V peak and 6.78V peak to peak, well into clipping at the input of the Arduino. Your results don't surprise me.

Multimeters measure RMS, your Arduino is seeing the peak to peak voltage, not RMS.

This is very helpful. So does my feedback resistor need to be a much smaller value to produce less gain, as my arduino can only take 2.5v peak to peak?

Also, I mentioned in another comment that I was getting 5v into A0 with no sound, which I don't understand. With the voltage divider, it should be 2.5v, no?

Does my feedback resistor need to be a much smaller value to produce less gain?

Yes. As shown the circuit has a minimum gain of 11 with the pot adjusted to maximum value.

I mentioned in another comment that I was getting 5v into A0 with no sound, which I don't understand. With the voltage divider, it should be 2.5v, no?

With no input it should be 2.5V, yes. If it is not then something is not how you think it is.

Show us a good image of your 'actual' wiring.

larryd:
Show us a good image of your 'actual' wiring.

Sorry man, I don't know what you mean by 'actual'. I uploaded an imgur album with pictures of my circuit irl, if that's what you mean.

https://imgur.com/a/oPlQH9k

This low resolution of your image makes it impossible to trace out your wiring connections.


BTW
suggest you permanently leave jumper wires in the middle of your power rails.


larryd:
What AC level is measured on A0 with ~100Hz input.

With no input do you get 2.5VDC A0 to GND ?

Hi Larry. I realized that I made a mistake when measuring DC voltage from A0 to GND. I do in fact have 2.5VDC (2.36v to be exact); I stupidly left my multimeter on the AC setting.

As for 100Hz input, I get an AC reading of approximately 5.8-6v. Correct me if I am wrong as this is new territory, but this 6v reading is an RMS reading, which, according to an online calculator, has a peak voltage of approximately 8.5v. I should be shooting for 2.5v peak to peak correct? So I need a much smaller feedback resistor value in order to decrease the gain?