News:

SMF for DIYStompboxes.com!

Main Menu

TINY26 rocks! (PWM Phasing)

Started by free electron, December 14, 2005, 06:08:22 AM

Previous topic - Next topic

free electron

About 2 weeks ago I decided to have some fun with phase shifting circuits, so the first shot was an OTA based phaser,always wanted to try this one,  not a Ross Clone, but 4 OTA phase shift stages (13700) + classic triangle LFO, hypertiangular converter, a lot of biasing. It sounded good, but was very noisy, not acceptable for me, even with linearizing diodes and increasing the s/n ratio. Then I thought: hey! It is time to try PWM.
The first attempt was nothing revolutionary, too, ramp generator, hypertriangulated-LFO, 393 as a comparator, PWM at ~32kHz driving four 4066 switches. Unfortunately, 393  is to slow to keep the sharp edges of the PWM signal. Reducing the collector resistor (at the output of the comparator) helps a bit, but increases the current consumption. We need a low output impedance PWM source to drive 4066 switches in order to keep the edges sharp and low distortion, especially at small durations. I think that's the main reason of bad sounding of the 4066 switches clocked at high frequency, which I saw reported here. Anyway, the prototype was working, quite nice (sample). But! I had a box prepared for old version with OTAs, which had an additional knob labelled Color (Iabc control). I was in need to figure out some kind of mod to the present circuit and name it Color. I had an Atmel ATTINY26 uC lying around. 2kb of flash, 128b of RAM,  A/D converter, and internal PLL running at 64MHz, giving two pure 250kHz  8bit PWM channels. After some days of programming I managed to put my LFO/PWM section into that chip. And something more, the results are:
- 0.3-15Hz of hypertriangular wave, controls: Rate , Depth. The Rate control (linear pot->A/D) was very non linear with my DDS routine, so I decided to virtually change the pot characteristic to get the most pleasant rate control
- TTL outs of Tiny26 are capable of direct driving the 9V powered CMOS logic (works perfectly), so I have pure square, not rounded by the capacitances of the additional driving stages
- The Color knob - I used one PWM channel to control the first pair of phase shifters, and the second channel to control the second pair. The Color knob works as phase "distance" regulator between the both PWM channels, giving in fact a variable distance between notches in the audio signal.
- The phaser itself is a 4 stage opamp based one with feedback regulator routed to second stage.
- Next step in near future - tap tempo, but with use of bigger uC, now I have 200bytes of flash left in the tiny26,just enough for sin table for vibrato mode.
This is the prototype:

And here's the sound sample of the ATTINY26 ver. At this time it works at ~ 120kHz, and is very quiet. The old LFO (3 opamps, bunch of resistors, caps, one fet, diodes, trannies, comparator,and a lot of biasing) have been just reduced to small SOIC20 chip with some external components :) Both PWM channels on Tiny26 have normal and inverted outputs, so I can use inverted outs for blinking LED indicators. Cool!:)
The PWM Phasing needs some filtering to cut out the clock, simply adding some pF parallel to the feedback resistors in phase shifters helps a lot.
Many thanks to R.G. and Transmogrifox for inspiring work on PWM in stompbox related stuff :)
I'll try to record a sample of the "notch distance" control
Regards!
Piotr

Processaurus

Wow

that sample of your microchip version is really nice sounding.  The sweep is very musical.  Listening to the sample again I can hear you changing
stuff around, theres some univibeness in there, but a whole lot more, too.  Really inspirational work, digital control of analog circuits is a great future for musical electronics.

As Walter Sobchak would say "Not exactly a lightweight, dude" 

stm

#2
Congratulations!

Your work is inspiring.  A true illustration that *digital* is not necessarily bad or undesirable.  Just put the digital domain where it outperforms analog, and keep analog for what's best in analog form--take the best of both worlds.

