A phaser with PWM, should it distort as it does?

Started by bioroids, August 10, 2007, 09:34:03 AM

Previous topic - Next topic

bioroids

Hi everybody!

I'm trying to design a PWM phaser, using an AVR chip as the PWM generator.

It is very similar to the ASMOP phaser http://geofex.com/Article_Folders/ASMOP/asmopphase.gif , but I dropped the CD4049 and run everything from the 5v supply.

The PWM is running at about 40Khz (I suppose, don't have a scope to check), and the switches are the good old 4066.

The thing is, it sounds too distorted. I've heard the PWM approach was good for low distortion (seen that Elektor phaser with 16 stages and supposedly low THD). The most distortion seems to appear near the 50% dutty cycle. I'm not using attenuation on the input signal, and I am pretty sure the distortion is happening because of the switched resistor.

I tried several combinations of parallel and series resistance along with each switch, but things do not change (well, the notches in the phased sound change accordingly, but the distortion does not go away).

The thing is, is this normal expected behaviour and I should be attenuating the signal. Or is it distorting because of bad design/breadboarding techincs/Elvis ghost influence?  ???

ANY help or advice will be greatly appreciated!!

Thanks ahead

Miguel
Eramos tan pobres!

Mark Hammer

Steve Giles is likely to be the expert on this since he has tended to explore the various MXR and Eventide PWM designs more than many of us.  What has never been made clear to me is exactly what the range of variation in duty cycle is on these things.  We know they do their thing by varying duty-cycle, but are we talking a shift from 60% to 80%?  20% through to 80%?  To what extent is the 50% part of the range commonly used?

R.G.

I'm not sure why you're getting distortion. No, it should not be there. I'm pretty sure it's a secondary issue.

However, running effects from 5V is kind of asking for distortion.

You might try this - reprogram so you can set the PWM duty cycle from an external pot manually; that is, the AVR reads the pot and converts the pot reading into 0-100% duty cycle. Then feed this into  your phaser and measure the DC voltage on the opamp outputs as you vary the PWM duty cycle. I'm thinking that there is an artifact somewhere in there that is moving your DC bias point around.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

bioroids

Mmm interesting question Mark. I'm trying to use the full 1% to 99% range but never occurred to me that maybe the usual cd4066 pwm stuff that is known to work uses a more restricted range.

RG: while I plan to do some shifting to up the audio Vcc to at least 7v, when I don't run the PWM control signal, the distortion goes way.

I already implemented a switch on the AVR that lets me toggle between 8 preselected PWM duty cycles without LFOing, so I can run it steady at 0x01, 0x03, 0x07, 0x15, 0x31, 0x63, 0x127 and 0x254. The opamp outputs are staying at Vcc/2 in each case, so the DC moving doesn't seem to be the problem  :icon_confused:

But now I know it shouldn't distort, I know I'm doing something wrong.

I could limit the PWM between 0x01 and 0x63, which anyway concentrate the bulk of the resistance variation, and never get close to the 50% dutty cycle and thus avoiding the distortion. The downside, the PWM will have a 6-bit resolution instead of 8, but that is better that having your signal distorting!

Thanks a lot for your help!

Miguel
Eramos tan pobres!

bioroids

SOLVED!

It was the *&^%$#@% opamp that behaved in strange ways when the variable resistance was in certain positions. A new TL072 made the distortion dissapear. Sounds pretty good, even using only 2 stages. I think the notches may be are pretty deep.

Now I'll try to run the audio part at 9v. I need some interfacing between the 0-5v control signal and the 0-9v signal expected by the 4066, but I'm trying to avoid adding another chip (4049). I'm hopping I can get away with a simple transistor!

Thanks a lot for your help!

Miguel
Eramos tan pobres!

Paul Perry (Frostwave)

It should be possible to use a 555 timer as a PWM generator, but I didn't have any luck when I tried it years ago. Looking back, I think my trouble was stray noise, making a total hash around the narrow end of the scale. A micro certainly makes more sense!

StephenGiles

Hi Miguel, I was going to say check the opamps and that solved the problem!
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

gez

Quote from: Paul Perry (Frostwave) on August 10, 2007, 09:35:42 PM
It should be possible to use a 555 timer as a PWM generator, but I didn't have any luck when I tried it years ago. Looking back, I think my trouble was stray noise, making a total hash around the narrow end of the scale. A micro certainly makes more sense!

There's a project in one of Penfold's books (thanks for directing me to that one Phil) that uses a 555 as a class-D amp.  The control pin is used to do the modulating.  I managed to drive headphones with it (I think I reworked the circuit with a 556 for bridge operation...or 'stereo').  Obviously, it's not as linear as a 'proper' PWM setup, but there was no discernable distortion of the signal (there was in practice).

The project inspired me to experiment more with class D amps and I developed a love/hate relationship with them.  What impressed me about them is that as well as being efficient they're incredibly quiet (the 555 design included), but the downside is the dreadful sounding distortion if driven too hard and the filtering required before the speaker: you go to all that trouble to design an efficient amp, then fall at the last hurdle by dropping voltage across the inductor/cap combo.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

bioroids

I'm very happy with the way this design is going.  :icon_biggrin:

I was able to get rid of the 5v headroom limitation, now the thing runs at 9v. The level shifting for the PWM signal is done by a left over opamp, and I added a speed indicator led too! Total IC count is 4, the ATTiny13, CD4066 and two TL074 quad opamps. Well, also the 78L05 voltage regulator for the AVR!

The thing does not distort audibly (that I can hear at least) and doesn't hiss either. There is some sligth whine at around 8Khz, probably because the PWM is not fast enough (according to calculations it runs at about 40Khz, that's the fastest I can do without an external clock for the AVR). The whine is only audible when recording direct without an amp.

