Electronic – Program an ATtiny13 as an audio oscillator with variable frequency and pulse-width

audioavr

I want to create a simple square wave oscillator similar to what one would do with a 555, but I want to use interrupt based PWM support to control pulse width and frequency.

I have been studying the datasheet, AVR APIs and whatever PWM examples I can find, but I haven't quite been able to put it all together.

Is it possible to create such an oscillator with the built in AVR PWM functionality and, if so, how? I friend of mine did something similar with an 8 pin PIC.

My reasoning is that I will get interesting sounds by changing the pulse-width and therefore the wave form at a given frequency. Similar to how the Atari Punk Console works but hopefully in a more stable way, i.e. changing the pulse width, but leaving the frequency constant or vise versa.

Best Answer

These should get you pretty far and the rest you can do with the datasheet. Start building piece by piece, from blinky to waveform to waveform that changes over time to tones. Some source might help with filtering and driving audio outputs (active LPF might do both neatly).

I suggest coming back with more specific questions.