PT2399 Strum Tempo

Started by mfunky, October 17, 2015, 04:53:56 PM

Previous topic - Next topic

mfunky

Hi,

I am building a daughter board for PT2399-based delays. It is build based on an arduino chip and has some extra (and some less) features compared to the great taptation solution:


  • For example, it has a "calibration" mode, that measures the delay times with each digital pot setting, so the delay will work absolutely precise with ANY MCP41100 (these come with +/-30% tolerance, so I thought that this was a nice feature).
  • Furthermore, it has a "strum tempo" mode inspired by the T.C. Electronics Flashback Delays - great for strumming in fast tempos, which you cannot tap with your feet.
  • it works with
  • It works with a roatry encoder for tempo up/down for (fine)tuning a tapped or strummed tempo
  • It works with a roatry encoder for subdivision for 1/4, 1/8, triads, dotted 8th,...

It is still on a breadboard and the code pieces for the functions above still need to be put together (they work, though). The only issue I am having: I'd like to add a modulation option and have a triangel wave coming out of one of the PWM pins of the arduino for that. This one controls a resistance to ground for the digital pot (via a transistor). Unfortunately, when I use this feature (which works as well), I have a slight "hiss" added to my audio signal as well; alternating current on a pin of the arduino seems to induce noise to the rest of the circuit - any ideas, how I could fix this?

samhay

Sounds like some nice new features.

What frequency is the PWM output running at?
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

mfunky

The schematic is the same like in the taptation documentation on page 2: http://www.thetonegod.com/tech/datasheets/taptation_pt2399.pdf

The PWM is running in sync with the delay frequency: i.e. for 120 BPM, it runs takes of 500 ms for a full cycle (0.2 V up to 4.8 V and back to 0.2 V), so that is 2 Hz. Way below audible...

I assume, that it comes from the way the pulse is generated (by PWM), because it even occurs, when nothing is connected to that pin (pin 7 in the taptation layout). So, I think that the on/off pulses (in the frequency they are created by the ATMEGA) cause the interference.

Too bad, the modulation is actually quite nice.

ElectricDruid

Quote from: mfunky on October 18, 2015, 03:19:57 AM
The schematic is the same like in the taptation documentation on page 2: http://www.thetonegod.com/tech/datasheets/taptation_pt2399.pdf

The PWM is running in sync with the delay frequency: i.e. for 120 BPM, it runs takes of 500 ms for a full cycle (0.2 V up to 4.8 V and back to 0.2 V), so that is 2 Hz. Way below audible...

I assume, that it comes from the way the pulse is generated (by PWM), because it even occurs, when nothing is connected to that pin (pin 7 in the taptation layout). So, I think that the on/off pulses (in the frequency they are created by the ATMEGA) cause the interference.

Too bad, the modulation is actually quite nice.

You're right: Samhey was asking about what frequency the ATMEGA's PWM output is, not what frequency the modulation is running at. That PWM clock frequency will bleed through unless filtered, or turn up as noise if ultrasonic.

For a PWM output, you've got to filter the PWM frequency heavily to remove it if you're going to listen to the result. Since a modulation LFO runs at a very low frequency compared to the PWM output frequency, this isn't too hard to do. I've even had reasonable success with 3-stage passive filtering, although I've mostly used 4-stage active filters - but 2-stage active filters are reasonable too. For the passive filter, choose an RC lowpass combination that gives you a cutoff frequency that won't affect your LFO - keep R small and C big. Then repeat it twice more, multiplying R by ten and dividing C by ten for each stage. There's an example on page 6 in my LoopEnv datasheet ("The simplest possible PWM filter), which uses a PWM output like yours (mine's PIC not AVR, but PWM is the same thing on both):

http://www.electricdruid.net/datasheets/LOOPENV1Datasheet.pdf

You ought to be able to stick something like this in front of your transistor and you'll be fine.

HTH,
Tom

Cjuried

Tom,

I enjoyed your "Looping Envelope Generator". Have you read this this neat note on increasing the PWM frequency on the AtMega328?

http://withinspecifications.30ohm.com/2014/02/20/Fast-PWM-on-AtMega328/
Chris Juried
Audio Engineering Society (AES) Member 
http://www.juriedengineering.com (Juried Engineering, LLC.)
http://www.tubeequipment.com (Tube Equipment Corporation)
http://www.historyofrecording.com (History of Recording)

ElectricDruid

Quote from: Cjuried on October 18, 2015, 05:39:33 PM
Tom,

