Tag Archives: micrcontrollers

How far can you take the ATtiny10?

Atmel’s stalwart tinyAVR lineup has been a Maker favorite for years, with the microcontrollers powering a wide-range of devices and platforms.


Recently, a Maker by the name of Tim (aka cpldcpu) decided to find out just how far he could take the versatile ATtiny10 with his µ-Wire project.

“I previously used the ATtiny10 in the TinyTouchbutton, a touchbutton controlled light with WS2812 LEDs. This time I aimed higher: Is it possible to turn the ATtiny10 into a USB compatible device?” Tim wrote in a recent blog post.

“My goal was to implement a subset of the little-wire functionality to control a WS2812 LED by USB. This takes 3 I/O lines, which is exactly the number of free pins on the ATtiny10.”

As Tim notes, little-wire supports a number of functions to control WS2812 LEDs on arbitrary I/O ports. However, he simplified this approach by only supporting a single LED on a specific pin, while still retaining protocol compatibility. Meaning, all the little-wire host programs were still functional, with the finished device fully capable of being used as an RGB indicator LED similar to the Blink1.

“The V-USB USB interface requires more than 1.5kb of flash in its smallest implementation and uses more than 50 bytes of RAM, including stack usage,” he explained. 

”Additional code is required to implement the little-wire interface and to write to the WS2812. The ATtiny10 has 1kb of flash, 32 bytes of SRAM and 16 instead of 32 registers. So this ended up as a nice exercise in cutting down V-USB to its bare essentials – and further.”

One critical step towards reducing the memory footprint, Tim admits, was adopting an interrupt-free implementation of V-USB, as developed for micronucleus. This allowed him to lower the SRAM footprint by omitting register saving on the stack and avoiding double buffering — all while facilitating the reduction of program size.

Further measures to reduce code size include clocking the controller at 12 MHz (using the internal RC oscillator), manually remapping numerous registers in V-USB to avoid collisions with the GCC, removing all handling of the reset signal on the USB-Bus and altering the code to support replies from the SRAM.

Final stats?


Flash: 988 of 1024 bytes used (96.4%)
  • SRAM: 28 (variables)+2 (stack) of 32 bytes used (93.8%)

“This is most likely the most complex firmware ever loaded into an ATtiny10,” Tim added. “[Plus], it also works with the new 8mm WS2812 LEDs.”

Interested in learning more? You can check out the relevant files on Github, as well as read Tim’s detailed blog post here.