1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Precision Rectifier...what's going on here?

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by Rich D., Mar 22, 2016.

  1. spec

    spec Well-Known Member Most Helpful Member

    Joined:
    Oct 27, 2015
    Messages:
    5,828
    Likes:
    709
    Location:
    Somerset UK GMT
    Hi Rich,

    I see your point about dynamic range and nose floor.

    It has been a pleasure talking to you about your peak detector and, as is often the case, I have learned a lot.

    All the best, and yes, do come back to ETO

    Cheers

    spec
     
  2. Mikebits

    Mikebits Well-Known Member

    Joined:
    May 24, 2008
    Messages:
    6,214
    Likes:
    174
    Location:
    San Diego, Ca
    Thanks, but I am not looking to acquire any data books. I only mentioned that I have 3 because at one point in my life I had a book shelf full and decided to throw them all away. I only kept the few that I have now because they were the ones I thought worth keeping (as mentioned above). The TI hardback has a sentimental value attached to it as it was a gift to me from my father :)
    Now back to your regularly scheduled program...
     
  3. spec

    spec Well-Known Member Most Helpful Member

    Joined:
    Oct 27, 2015
    Messages:
    5,828
    Likes:
    709
    Location:
    Somerset UK GMT
    I know how it is about books Mike. I had half a small room full at one time. The handy thing about ebooks is that they don't take up any space in your house, even if they do on your HDD. :)

    What do you mean?

    spec
     
    Last edited: Mar 30, 2016
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. bountyhunter

    bountyhunter Well-Known Member

    Joined:
    Jul 17, 2009
    Messages:
    1,560
    Likes:
    81

    There was only one of those.
     
  6. bountyhunter

    bountyhunter Well-Known Member

    Joined:
    Jul 17, 2009
    Messages:
    1,560
    Likes:
    81
    The circuit in 56 does not do the job of a peak detector. The output of the op amp has probably 5 - 10 mA available to charge the 33 uF cap, which means the fastest rise time it can "track" is about 0.3 V/millisecond which is very slow (probably 100X too slow for audio). Anything faster and it just waves as it goes by. To be a peak detector, that cap needs to be a lot smaller (I would recommend maybe 0.22uF CER) The circuit as shown in 56 is so slow it is more of an averaging meter than peak reading. It will read peak value only if the signal is there long enough to let the cap charge up fully which for a 20V signal would be about 70 ms.

    The circuit shown below is a peak detector which will work. If +/-15V supplies are used, it could handle a 24V (p-p) input signal. Best to use J-FET input op amps to minimize leak off. Something like TL-084 or TL-074 would be a good choice, but for cost savings LM358 could be used (just need to minimize input bias current).

    The signal in (from the left) looks into the non inv input which would be very high impedance so you would not need the "buffer" stage shown in 56 curcuit (saves one op amp), all you would need is a large resistor to ground for DC bias. You could use 200k Ohm so the circuit would not load your signal source.
     

    Attached Files:

    • PEAK.jpg
      PEAK.jpg
      File size:
      25.7 KB
      Views:
      162
    Last edited: Mar 30, 2016
    • Like Like x 1
  7. bountyhunter

    bountyhunter Well-Known Member

    Joined:
    Jul 17, 2009
    Messages:
    1,560
    Likes:
    81
    The importance of a peak detector being able to slew fast enough to track the peak is easily seen in a sample of an audio track. The sample shown below is shown zoomed in on the right side so that each major time division is 1 milli second. As the example shows, the audio signal slews about 70% of total amplitude in about 500 micro seconds. If the signal was scaled so this was a 20V (p-p) range, the signal would be a 15V excursion. That means the peak detector would have to be able to slew about 30V/ms to follow this particular signal and this one was picked at random.
     

    Attached Files:

    • Like Like x 1
  8. schmitt trigger

    schmitt trigger Active Member

    Joined:
    May 24, 2009
    Messages:
    886
    Likes:
    84
    I LOVE all those circuits that appeared in Nat Semi's Application Data books. I still have a couple from the early 70s (blue background with a white bar)
     
  9. schmitt trigger

    schmitt trigger Active Member

    Joined:
    May 24, 2009
    Messages:
    886
    Likes:
    84
    I just built a small weather station, which includes wind speed. In my area, wind is very gusty. It is normal on a spring afternoon for the wind to gust between 5 and 35 km/hr within a few seconds. Try reading that with a digital display! Even with a bar-graph can be dizzying. But an analog meter does the job just right.
     
  10. Rich D.

    Rich D. Member

    Joined:
    Feb 3, 2014
    Messages:
    210
    Likes:
    15
    Location:
    West Chester, PA
    Bounty Hunter: Hmm. I think you may be right. I didn't give it a thorough workout on fast transients. I was concerned about the charge rate and drew up an idea with a booster transistor. I should have continued on and tried it to see how that would go, but it seemed fast enough (in terms of 20KHz response, not transients which I failed to test because I just wanted to get this design over with).

    I did try a different circuit similar to the one you showed, with a 2nd op amp in the feedback path. The article I got it from warned of the possibility of instability. I tried it and it didn't seem to work so well - a bit of oscillation and serious high-frequency roll off - most likely because I wasn't using the best op amp for the job.

    I certainly understand the concern about slew rate and detecting transient signals, but I was thinking that would be impractically fast...oh wait, I thought I read 500 nano seconds! OK, 500micros is significant for audio...nevermind. :oops:

    ANYWAYS...

    I couldn't get the idea out of my head about using a comparator circuit, so I gave it another go. This time I stopped fooling around with slow op amps and wanted to grab a TL074. Didn't have any so I used a TL084. Pretty much the same thing, both fast and slew-y. I also wanted to try an LM339 but out of them also, found a similar two-comparator chip the LM393 I was going to try. Also quite similar to the '339.

    Harp12 Meter Success 1.jpg

    Being as lazy as I am, I started out the breadboard circuit just using the TL084 as a comparator, but set up a PNP output that literally DUMPS more than 100mA into the cap (Tim "the tool man" Taylor would be proud). It was still 1uF because I just wasn't getting the hold time with 0.1uF. The other nice thing about the TL084 is the JFET inputs sip so little current, great for the holding cap which is potentially drained by 2 op-amp inputs, and the input buffer. Not sure how well the '84 would work as a comparator, I did have the LM393 on standby duty.

    The performance of this circuit worked so well I had no reason to introduce another LM393 package and it's typical pull-up resistor. It responded within a few percent or so from 20 Hz to 20,000 Hz at the full 24 volt pk-pk signal input. This pix shows a single transient input at 22.8 volts pk-pk, and the resulting output immediately jumps up to about 12 volts within about 100μSec. You can even see how it caught that little hump before the scope even triggered.
    A2 Single Pulse 22vpp SAM_0521e med.JPG

    This next pix shows the response when a 2KHz signal was switched up +20dB. It even caught most of that single little spike before the sine waves get big. I don't have pix of it, but this same response showed itself through the full 20 - 20K range.
    A1 On Complex 2KHz SAM_0525e med.JPG

    Here I test the overall peak hold with a small burst of 2K. It settles out completely within 2 seconds. That was using a 1 Meg Ω bleed on the 1μF cap. I wanted more.
    A3 Burst 1M SAM_0527e med.JPG

    With a 4.7 Meg Ω bleeder resistor, I get about 5 seconds before the meter settles out. In my application, the next -3dB LED will switch about 8/10 second later at about 8.5 volts.
    A4 Burst 4p7M SAM_0529e med.JPG

    So forget all I said about the previous circuit. That one was crap. By comparison, this newer circuit uses the same 3/4 of a chip package, but uses 3 less diodes, a smaller (and non-electrolytic) capacitor, two less resistors, all in exchange for a single jellybean transistor.

    Thanks again for all you helpers! ...and NO, this is NOT an April Fools joke! :D
     
  11. audioguru

    audioguru Well-Known Member Most Helpful Member

    Joined:
    Mar 16, 2004
    Messages:
    32,445
    Likes:
    937
    Location:
    Canada, of course!
    In your latest circuit showing a TL074, the first opamp can be replaced with a piece of wire then a smaller TL072 can replace the TL074.
     
  12. spec

    spec Well-Known Member Most Helpful Member

    Joined:
    Oct 27, 2015
    Messages:
    5,828
    Likes:
    709
    Location:
    Somerset UK GMT
    Hy Rich,

    Circuit is looking good.

    May I make a few suggestions:
    (1) Change PBJT from 2N3906 to BC327 or similar higher current transistor. The BC3906 hFE is struggling a bit after 20mA and hfe will be much worse.
    (2) Change R76 from 6K8 to 1K to speed the transistor turn off by emptying the base charge faster.
    (3) Change R71 from 6K8 to 3K3 to hit the base of the transistor with more current and to pull the opamp output up faster to aid turning the transistor off faster.
    (4) Change R79 from 10K to 1K (22R would be OK) to feed the TL072 with a lower Z to give better noise and transient response.
    (5) Change R81 from 10K to 1K (22R would be OK) to feed the TL072 with a lower Z to give better noise and transient response.
    (6) I would be inclined to replace the 4M7 resistor to 0V with a constant current sink so that hold -dV/dt (drop on the hold capacitor) is constant throughout the voltage capture range. 20M Ohm or higher down to -15V would approximate a constant current, if you didn't want to go for anything fancier and generate a true constant current that is.
    (7) Also, if you haven't done it already, I would suggest putting some heavy duty, high frequency decoupling directly between the emitter of the transistor and the 0V of the holding capacitor: 100nF ceramic capacitor in parallel with a 47uF solid tantalum capacitor would be the sort of thing. I notice from your schematics that you are strict about decoupling opamps.

    spec
     
    Last edited: Apr 1, 2016
  13. bountyhunter

    bountyhunter Well-Known Member

    Joined:
    Jul 17, 2009
    Messages:
    1,560
    Likes:
    81
    I don't think it is possible to oscillate because the circuit I posted does not function as a closed loop amplifier, it acts like a comparator. The voltage on the cap is constantly compared to the input signal. If Vin is higher than Vcap, the output snaps high and dumps current into the cap. When Vcap goes higher than Vin, it snaps off. I built it using LF356, TLO84 and LM358 and never saw anything oscillate.
     
    Last edited: Apr 1, 2016
  14. Rich D.

    Rich D. Member

    Joined:
    Feb 3, 2014
    Messages:
    210
    Likes:
    15
    Location:
    West Chester, PA
    Audioguru: Gee, I guess you are right. That input buffer has been there so long I didn't notice it. I suppose a piece of copper would be cheaper, more reliable, and draw less power.
    bountyhunter: Oh, I see that now. Kind of works like a closed-loop amp on the negative peaks, but the positive peaks are wide-open. The other side is just a follower for the holding cap.

    Spec:
    1) OK, I have some PN4355's that will give me Hfe of 75 up to 500mA. I was going to use them if I was having trouble.
    2) I'll go to 3.3K on the base resistance, but that's my final offer. That thing will have almost 30 volts across it.
    3) Oops, that was the other one. See, we think the same. I'll make this 1.6K because I have some 5%.
    4) Sure, whatevs.
    5) Shure, whatevs. BUT, at that point all we are doing is turning on LEDs, so noise & transient response don't really matter.
    6) Wow, I had that idea also, using a simple JFET as a crude current regulator. I just didn't feel like playing with it because it was late.
    I'll try it once, but if it doesn't work, screw it, I'll use a resistor. I can see how a 20MΩ could simulate that and that will be my back up plan if I can't find 40V FETs.

    7) I'm not usually strict about schematics I use for design ideas. When I "go into build" I get anal about documenting.
    Also, I DO put decoupling wherever I am using higher current transistors - so I'm sure I'll put a few in there on the final board because it will share the PCB with audio circuitry. I will probably put a ground 'wall' to separate the analog from digital area and feed the signal through. I don't want those LEDs causing clicks. Already I'm planning to use a separate +/- 15 volt supply for isolation.
     
  15. bountyhunter

    bountyhunter Well-Known Member

    Joined:
    Jul 17, 2009
    Messages:
    1,560
    Likes:
    81
    I was wondering what the overshoot would be if you put in a step voltage (very fast rise) of maybe zero to 5V amplitude on the input and checked the peak voltage for overshoot (?)
     
  16. spec

    spec Well-Known Member Most Helpful Member

    Joined:
    Oct 27, 2015
    Messages:
    5,828
    Likes:
    709
    Location:
    Somerset UK GMT
    Hy Rich,

    good stuff- I think we all speak the same language on this thread. Just a couple of points though:
    (3) The TL072, although a sweet sounding baby, is not big on output voltage and current drive, like some of the the later rail to rail output types (OPA192). For that reason the 3K3 resistor will only have -10V to 14V = 24V across it at DC. Dynamically it will be quite a bit less because the TL072 is no greyhound. Still you have made me happy by putting a 3K3 resistor in. I hope it works OK
    (4) I really would go to IK across the base: that only gives 600uA base clearing current and only 600mV aiming potential which isn't much, especially with the collector whipping around so fast and boosting Cbc into a relatively large virtual capacitor at the base, not to mention Cbe in parallel. You should have around 6mA flowing through the 3K3 resistor so there will be heaps of base current drive and the transistor will turn on fast, but turning off is not so good. I was going to suggest chucking away 1mA and putting a 560R resistor across the base, still leaving 5mA base current. It is normally harder to turn a transistor off than to turn it on, in my experience anyway.

    I will get my coat now. :happy:

    spec
     
    Last edited: Apr 1, 2016
  17. Rich D.

    Rich D. Member

    Joined:
    Feb 3, 2014
    Messages:
    210
    Likes:
    15
    Location:
    West Chester, PA
    Spec: OK, I was holding off at 1.6K because I have some 5% around, that decision was purely economical - I'll save a full penny or two! My records don't show it but I'm sure I have 1K 5% somewhere so I'll put that in -or- I know I have 560 5% resistors if you really think that's best.

    bountyH: I tested it with a pulse going from -10 to +10 in 150μSec. The output seemed to have about 1/2 to 1 v overshoot. (That's the 1st scope pix up at #89.)
    I think if I make the changes spec suggests, I can improve that overshoot by turning the transistor off a bit quicker, but I don't consider it a big problem for this particular use. If a user sees the LED signal at a slightly lower input level than ideal, he/she may turn down the gain a bit, but the overshoot should only make a difference of a fraction of a dB.


    In real-world recording, I often have to fudge the headroom a bit to account for signals which vary quite a bit. Even beyond that, many musicians seem to play with a bit more energy after 1/2 way into a song, even though I ask them to play their loudest parts while I set the levels. Live is even worse. I'll often have to set the peaks at -6 to -9 or so to allow for the variable nature of the signal & player. So whether the 0dB clip light goes on a maybe 1dB too low, I'm still going to back it down by maybe 6 dB or more. If I were to back it down a dB or two too much, the end result is only that much dB more noise on that particular track when mixed down. Unless it is a primary/solo instrument mixed down at full volume, it will likely be 6 to 20 dB down anyways in the final mix. It's great to strive for technical perfection with audio, but I also like to be practical. Best case, the music will be mixed down to 16-bit CD audio if I'm lucky, MP3 if not so lucky.

    Distortion is another one - don't get me started! It's great to find a device with 0.0001% THD+N, and that is more important when chaining 5, 10 or more devices together (which often can happen in recording-reproducing). However in the end, somebody somewhere has to listen to it, and that will likely be through a speaker or headphone with 1% distortion or more in a room with less-than stellar acoustics, with the dishwasher & air conditioner running in the background. Not too many get the chance to sit quiet in a listening studio using state-of-the-art equipment.
    Stepping down now.
     
  18. audioguru

    audioguru Well-Known Member Most Helpful Member

    Joined:
    Mar 16, 2004
    Messages:
    32,445
    Likes:
    937
    Location:
    Canada, of course!
    Hearing the audio systems that we use every day at home maybe we get used to their "1% distortion or more in a room with less-than stellar acoustics, with the dishwasher & air conditioner running in the background" then we can hear 0.001% distortion from a new signal. For about one week there is a worldwide figure skating championship contest and the sound on the TV network is absolutely horrible. The horn tweeters in the hockey arena have the worst frequency response and high distortion I have ever heard and the acoustics are an echo-chamber. The producers of the TV show must be deaf and stupid because why don't they feed the signal not the sound to the TV network?? Is all they care about is that we can hear the applause from the audience?
     
  19. Rich D.

    Rich D. Member

    Joined:
    Feb 3, 2014
    Messages:
    210
    Likes:
    15
    Location:
    West Chester, PA
    OMG I've actually complained about that exact same thing!!! I don't remember what skating event(s) it was, but it blew me away that nobody bothered to run a wire from the (tape/cd player)? source and the broadcast truck. Insane...or at least complete disregard for us listeners. Now I am not an audiophile snob, but when presented with bad sounding audio, I generally prefer to turn it off and listen to the voices in my head instead.

    To put it in perspective though, I care a lot about good sound quality, but I also recognize that the real enjoyment is in the song, the groove, the emotion, the vibe or whatever you call what you like about the music. I'd much rather listen to a crappy radio fading in and out a favorite Pink Floyd song then to listen to a fine-tuned club system playing some lame-ass [xxx*] song. (* insert your least favorite music here. I wanted to name names, but I realize everybody's taste is different.)

    So I like to keep it real, sound quality is important to me, but certainly not the most important, and I try not to forget about the art involved. Speaker quality and placement is important, and I also care a lot about a full, flat, wide-range frequency response. Noise and hiss is annoying but often tolerable. I'm less concerned about small amounts of distortion - I can often hear the difference, but I am not too put off by a slightly different sound if it's not blatant clipping.

    I have to laugh when I see audiophile ads stating that company XXX figured out the exact number of twists per inch to put in wire-pair between the crossover and the driver. Now, you shouldn't twist it into a tight inductor or leave them loose, but seriously...I'd like to meet the person that can hear the difference between 3 and 4 twists per inch. Even in a perfect listening environment almost any non-millionaire affordable speaker is horribly inaccurate compared to the rest of the signal chain, and there are so many complex acoustic interactions in any room environment that something like controlling the number of twists per inch of wire in a speaker is (a favorite expression of mine) like "putting lipstick on a pig".
     
    • Funny Funny x 1
  20. audioguru

    audioguru Well-Known Member Most Helpful Member

    Joined:
    Mar 16, 2004
    Messages:
    32,445
    Likes:
    937
    Location:
    Canada, of course!
    At the women's skating championships on TV I ignored the bad sound and watched most of the expert skaters slip and fall down. A new 16 years old girl from Russia won and got the highest marks in history. She knew she nailed it long before she finished.
     
    • Like Like x 1
  21. bountyhunter

    bountyhunter Well-Known Member

    Joined:
    Jul 17, 2009
    Messages:
    1,560
    Likes:
    81
    I had to bite my tongue to keep quiet when a buddy of mine showed me some of the magic braided cable that he had bought to connect his speakers to his amp some years back..... they supposedly tuned out the "standing waves".

    The punch line is that this guy was a EE like me and I couldn't believe he had fallen for such a complete line of baloney.
     
    • Like Like x 1
    • Funny Funny x 1

Share This Page