Main Content

8-bit ATtiny85 Circle Of Life

Why use a giant computer running MicroPython or CircuitPython when you could use something much less powerful than an IBM PC, Commodore, or Apple II.

Requirements
An ATtiny85 microcontroller. An ATtiny45 can fit, so it’d probably work.
Some way to flash your program into it.
An apa102 aka DotStar LED disc such as Adafruit’s lovely DotStar disc.
A 5V DC multi-amp power supply (a USB-C 5V 3A brick works for me). You’ll need a more amps if you choose to turn the brightness up to 11 (or if a coding bug sets all of the LEDs to full on full brightness).
Do not stare into LEDs with remaining eye. An opaque diffusion layer helps.

Implementation notes
I don’t have any form of debugging setup. So I wrote the code blind and expanded upon my test pattern code run during setup() to visually debug the results. LED disc as console for printf debugging anyone?

I used my old MicroPython code as a guide for the implementation. During the development process I made several mistakes before I had anything resembling working:

I left myself a // TODO: set initial state that I forgot about and wondered why the display remained blank.
I stayed up until 2am.
I mixed up left and right shift when it came to getting bits in and out of a byte.
I stayed up until 2am again.
I accessed ram looking for constant data instead of progmem via pgm_read_byte(). Harvard architecture. Couldn’t that be abstracted via a C++ class?
I used sizeof on a pointer and ignored the compiler warning.
I memorized which color alligator clip when onto which Gemma pad, Arduino pin, and LED disc connector pin and moved them around countless times instead of building myself a harness.
I won’t stay up until 2am again for this project. ;)”

Link to article