DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: gez on June 17, 2004, 09:45:25 AM

Title: Precision rectifier blues
Post by: gez on June 17, 2004, 09:45:25 AM
Does anyone know of any ICs that have, as part of the chip, a precision full-wave rectifier that can be tapped so that it can be used on its own?  (preferably something easy to obtain and that will work with a single supply)

I'm using a two op-amp precision diode affair and it's not doing the job well enough.  Normally it wouldn't be a problem, but this is one of those occasions where 'close enough for Rock & Roll' simply isn't good enough.  I need something that will produce a consistent FWrectified output, without distortion, regardless of signal amplitude/frequency (lower audio range).

Schematics I've found on line for alternative FWrectifiers tend to use chips that are unobtainable over here.

Any help would be appreciated.  Thanks.
Title: Precision rectifier blues
Post by: puretube on June 17, 2004, 11:55:37 AM
don`t know where you`re heading,
but maybe you`ll find s.th. that suits your needs
at the compander/VCA manufacturers, like
http://www.thatcorp.com/icprod.html,
or in the NE570/571,
dBA, SSM....
Title: Precision rectifier blues
Post by: R.G. on June 17, 2004, 12:04:39 PM
That's a little confusing. The two-opamp setup is, in general, good for signals down to millivolts and up to half the power supply minus a volt or two, and for frequencies up to mid audio or beyond. I've built one or two and they really do work that way.

What kind of results are you getting?
Title: Precision rectifier blues
Post by: mikeb on June 17, 2004, 12:42:57 PM
Gez, I've emailed you a circuit + text by Harry Bissell - could this work for you?

Mike
Title: Precision rectifier blues
Post by: gez on June 17, 2004, 12:53:03 PM
Quote from: R.G.What kind of results are you getting?

This is how I've wired up the circuit RG

(http://hometown.aol.co.uk/Gezpaton/FWR.GIF)

Although all the schematics I've see for this are all for dual supply I figured that with the virtual earth effect seen at the inverting input, this circuit would work ok with a single supply.  

The circuit is being driven from by a triangle wave whose amplitude decreases as frequency increases (about 4.5V to 1V).  When rectified, the amplitude of one of the peaks becomes uneven as frequency increases (seems to be bias shift).  The trimpot only linearises things over a small range.  The distortion is enough to mess up things further down the line (big time!).

Need perfect twin peaks (don't we all!).  All help appreciated.
Title: Precision rectifier blues
Post by: gez on June 17, 2004, 01:02:31 PM
Quote from: mikebGez, I've emailed you a circuit + text by Harry Bissell - could this work for you?

Thanks Mike, but there's nothing in my inbox.  :(

gezpatonATmsn.com
Title: Precision rectifier blues
Post by: puretube on June 17, 2004, 01:04:05 PM
gez: do you strictly want to rectify, or
just want to double a triwave-frequency?
("clip/mirror")
for the latter, go synth DIY sites...

(sorry, don`t have links on this PC)

edit: ooops, guess they are for constant amplitudes...)
Title: Precision rectifier blues
Post by: gez on June 17, 2004, 01:07:01 PM
Quote from: puretubegez: do you strictly want to rectify, or
just want to double a triwave-frequency?
("clip/mirror")
for the latter, go synth DIY sites...

I want to double the frequency.  It's for an octave circuit.  Square wave in, sine out at double the frequency.  The circuit actually works but the octave effect is lost at higher frequencies due to the signal distortion caused by the rectifier.  I need a triangle out at double the frequency of the triangle going in.
Title: Precision rectifier blues
Post by: puretube on June 17, 2004, 01:13:53 PM
sorry for asking you this: is your Vref low-impedance enough?

Maybe another solution: parallel cap to the trimpot, or the upper 200k resistor?
Title: Precision rectifier blues
Post by: gez on June 17, 2004, 01:19:09 PM
Quote from: puretubesorry for asking you this: is your Vref low-impedance enough?

No offense taken, I make dumb mistakes all the time!  :)   Yes the Vref is low enough, besides the quad amp is CMOS and has miniscule input bias/leakage current so everything has biased up nicely.

QuoteMaybe another solution: parallel cap to the trimpot, or the upper 200k resistor?

I'll have some time tomorrow so I'll give this a go.  I need to disconnect the oscillator and feed the rectifier with a signal from my generator (one of stable amplitude).  If the problem is amplitude related then I can get round this by companding the signal thru the rectifier.

