Feature

Fancy Frame

Animated LED Matrix Photo Frame

"Fuzzy" Mannerz

Issue 37, August 2020

This article includes additional downloadable resources.
Please log in to access.

Log in

A small video game themed ornament with an ATtiny85 and an 8x8 LED matrix.

A video of this small photo frame with an integrated LED matrix captured our attention as we scrolled through our Instagram feed recently. The engaging video showed animations reminiscent of classic video games such as Pac-Man, Pong, Tetris, Snake, and Space Invaders. It’s quite mesmerising to watch.

We just had to find out more about this cool looking project, so we caught up with Fuzzy and how he built it.

Tell us a little about yourself and what got you into electronics and coding.

The name’s Fuzzy Mannerz (obviously not my birth name - but I’ve had this name since my school days and kept it for when I produced video content and creative projects.)

Originally from the UK, I moved to Sweden in 2014. I gained an interest in electronics after having purchased a Raspberry Pi during my university years to use as a video game emulation system. I remember really enjoying the putting together of the case and soldering on a fan and a power and reset switch. It left me wanting more and I eventually discovered the glorious world of Arduino. I used to design a lot of websites when I was younger so I was familiar with HTML, CSS, JavaScript and PHP. I then progressed into programming the Arduino.

When I moved to Sweden I had a lot of time whilst getting settled and taught myself more about electronics and various programming languages by watching YouTube videos, reading books, reading datasheets for various interesting chips, and putting together various projects on breadboards after having purchased a load of stuff on eBay.

I studied film production at university and have always enjoyed video creation so I created the “FuzzyTek” YouTube channel to mix my interest in electronics with video and put it out there for others to (hopefully) enjoy.

We notice several projects on your YouTube channel that look very interesting. What inspired you to make your animated LED matrix display?

Usually I see a project box before I see a project. So there I am walking around a local second hand store with my fiancée when this little black shadow box caught my eye on a nearby shelf, I just knew it would be good for an electronics project but I didn’t yet know what exactly. I purchased it and it sat on my desk for a few months before I realised that the little LED Matrix I purchased earlier in the year might just fit nice inside it and shine out of the glass front. I had also just built a bookshelf for above the desk and needed something to put on it and fill a gap so decided to see what I could come up with.

As it was an 8x8 LED matrix I already had in the parts drawer I thought video games was a fitting subject as I could use simple animations and images from early video games as they would translate well to a simple small grid.

It’s always great to see makers repurposing or hacking regular household items into something “techy”. How does your display work?

It is powered by an 18650 cell which runs an ATtiny85 that is connected to an LED matrix (which itself is a MAX7219 chip) and displays video game related images at a set interval forever until either the battery runs out or I switch it off.

The animation images themselves are stored in the ATtiny’s EEPROM and are cycled on a loop. When it’s powered off it looks like a little mirror due to the glass having mirror film on it.

In terms of the code it loads the images from a byte array stored in the EEPROM of the ATtiny85 and then displays them with a set delay between each frame and just keeps looping around the array.

The bytes in the array come from a very handy online tool, the aptly named “LED Matrix Editor” which I used to design the patterns and animations.

You can access this software on GitHub: https://github.com/xantorohara/led-matrix-editor

Those ATtiny microcontrollers are perfect for projects like these to keep things compact and low power. It looks like most of the parts are commonly available so our readers could make one for themselves?

It does indeed! Apart from the specific shadow box I’d say the parts are very easy to source and very common. It’s literally just an ATtiny85, a MAX7219 8x8 LED matrix, an 18650 cell holder, a simple on/off switch, a few wires and the 18650 cell itself. Well and a bit of prototype board, a piece of glass and some mirror film if you want to get pedantic.

Where did you source the mirror film?

The mirror film came from eBay a few years back. I don’t remember why I bought it initially but it’s come in handy for a couple of projects so far!

It looks like art supplies and hardware stores also sell sheets of mirror film. Have you used the ATtiny before and what made you choose it for the display?

Until this point I’d only used one to create a PlayStation 1 mod chip (“PSNee”) but not a project of my own. I had a few ATtiny’s sitting in my parts drawer for when an ATMega was a bit too overkill, and as the LED matrix only requires 3 pins to connect to the IC I thought it was a perfect project for it. That and it literally is tiny so it would fit great in the little shadow box!

Great! Are there any tricks to using an ATtiny in a project?

You can of course program an ATtiny using Microchip’s MPLAB or some other IDE and programmer but for me the easiest way was the already familiar Arduino IDE. By default the ATtiny variant chips aren’t in the Arduino IDE board list but you can add them and program them by using another Arduino as the programmer. I flashed the “ArduinoISP” example sketch to my Uno and then plugged the ATtiny85 into a breadboard and then into the Uno and flashed it that way.

Also, the ATtiny doesn’t have much memory so in order to store the images onto it, I stored them in the built in EEPROM and retrieved and saved them in a buffer when needed, otherwise it would use over 284% of the ATtiny’s memory and obviously wouldn’t be able to be programmed.

Yes, many ways to program the ATtiny. We published a Programming & Development Shield for exactly this purpose. Tell us a little about your battery choice and how you charge it.

The reason I used an 18650 cell is because - again, I had a few in the parts drawer that I salvaged from an old laptop battery. The cells also output around 4 volts which is just fine for the ATtiny and the LED matrix to run from. I calculated that it would run the project for approximately 100 hours continuously on a full charge. I haven’t tested the calculation however, it’s just an estimate.

To charge the cell isn’t anything fancy. I have a little USB charger that I stick it on and let it charge.