I had a not-so-good experience many years ago with a CD4066 and a four-stage phase shifter. It worked, but it was noisy. Careful studying of the datasheet revealed one of the causes of the problem: clock feedthrough. The datasheet indicates as much as 100mV of clock signal can appear at the switch's output. Even being high frequency it disturbs the opamp because it cannot follow these glitches fast enough, thus introducing some sort of oscillations which sound as noise.  The other major problem I encountered was the speed of the comparator. I used the same LM393 and it was too slow. I got better results with the LF311 comparator, which was also available in the local market.

The greatest beauty of the analog switch approach is that you don't need to match photoresistors or JFETS or other devices. It is very cheap and  simple to build a phaser with an obscene number of stages! :icon_twisted:

Processaurus

Since you're planning a tap tempo, a nice feature (which I haven't seen implimented well in commercial products) would be a division algorithm, for slow sweeps, example: the phaser sweeps once for the time it took you to tap 8 times, or once every two measures if you're playing in four, and tapping every beat, as would be the natural thing to do while performing .

Good luck with your business, you certainly have the skills.  Interestingly, having a custom programmed microchip that is copy protected controlling an aspect of a circuit can solve the problem  FX makers have of getting analog designs knocked off, without resorting to gooping products in epoxy and getting royally pissed when people realize 95% of it is a TS clone. ;D  Anyway, thanks for sharing your prototype process and solutions to problems with us.

RDV

The 1st sample seems warmer. Quite nice. I love that dreamy sort of floating sound.

RDV

free electron

Thanks a lot guys!

@ Processaurus:
I was just changing the pickup settings in the second sample, it is one mono track with a touch of reverb added. The first sample was recorded as two separate tracks spread in the pan. Maybe that's why RDV likes that one better:)
Regarding the tap tempo. The time scaling is exactly what I'm thinkin about! I mean.. You'd have to be a kind of terminator to tap the 10Hz ;) So, I'm planning to make:
- an averaging procedure for the following time intervals, 3 or 4 values will be put in the table and the mean value will control the main LFO generator.
- 4 position Time Scale switch, /4, /2, 1, x2, x4 which will give a good control over the whole LFO range I think..
The main reason I started to make devices with uCs was that stm is writing about - to take the best from both, analog and digital worlds. That was always my motto, so I don't hesitate to mix the tubes and microprocessors if it gives me a new opportunities. A higher level of  copy protection  is a natural succesion.
@ stm
I must say, that, after plugging the new version with that double LFO (notch distance) to the tube amp, at normal playing volumes, I encountered a noise problem. Bad idea. Which is caused of course by interferring two fast PWM signals, close to each other. Yesterday I was testing the circuit only with headphones. With four stages clocked from the same pwm out the noise is kept at the acceptable level. I'm thinking about taking the output from two phase stages (or even more), mix them and use as source for simple envelope detector, which will control FET based noise gate placed at the end of the phase shifting chain . This will keep the noise shut down during the lack of audio signal.
I decided to change the function of the Color knob and make it work as lowpass filter in the phase shift chain, just before the mixer. It will be more usable than a empty hole in the box ;)
Regards!
Piotr

petemoore

   That's alot of 'tangential' work !! [I haven't seen similar applications as such]
  And the phaseing sounds great !!
  Thanks for sharing, I don't know what "PWM" is...so my comprehension is lacking a bit here and there...
Convention creates following, following creates convention.

Doug_H


RDV

Quote from: petemoore on December 14, 2005, 09:24:25 AM
     Thanks for sharing, I don't know what "PWM" is...so my comprehension is lacking a bit here and there...
Pulse Width Modulation

RDV

GFR

Quote from: RDV on December 14, 2005, 01:32:05 PM
Quote from: petemoore on December 14, 2005, 09:24:25 AM
     Thanks for sharing, I don't know what "PWM" is...so my comprehension is lacking a bit here and there...
Pulse Width Modulation

RDV

That is, if you switch a signal ON 100% of the time, the average is 100% of that signal. If it's ON 50% of the time and OFF for the other 50%, the average is 50% of the signal. If it's OFF 100% of the time the average is zero. Now, if you switch ON/OFF at a VERY high frequency, you only hear the "average" - using a low pass filter to average the switched signal helps. Then you can modulate a signal by controling how much % of the time the signal is ON.