Thanks for you help.
Title: Precision rectifier blues
Post by: Transmogrifox on June 17, 2004, 03:36:42 PM
Here's another full-wave rectifier approach.  It is a symmetrical circuit, and I think it should not have the un-wanted distortion effect if using switching diodes such as 1N4148.  It's part of an envelope follower on a filter I have.  Here's the link:

http://www.geocities.com/transmogrifox/Efollowwahconvert

Copy and paste it to another browser.  It should be apparent what part of the circuit is the full-wave rectifier.  As I said, it is a symmetrical circuit and works very well.  I got it out of my Microelectronic Circuits text by Sedra and Smith.

The schematic you have shown is most certainly prone to error and need of fine tuning.  I don't consider that circuit to be a "precision" full wave rectifier.  It includes a precision half-wave stage, but the need to adjust the gain added to a the effect of the op-amp phase response at higher frequencies makes the timing more critical.
Title: Precision rectifier blues
Post by: Jason Stout on June 17, 2004, 03:39:48 PM
Gez, last year I ran into problems trying to use a single supply, I knew the circuit worked well with my bench supply...I gave up, got sidetracked...maby (with puretube's insight) I'll go back to it.
Title: Precision rectifier blues
Post by: Jason Stout on June 17, 2004, 04:05:54 PM
Transmogrifox, Thanks!
Title: Precision rectifier blues
Post by: mikeb on June 17, 2004, 04:31:56 PM
Gez - just emailed you again from my backup mail account.

Mike
Title: Precision rectifier blues
Post by: gez on June 17, 2004, 05:27:49 PM
Mike, thanks I'll read thru it all this weekend.

T-fox.  Thanks, but I've already tried this parallel approach using the +ve input for one of the amps and -ve for the other.  Same result.  

Both approaches work and I've used the circuit I posted in an autowah (not perfect but good enough), but as I said earlier this thing needs to be spot on.

Thanks for your help and thanks to all those who've replied.  I'll check over everything this weekend and see if I can improve on things.
Title: Precision rectifier blues
Post by: Paul Perry (Frostwave) on June 17, 2004, 08:01:36 PM
Quote from: gezSquare wave in, sine out at double the frequency.  The circuit actually works but the octave effect is lost at higher frequencies due to the signal distortion caused by the rectifier.  I need a triangle out at double the frequency of the triangle going in.

??? I can't see how rectifying a square wave is going to give a sine, or indeed any doubled frequency.
At very low frequencies, the square might be differentiated by the input cap & then you could get doubling. Am I missing something..
Title: Precision rectifier blues
Post by: R.G. on June 17, 2004, 09:51:27 PM
QuoteI want to double the frequency. It's for an octave circuit. Square wave in, sine out at double the frequency. The circuit actually works but the octave effect is lost at higher frequencies due to the signal distortion caused by the rectifier. I need a triangle out at double the frequency of the triangle going in.
OK, gotcha. I spent a good part of the 70's messing with questions like that.

So, you're taking in a square wave, running it into an integrator, trying to full-wave double it, then sine shape the resulting triangle. That accounts for the linearly decreasing amplitude on the triangle. Also for some of the difficulties.

You need to capacitor couple the input of that mess. Any DC offset coming in from the driving opamp will push the thing off to one side at small signal levels. As a practical matter, you'll probably need to null any DC offsets to get good millivolt level rectifcation. It may be that the offsets are what is killing you now.

That approach is full of a slew of practical problems. Here are two of them.
- First, is your square wave square? If it's not, you get an offset on the integrator and it walks off to one side of the power supply. The only way to get a square wave square enough is if it's the output of a digital flipflop divide by two or other inherently equal mark/space process. Anything like a squared up guitar signal is not going to be square enough in general.
- Second, the steadily decreasing amplitude messes up any possible sine shaping. You'll have to restore it to constant amplitude to get even passable sine shaping at the end of things.

A lot depends on your signal source. If it's musical instrument such as guitar, microphone, etc. then it's going to be hard. The dynamics of the instrument are going to fight you a lot.

One thing you could do is to use a CD4046 phase lock loop to lock to the incoming square wave, then drive a divider in the feedback loop of the PLL to get a high frequency locked to the input. With this, you can feed a shift register and flat out generate a sine wave directly from the PLL output. With a divide by 16 PLL and a 16 stage shift register, you can generate a sine directly with resistors that is a pure sine with distortion products starting only at the 15th and 17th harmonics, 31st and 33rd, etc. and amplitudes down in the mud. The "in lock" signal from the 4046 phase pulses let you mute the output unless the chip is locked. Of course, if you leave it unmuted, it will follow the input and catch it audibly. If you use an underdamped loop, it will overshoot and ring around the target frequency as it locks.

But I digress. What's your signal source?
Title: Precision rectifier blues
Post by: puretube on June 18, 2004, 01:49:40 AM
gez: read somewhere it takes high slewrate opamps for your circuit,
due to rapid charging/discharging the diode`s capacitances.
source also says: use low drop diodes.

If you have access to the Horowitz/Hill "Art of Electronics", there`s another nice circuit (next to "yours"), in the chapter "feedback and operational amplifiers".

And, BTW.: the FWR circuits I know, have the diodes the other way round than in your circuit! give it a try, and flip `em.
:wink:

and edited: I second R.G.`s mentioning of inputcap concerning offset!
Title: Precision rectifier blues
Post by: gez on June 18, 2004, 03:37:18 AM
QuoteSo, you're taking in a square wave, running it into an integrator, trying to full-wave double it, then sine shape the resulting triangle

Bingo.  A further integrator does the sine shaping.

QuoteYou need to capacitor couple the input of that mess.

Neglected to put one on the shematic, but there is one.

QuoteAs a practical matter, you'll probably need to null any DC offsets to get good millivolt level rectifcation. It may be that the offsets are what is killing you now.

Good advice.  I think this, and possibly the amps/diodes I'm using may be causing the problem.  I'm going to do some extensive testing this weekend and see if I can improve on matters.  I'll report back with the results.


QuoteFirst, is your square wave square? If it's not, you get an offset on the integrator and it walks off to one side of the power supply.

For the moment (I don't want that many headaches!) I'm using a Schmidtt oscilator set up for variable frequency.  Perfect sides to the square and I'm using a large coupling cap to the next stage to avoid distortion.  The triangle is beautiful.  I shall be hooking this up to a guitar eventually.  I'll probably use a comparitor/Schmidtt after the squaring up.  I've done this with an octave pedal I designed last year and I got pretty good results over the whole fingerboard, except the first couple of frets on the six string.

QuoteSecond, the steadily decreasing amplitude messes up any possible sine shaping. You'll have to restore it to constant amplitude to get even passable sine shaping at the end of things.

The integrator on the output it doing a great job for the sine conversion, it's just that offsets seem to mess things up as the amplitude decreases.  I'll experiment with sending thru a fixed amplitude signal at varying frequency and see if this improves matters, if so then I can compand the signal thru this stage.

I'm wondering if the dynamic resistance of the diodes is entering into all this? I'll have to do some experimenting here too.

QuoteOne thing you could do is to use a CD4046 phase lock loop to lock to the incoming square wave, then drive a divider in the feedback loop of the PLL to get a high frequency locked to the input. With this, you can feed a shift register and flat out generate a sine wave directly from the PLL output. With a divide by 16 PLL and a 16 stage shift register, you can generate a sine directly with resistors that is a pure sine with distortion products starting only at the 15th and 17th harmonics, 31st and 33rd, etc. and amplitudes down in the mud. The "in lock" signal from the 4046 phase pulses let you mute the output unless the chip is locked. Of course, if you leave it unmuted, it will follow the input and catch it audibly. If you use an underdamped loop, it will overshoot and ring around the target frequency as it locks.

OK, I'm with you on the phase locked loop, but know nothing of shift registers.  I had thought of using a PLL to double up the square then integrating, as this would cut out the rectifier.  I'm a little worried about tracking though.  Although I haven't put it into practice I should think that the approach I'm using (with suitable filtering) will be better in this respect.

I'm going to have to do some homework on shift registers!  :)

Thanks for your input, plenty of food for thought!
Title: Precision rectifier blues
Post by: gez on June 18, 2004, 03:41:33 AM
Quotegez: read somewhere it takes high slewrate opamps for your circuit,
due to rapid charging/discharging the diode`s capacitances.
source also says: use low drop diodes.

That's useful to know, I'll swap in some different amps as the CMOS ones are abysmal in this respect.  I'm using Ge diodes, they tend to have better linearity (or so I've read).

QuoteIf you have access to the Horowitz/Hill "Art of Electronics", there`s another nice circuit (next to "yours"), in the chapter "feedback and operational amplifiers".

Will look into it next time I go to the local library.  :)

QuoteAnd, BTW.: the FWR circuits I know, have the diodes the other way round than in your circuit! give it a try, and flip `em]

I've used them both ways round in other circuits, doesn't seem to matter - all depends on which way I want the wave to go - but I'll give it a try (anythings worth a go!) as it doesn't matter in this case whether the wave is +ve going or -ve going  :)
Title: Precision rectifier blues
Post by: puretube on June 18, 2004, 05:45:50 AM
maybe try this (after having turned around the diodes):
use all 1% resistors (I suppose you already did so...),
make that 47k+100k-trimpot a fixed 100k (=exact half value
of the 2nd opamp`s resistors),
and hook one of the opamp`s Vref not to exactly Ub/2, but adjustable by trimpot +/- 10%, to compensate for any offset.

:idea:
Title: Precision rectifier blues
Post by: gez on June 18, 2004, 06:52:47 AM
Quoteuse all 1% resistors (I suppose you already did so...),

Yup!  :)

Quotemake that 47k+100k-trimpot a fixed 100k (=exact half value
of the 2nd opamp`s resistors),