I enjoyed your "Looping Envelope Generator". Have you read this this neat note on increasing the PWM frequency on the AtMega328?

http://withinspecifications.30ohm.com/2014/02/20/Fast-PWM-on-AtMega328/

I hadn't read it, but I have now. That's akin to how the PIC PWM module works - there's a comparator that sets when the counter rolls over, so you can have whatever PWM resolution you want, with the resulting trade-off against output frequency.

Tom


mfunky

#6
Thanks, everybody! It is always great to see what knowledge people have on this forum. I learn so much here, fantastic! But I am still curious, why that sound occurs if there is no connection between the arduino PWM pin and the transistor (i.e. - the pin is not connected to anything!). It must be induction than, right? ...and that will be hard to kill :-(, even with a filter network...

ElectricDruid

The noise is probably finding its way into the power rails from the microprocessor. Whilst you can reduce this by running the uP on its own +5V regulator, this doesn't prevent the ground from carrying unwanted noise around. The best-practice in that case is to run separate ground wires back to the power input for the digital and analog portions of the circuit.

Also drop some capacitance near the uP. 100nF and 10uF as close to the pins as you can. It's mostly for magical reasons, but sometimes it works ;)

HTH,
Tom

mfunky

#8
Thanks! Made some progress on this.. I could reduce the noise to some degree (almost acceptable) by moving the MCP (digital potentiometer) further away from the analog parts of the circuit (everything is still on a breadboard).

This being said, acoustic calibration, tempo up/down (rotary encoder) tap tempo and strum tempo are working perfectly and very precise; with just one tap tempo button, you can either tap in the tempo or - by holding it down - strum the tempo on your guitar (which goes much better for higher tempi or subdivisions, e.g. triplets @ 120 bpm). For strum tempo, a relay switches the input to an analog input on the Arduino (signal gets amplified with a small IC before the arduino), thus mutes the signal until the button is released.

The only thing I need to add is a subdivision button, which cycles through dotted 1/4, 1/4 triplets, 1/4, dotted 1/8, 1/8, 1/8 triplets, dotted 1/16, 1/16 triplets, 1/16 (well, maybe not all of them...).

mfunky

Quote from: ElectricDruid on October 18, 2015, 01:59:24 PM
Quote from: mfunky on October 18, 2015, 03:19:57 AM
The schematic is the same like in the taptation documentation on page 2: http://www.thetonegod.com/tech/datasheets/taptation_pt2399.pdf

The PWM is running in sync with the delay frequency: i.e. for 120 BPM, it runs takes of 500 ms for a full cycle (0.2 V up to 4.8 V and back to 0.2 V), so that is 2 Hz. Way below audible...

I assume, that it comes from the way the pulse is generated (by PWM), because it even occurs, when nothing is connected to that pin (pin 7 in the taptation layout). So, I think that the on/off pulses (in the frequency they are created by the ATMEGA) cause the interference.

Too bad, the modulation is actually quite nice.

You're right: Samhey was asking about what frequency the ATMEGA's PWM output is, not what frequency the modulation is running at. That PWM clock frequency will bleed through unless filtered, or turn up as noise if ultrasonic.

For a PWM output, you've got to filter the PWM frequency heavily to remove it if you're going to listen to the result. Since a modulation LFO runs at a very low frequency compared to the PWM output frequency, this isn't too hard to do. I've even had reasonable success with 3-stage passive filtering, although I've mostly used 4-stage active filters - but 2-stage active filters are reasonable too. For the passive filter, choose an RC lowpass combination that gives you a cutoff frequency that won't affect your LFO - keep R small and C big. Then repeat it twice more, multiplying R by ten and dividing C by ten for each stage. There's an example on page 6 in my LoopEnv datasheet ("The simplest possible PWM filter), which uses a PWM output like yours (mine's PIC not AVR, but PWM is the same thing on both):

http://www.electricdruid.net/datasheets/LOOPENV1Datasheet.pdf

You ought to be able to stick something like this in front of your transistor and you'll be fine.

HTH,
Tom

Thanks for pointing out, that I needed to have a look at the PWM frequency - ultimately, I found an issue by increasing the PWM-frequency of the arduino using THIS:

http://playground.arduino.cc/Code/PwmFrequency

Interesting, that the PWM-frequencies are different on the arduino pins. I just needed to add

setPwmFrequency(9, 1);

and the noise was gone.

Thanks again for teaching me!!!