Go Down

Topic: How to read data from audio jack? (Read 32796 times) previous topic - next topic

DVDdoug

#30
Nov 01, 2019, 05:59 pm Last Edit: Nov 01, 2019, 06:03 pm by DVDdoug
jmjohnson419,

Your signal is probably too weak to overcome the diode's forward voltage drop.

What are you connected to?   Can you turn-up the volume?   (I hope you're not pugging-in a microphone...   You only get a few millivolts from a microphone and electret computer microphones need to be powered.)

Try the bias circuit at the bottom of this post.   With the bias circuit you should read about 512 with silence, and you can subtract-out the bias in software if you wish.

Quote
I am using the ReadAnalogVoltage Arduino example program
That should work.   You can remove the delay, especially with the bias circuit because you are now "sampling" the audio waveform instead of reading a varying DC voltage.   Or, you can try the "Simplest Effect" code associated with that post.   (There is "commented-out" code for printing the readings and you can remove the "//" comment marks.)



...For my "real" lighting effects I use an op-amp peak detector (AKA "envelope follower").   That takes care of the diode voltage drop issue.    But, it's a more complicated circuit and I power the op-amp with positive & negative 12V power supplies so it goes all the way down to zero.    And I add a protection circuit in case it goes over +5V.[/b]

jmjohnson419

DVDdoug, thank you for your reply and i am sorry i am just now seeing it.

To test i am using my phones audio jack to play music. They final project will use a audio jack output on a set of desktop PC stereo speakers.

I am still very new to building circuits and have a questions about the circuit you mentioned. How to I connect the ground and power the the rest of the circuit? When connecting it as detailed below i got a reading of around 512 +/- 5, increasing the volume did not change the results.



I am using a TRRS 3.5mm Jack Breakout for the audio jack input and i also tried the circuit with the ground connected to the sleeve on the breakout board i got a reading of around 1019-1024 when audio jack level was at 0, and 930-1024 when volume was at max.

Thanks for your help, I am in a better place than i was when started. Any additional assistance you could provider would be greatly appreciated.

Grumpy_Mike

You have not connected a ground signal from the audio to the Arduino. Try connecting the sleeve to ground, if that fails use ring 1.

jmjohnson419

#33
Nov 19, 2019, 04:21 am Last Edit: Nov 19, 2019, 04:25 am by jmjohnson419
Thanks you, that worked. I did not realize ground needed to be connected at sleeve and at positive end of capacitor. I appreciate the help.

Go Up