I did this to begin with but there was a difference in amplitude between the two peaks so thats why I lowered the input resistor and incorporated a trimpot.  Don't quite see how reversing the diodes will help matters, but I'll give it a try.

Quoteand hook one of the opamp`s Vref not to exactly Ub/2, but adjustable by trimpot +/- 10%, to compensate for any offset.

Yeah, I should think I need to incorporate offset resistors.  Was going to use fixed resistors, but trimpot is a good idea.  Thanks!

Won't have time to do anything today, but will experiment on the weekend.
Title: Precision rectifier blues
Post by: puretube on June 18, 2004, 01:42:23 PM
http://www.play-hookey.com/analog/full-wave_rectifier.html
this features "your" diode orientation, but the impedances in the 2 branches are different.
Furthermore the values are 10x smaller: this maybe taken into account with "your" values, when thinking about offset;
Maybe for this reason too, you should put resistors from the non-inverting inputs to Vref, instead of direct connections.

heads up, you`ll get there!
Title: Precision rectifier blues
Post by: Boofhead on June 19, 2004, 01:42:25 AM
Reversing the diodes will reverse the polarity of the output.  It way or may not speed things up depending on the specfic opamp.

Some ways to speed it up are:

- use Schottky diodes
- use faster opamps

Someone already mentioned putting a filter cap on the second opamp.  This can help too.  If you have a filter following the rectifier you will be better off transferring this to the feedback network of the second opamp.