A schemo should come soon, but meanwhile here are some quick sound samples!
http://www.bioroids.com.ar/sounds/bioroids_asteroide1.mp3

Hey Gez a few months ago I was interested in class D amps, but could not get anything done about that. It is still on my to-do list though!

Regards

Miguel
Eramos tan pobres!

rmo

You could always go for the ATtiny25 automotive chip, it has an internal 8mhz osc. and a fast pwm mode. I don't know much about the fast pwm mode, but at the very least the 8mhz oscillator will get you a faster pwm rate.

http://www.atmel.com/dyn/products/product_card.asp?part_id=3912

StephenGiles

"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

gez

"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

calculating_infinity


slacker


bioroids

I'm glad you like it guys.  :icon_cool: :icon_biggrin:

I finally was able to remove the whine. It turns out it wasn't produced by the effect itself, but happened because my computer puts out a very high frequency whine near 20Khz (and probably some higher than that, I suspect), and thanks to the aliasing it appeared at the output at around 8.6Khz. I'm using the computer as a white noise generator for testing and also as spectrum analyzer. Anyway I introduced a simple low pass at around 17Khz (I don't think it affects the audio in a discernible manner), just in case the phaser gets used with instruments other than the guitar.

I'm planning to introduce Tap Tempo and some other goodies to this, I just hope I don't run out of program memory! (52% used so far :icon_eek:)

Regards!

Miguel
Eramos tan pobres!

StephenGiles

"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

R.G.

Tap tempo may not be all that for things that have an LFO that runs all the time. It's not because the tap tempo doesn't work, it's because you can't tap it perfectly accurately. If your tapping doesn't match the song tempo exactly, the LFO and song tempo wander out of phase.

For echo it's great because each echo is self-timed - it starts when the sound comes in and the repeats happen very close to the beat you tapped. A little error in tempo doesn't have a chance to get out of hand.

My impression is that tap tempo isn't all that useful for swoosh-swoosh effects like tremolo, phasers, chorus, etc.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

StephenGiles

But it might impress las senoritas de Chile though :icon_biggrin:
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

oskar

Quote from: StephenGiles on August 13, 2007, 11:56:37 AM
But it might impress las senoritas de Chile though :icon_biggrin:
You mean like DIY-groupies...  :P
I'm still waiting for this new world order to come true.

alex frias

Pagan and happy!