Main Content

10 or 12-bit DAC from the ATtiny85

This article describes how to get up to two 10 or 12-bit digital-to-analogue outputs from an 8-bit Timer/Counter, such as in the ATtiny85. To test the routine I built a circuit which allows you to vary the brightness of two LEDs with two potentiometers. The ATtiny85 provides two 8-bit Timer/Counters, so the digital-to-analogue PWM output it can produce is only 8-bit resolution. Sometimes, though, 8 bits isn’t enough. For example, using an 8-bit DAC to vary the brightness of an LED will give noticable steps in brightness at the lower brightness levels. And, using it to create a variable voltage output gives you steps of about 0.02V, which may not be fine enough for a variable power supply. One solution is to choose a processor with a 16-bit Timer/Counter, such as the ATtiny84. However, you may already be comitted to using the ATtiny85, or like me, like to use the smallest possible processor for any application, so I decided to try and get a 10 or 12-bit analogue output from the ATtiny85.”

Link to article