If you are dealing with small input signals then DC offsets can affect the circuit.  The best solution here is to simple amplify the signal before the rectifier then drop the DC down (if necessary).
Title: Precision rectifier blues
Post by: gez on June 19, 2004, 07:07:50 AM
PT, the next time you’re in London I owe you a beer, this works beautifully!

(http://hometown.aol.co.uk/Gezpaton/FWR2.GIF)

There was a slight offset, and it was enough to be causing the problem.  The offset seems to be a result of a mismatch between devices within this individual chip and nothing to do with the bias networks.  As I said earlier, the chip I’m using is CMOS and has miniscule input bias (leakage) current (2fA!!!) which is why I don’t usually bother with offset resistors.  It’s also the reason why I used resistors 10X larger than you’d normally see for this circuit, it means I can get away with a smaller input cap and save some space on a PCB.

I tried offset resistors from +ve input to Vbias and it didn’t even make a dent in the bias, even with resistance in to the Meg range!  So, I tried PT’s trim idea and it works like a charm - square in, sine out at double the frequency (whole circuit that is, not just the bit shown Paul)  :)

I still have a load of work to do before I get anything resembling a working circuit (for guitar), but I’ve got past the first hurdle.

Huge thanks go out also to RG and everyone else who replied….also to the director…makeup artist…oh, and not to forget the lighting man…but... above all (blub)….my MOM AND DAD!  (led off the stage to the sound of embarrassed applause)
Title: Precision rectifier blues
Post by: puretube on June 19, 2004, 08:26:16 AM
CHEERS!
8)
you alternatively could also quote Michael Jackson (double pitched):
"I love you all"   :D