Cjuried
Member
- Joined
- Aug 26, 2015
- Messages
- 13
JohnRoberts said:While I've been making sine waves for a few decades, I only started using micros this century (self taught). My first and second generation drum tuners use PWM to sine wave for note synthesis. The first one using an 8 bit platform used two PWM outputs (one scaled down about 3 bits or so for more resolution) feeding a 2 pole analog LPF and buffer. My second generation tuner on a 16b platform used two similar PWM outputs for the sine wave synthesis. This time not scaled in level but phase flipped so for zero audio input, the two output square waves are opposite polarity and cancel each other out. This trades where the errors are worst case, which for a constant sine wave doesn't buy much benefit. I feed my two PWM outputs into a class D IC with 2 poles of passive filtering. The cheap class D amp provided no external sync capability but the birdies (beats between PWM and class D) were down in the dirt and not problematic.Cjuried said:JohnRoberts said:In case I haven't said this before 120kHz isn't so high that you can't scale up a typical audio signal generator circuit.
Since I've gone over to the dark (digital) side, I wouldn't rule out using a cheap microprocessor. You could use the PWM output and a lookup table to make a sine wave, for a little more you can get a dsp processor with a 16B stereo DAC built in. I coded up a sine wave generator that makes multiple sine waves simultaneously (albeit not at 120kHz). But a very clean 120khz sine wave is not heavy lifting.
Easy is a triangle wave with a tracking LPF or perhaps A diode break to convert triangle to sine wave, but not crazy to make an actual sine wave using modern fast op amps.
JR
Hi John,
A common practice I use with my ATMEGA168P-PU AVR series MCU's, to yield the results you note ,are as follows in this short paper: http://web.csulb.edu/~hill/ee470/Lab%202d%20-%20Sine_Wave_Generator.pdf
Of course these days with DACs built into the micros you can just output an arbitrarily pure sine wave using a look-up table.
JR
PS: Of course I wasn't first to do this, and I saw the opposite PWM polarity trick used inside some class D amps.
I visited your website and like to concept behind your drum tuner. Very cool device!
Have you ever experimented with a slew of LM567CN's for frequency detection? It would be interesting as the center frequency is adjustable from .01Hz to 500kHz with a stable precision oscillator. I would gather it might be a more expensive route to go, however.
http://www.ti.com/lit/ds/symlink/lm567c.pdf