Perhaps another project will be building the little charger board into a box of its own with a cellholder some day – it just crudely sits on my desk at the moment when I use it.

Repurposing an old laptop battery cell is a great idea. We assume the project could also run directly from USB?

I could have wired on a USB port instead of the battery as everything is rated to work at 5V but I had the batteries just laying around collecting dust so thought I may as well use one. As the ATtiny doesn’t have USB on it like an Uno or Arduino Nano I couldn’t have powered it that way either so it had to be either some sort of wall plug adapter or battery power.

Did you have any other build challenges you needed to overcome?

There weren’t too many challenges as it’s quite a simple project but one of them was finding a way to mount the cell holder and power switch to the shadow box. In the end I used hot glue. Not the best of options in most circumstances but you can’t see it when it’s on the shelf as it’s on the back side and it did the job!

I also had an issue with the code where the animations would be mirrored horizontally (so whatever was meant to be on the right was on the left and vice versa). It was really frustrating but I found someone else with a similar issue online along with an answer to their problem containing a simple function to flip/reverse the bytes in the images which seemed to fix it for me too.

It is always great to see the maker community sharing how they solved build issues. If you were to start the project again, what would you do differently?

I would probably plan a bit more and try to find a better power switch and perhaps a better sized battery to power it and fit with the box size. I’d like to be able to close the back and have nothing on the exterior. Especially not hot glue! I’m also not a fan of waiting for things to arrive (read: “a bit impatient”) so I usually just use what I’ve got laying around if I can even if it’s not always the best result at the end but that’s part of the fun of DIY right?

Yes, completely agree. So many makers have parts laying about that they should reach for first. For any of our readers wanting to make a display for themselves, where can they get more details and the code?

For more details on the display you can view the FuzzyTek episode about it on YouTube: “FuzzyTek E11 // 8x8 LED Matrix Video Game Animation Display”. The code is linked in the description and I’ll answer any questions about it in the comments.

Awesome! Any exciting projects you are working on now?

I’m always doing something! At the moment I am working on getting my Nixie clock project finished onto PCBs and in some sort of case or box, as well as writing a few more FuzzyTek episodes. Besides the electronics I’m also developing some video games and doing some voice acting for various projects so it’s a very fun time indeed!

Good to see you are keeping busy and combining your electronics knowledge and videography skills. If you had any advice for our readers who are getting into electronics, what would it be?

I really hope that the simplicity of this project shows you can make something cool without having to have it be too complicated. I don’t claim to know everything about electronics and programming, even some of the absolute basics I have to always search online and remind myself. Start small, figure out how to blink an LED and then just continue from there.

Learn to read and understand the relevant information in datasheets and don’t be scared to jump in with code! It looks confusing at first but the more you do it the more you’ll pick up little bits along the way and build a knowledge base. If you copy and paste some code from somewhere be sure you read through and understand how it works before just saving it and getting on with things.

Oh, and if you can, buy loads of cool looking modules on eBay or wherever and make something cool with them! There are so many resources and options for learning and building things out there so dive right in!

Some sound advice right there Fuzzy! Thank you for sharing your project with us.

We hope you have enjoyed this feature and have inspired you to build one for yourself. Be sure to tag us on your favourite social media platform (@diyodemag) so we can see what you have made.

The Build:

Parts Required:JaycarAltronicsCore Electronics
1 × ATtiny85ZZ8721Z5105COM-09378
1 × 8-Pin IC SocketPI6456P0530PRT-07937
1 × 8x8 LED Array ModuleXC4499Z6362CE05175
1 × 18650 Battery^SB2299S4734CE04624
1 × 18650 Battery HolderPH9205S5039PRT-12899
1 × Slide SwitchSS0852S2010PRT-14330
1 × Li-ion Charger^XC4502Z6388DFR0208

Parts Required:

You’ll also need a breadboard and prototyping hardware.

^ For safety reasons, make sure that the charging module and 18650 battery you are using are compatible.

Fuzzy has kindly provided the parts list, wiring digram and code to be able to make one of these projects for yourself.

We show you how to make one on a breadboard, which you can then adapt to your choice of circuit board for a permanent application.

If you have never programmed an ATtiny85 before, we show you how this can be done using an Arduino Uno board in our ATDEV For ATtiny project from Issue 14.

The video that Fuzzy has on his website also guides you through the build.

#include <LedControl.h>
#include "images.h"
const int DIN = 0;
const int CS =  1;
const int CLK = 2;
LedControl display=LedControl(DIN, CLK, CS, 1);
byte buffer[8];
const int IMAGES_LEN = sizeof(IMAGES) / 8 - 1;
unsigned long previousMillis = 0;
const long interval = 150;
void setup() {
  display.clearDisplay(0);
  display.shutdown(0, false);
  display.setIntensity(0, 15);
}
// Flips the bytes around otherwise image
// is mirrored for some reason
byte flipByte(byte b){
  b = ((b>>1)&0x55)|((b<<1)&0xAA);
  b = ((b>>2)&0x33)|((b<<2)&0xCC);
  b = (b>>4) | (b<<4);
  return b;
}
void displayImage() {
  for (int i = 0; i < 8; i++) {
    byte row = (flipByte(buffer[i]));
    for (int j = 0; j < 8; j++) {
    display.setLed(0, i, j, bitRead(row, j));
    }
  }
}
int i = 0;
void loop() {  
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    memcpy_P(buffer, IMAGES[i] + 8, 8);
    displayImage();
  
    if (i++ >= IMAGES_LEN ) {
    i = 0;
    display.clearDisplay(0);
    }
  }
}