ATtiny13 – random flickering pixels on 8×8 matrix LED display

This example project shows how to make random flickering pixels using ATtiny13 and popular 8×8 matrix LED display based on MAX7219/MAX7221. Complete project code is on GitHub.

MAX7219/MAX7221 library for 8×8 matrix LED display

A lightweight library for 8×8 matrix LED displays based on MAX7219/MAX7221 chip that works with tinyAVR family (ATtiny13, ATtiny25, ATtiny45, ATtiny85) can be found here .

Parts

Circuit Diagram

Firmware

This code is written in C and can be compiled using the avr-gcc. More details on how compile this project is here.

#include <stdint.h>
#include <util/delay.h>
#include "max7219.h"

#define LFSR_SEED 	(213)

static uint16_t
prng_lfsr16(void)
{
        static uint16_t cnt16 = LFSR_SEED;
        return (cnt16 = (cnt16 >> 1) ^ (-(cnt16 & 1) & 0xB400));
}

int
main(void)
{
	uint8_t row, col, i = 0;

	/* setup */
	MAX7219_init();
	MAX7219_set_intensity(8);

	/* loop */
	while (1) {
		row = (prng_lfsr16() + col) % 8;
		col = (prng_lfsr16() + row) % 8;
		MAX7219_set_pixel(row, col, ++i & 0x01);
		_delay_ms(5);
	}
}

6 thoughts on “ATtiny13 – random flickering pixels on 8×8 matrix LED display

  1. Could you edit? Since this is your project and I think it will be very easy for you to change it under 7 matrices.

Leave a Comment