Adjusting this schematic to remove the two 9v batteries.

ebeowulf17

Joined Aug 12, 2014
3,307
Oops, I’ve edited my post. Earlier the TS said he was using a 386; later it was corrected to 358. I got them confused.

Does the peak detector really need the input cap, since the previous stage does?
The desired zero audio bias levels of the two circuits are different, so yes. First circuit needs to block dc and arrive at 2.5V levels. Second circuit needs to block that 2.5V and arrive at 0V levels.
 

Audioguru

Joined Dec 20, 2007
11,248
The peak detector opamp does not have a negative supply and its (+) input is at 0V so its input signal should also have an average voltage of 0V. Then it swings positive and negative with the AC signal).

The opamp amplifier (from post #86) in the previous stage (which is not needed since his phone produces plenty of signal level) is biased at +2.5V and its DC negative feedback through R3 causes its output to be at an average voltage of +2.5V. then the peak detector circuit needs the input coupling capacitor to block the +2.5VDC.
 

Thread Starter

Bod

Joined Sep 18, 2016
317
The best diode is a Schottky diode. The 1N4007 has too great of a Vf. Without looking it up, a typical value would have a 0.7 voltage drop. With a 1.2V signal, that gives you only 0.5V for your signal. A Schottky diode (as I used in my circuit) only drops 0.2V, leaving a 1V signal to follow. Twice the range.
I will buy some more diodes.

It’s hard to make suggestions. We provide tried and true schematics and you get nothing. It’s difficult to respond in that situation. It works for us, who ostensibly are more experienced, but doesn’t work for you... So what conclusion have you drawn?
I have come to the conclusion that I am doing something wrong.
As you correctly stated, you guys are more experienced and I get that. I'm not trying to crap on your circuits and say they are rubbish and don't work. As I said, I am doing something wrong, I just don't know what yet.

Breadboarded circuits are a nightmare. How can you see what is connected to what in that messy tangle of wires and parts all over the place?
In the photos, none of the wires are labeled as input, output, +5V or 0V. You can easily label them in Microsoft PAINT program on your photos.
I know they are. I have ordered breadboard jumper wires like these:
41fn2rk5JsL.jpg
To neaten up the projects on the breadboard.

And as requested, here is the schematic of my exact circuit: Screen Shot 2019-07-14 at 08.44.30.png
 
Last edited:

iimagine

Joined Dec 20, 2010
512
Since you dont have the right opamp, if you want to go back to the transistor circuit that i posted and try to figure out why it does not work for you, i'll be happy to help. Lets keep it simple, LM358 is just not worth it for this project.
 

Thread Starter

Bod

Joined Sep 18, 2016
317
Since you dont have the right opamp, if you want to go back to the transistor circuit that i posted and try to figure out why it does not work for you, i'll be happy to help. Lets keep it simple, LM358 is just not worth it for this project.
I actually was intending to do that because I found the right type of transistor that I needed. I thought I didn't have it but I do.
I will build it on the other breadboard to avoid having to take apart the other circuit.
 

iimagine

Joined Dec 20, 2010
512
I just built it in spice (using the universal opamp as I couldn't get the LM358 to work). Is this what the output should look like?
View attachment 181655
The output seems right because it is detecting the peaks and it is a low voltage.
1) The ouput is low because you had the input of 100mV, SINE (0 0.1 1000), change 0.1 to 0.7
2) Missing a coupling capacitor right before R5
 

Thread Starter

Bod

Joined Sep 18, 2016
317
1) The ouput is low because you had the input of 100mV, SINE (0 0.1 1000), change 0.1 to 0.7
2) Missing a coupling capacitor right before R5
I deleted the post because I felt it was unnecessary but I will try that out anyway.
Also, the coupling capacitor was removed because I was told it wasn't needed.
 

Thread Starter

Bod

Joined Sep 18, 2016
317
Since you dont have the right opamp, if you want to go back to the transistor circuit that i posted and try to figure out why it does not work for you, i'll be happy to help. Lets keep it simple, LM358 is just not worth it for this project.
Built your circuit in post #118 (using PN2222A instead) and this is the output:
With no audio it averages around 970:
Screen Shot 2019-07-14 at 14.04.18.png
This is slightly too high because when I play my 500hz sine wave:
Screen Shot 2019-07-14 at 14.04.25.png
I pretty much max out the ADC (1023 highest).
If I change the voltage divider resistors it will change the settling value won't it?
 

iimagine

Joined Dec 20, 2010
512
It seems like you have wired the transistor wrong. Check to make sure that you have Collector(C) and Emitter(E) connected right
 
Last edited:

Thread Starter

Bod

Joined Sep 18, 2016
317
It seems like you have wired the transistor wrong. Check to make sure that you have Collector(C) and Emitter(E) connected right
I have triple checked it and it looks right.
I flipped it around (so the emitter went to the collector and the collector went to the emitter) just to check but that made the values even higher - the settling value was ~1020.
The only other transistor I have is the 2N3906.
 

iimagine

Joined Dec 20, 2010
512
I have triple checked it and it looks right.
I flipped it around (so the emitter went to the collector and the collector went to the emitter) just to check but that made the values even higher - the settling value was ~1020.
The only other transistor I have is the 2N3906.
Take a close up pic, and measure your headphone output voltage

It is suppose to go from high to low since the halfwave is inverted
 

Thread Starter

Bod

Joined Sep 18, 2016
317
Take a close up pic, and measure your headphone output voltage

It is suppose to go from high to low since the halfwave is inverted
Wait a minute. If it is supposed to go from high to low, I did have it the wrong way around. That doesn't make sense though - I looked at this diagram:
2N2222-Pinout.jpg
Which means the emitter has to go to the 200-ohm resistor (following the schematic) On mine, the collector goes to the 200-ohm resistor and the emitter goes to the 2K; it is still a 2N2222A.

EDIT: it works the other way around but it looks like it picks random parts of the sine wave to amplify - is this true?
EDIT2: I can't accurately measure audio as my DMM frequency response is not good enough. I did try anyway:
I got from around 80mV to 240mV (500hz sine wave) but it was pretty random.
 
Last edited:

Thread Starter

Bod

Joined Sep 18, 2016
317
No it does not. It is bias so that only the positive portion of the input signal is amplified
Right, that makes sense. Had to think about it a little.

One last thing before this whole mess of a thread is finished - can I 'invert' so it goes from low to high? It's easier to use values like this in the code.

Before we do that - I have just tested it with real music but unlike the sine wave, it barely even reacts to the music. I did not see it go below 1010. That's a difference of about 10.
It's possible the output of Spotify is quieter and so less happens.
 
Last edited:

iimagine

Joined Dec 20, 2010
512
DeleteMe.PNG
Place a 50k pot in series with the coupling capacitor to adjust the input voltage. If your headphone output voltage is too high, the wave will be clipped.
 
Top