Main Content

ATtiny1614 Function Generator

A tiny function generator built using the ATtiny1614 microprocessor and its internal Digital-To-Analog Convertor (DAC).

The ATtiny1614 processor
The ATtiny1614 is part of the new breed of ATtiny microprocessors. One of its features is a built-in Digital-to-Analog Convertor or DAC. This project started out as an experiment in finding what the limitations were in generating sine waves using the internal DAC.

The concept is simple, fill up a table of voltage levels for various points on a sine wave and repeatedly play them back via the DAC.

Consider storing 256 points for one complete cycle of a waveform. To output this waveform at 1Hz, you need to output the 256 points in one second. So the clock speed necessary to do this is 256Hz. At 10Hz, clock speed needs to be 2560Hz and at 10kHz clock speed needs to be 2.56MHz. Note this means the “loop” that outputs the points must be able to read the value from the lookup table and send it to the DAC in 1/2,560,000 or 0.39uS. So the speed of the processor will determine what the maximum frequency is.

One of the ways to increase speed is to output say every second point in the lookup table. This in-effect doubles the speed but results in a less than perfect output. I use this method to allow the oscillator to run at much higher speeds than the processor can deliver but the quality of the output suffers accordingly.

Building a simple oscillator module
Because the ATtiny1614 processor only comes in SMD packages, I decided to use mostly SMD packages on the oscillator PCB. The user interface is a 5-digit 7-segment display module driven by a MAX7219 LED driver and a rotary encoder. The board also contains a Schmitt Trigger for each rotary encoder contact as well as its push switch. This will de-bounce the mechanical contacts.”

Link to article