Projects / Pixel-art frame

Pixel-art frame

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 8 done
  1. NANO11.6 mA

    Wire power

    Matrix 5V and GND to the Nano, capacitor across them.

  2. NANO

    Wire the data

    D6 through 330 ohm to DIN.

  3. NANO

    Wire the button

    D2 to GND.

  4. NANO

    Install the library

    Adafruit NeoPixel.

  5. NANO

    Upload

    A red heart appears.

  6. NANO

    Press the button

    Smiley, tree, then back to heart.

  7. NANO11.7 mA

    Fix the order

    Set SERPENTINE false if the picture is scrambled.

  8. NANO

    Draw your own

    Add a new picture of eight rows.

In short

How do you build a pixel-art frame?

An 8 by 8 colour matrix shows small pixel pictures you draw, with a button for the next picture and a brightness cap for safety. You need Arduino Nano, WS2812B 8x8 RGB LED matrix, Electrolytic Capacitor 100 µF, Resistor 330 Ω, Tactile push button 6 mm, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points. It takes 8 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Matrix 5VNano 5VPower
Matrix GNDNano GNDCommon ground
100 uF capacitorMatrix 5V and GND, long leg to 5VSmooths switching current
Nano D6330 ohm resistor to matrix DINData line
ButtonNano D2 to GNDNext picture

Code

A WS2812B matrix holds a tiny controller in every pixel, so the whole panel needs a single data wire and the Adafruit NeoPixel library does the timing. A picture here is eight short text rows, one letter per colour and a dot for a dark pixel, which makes it easy to draw new pictures in the code itself. The only catch is the order of the pixels: many 8 by 8 panels run the first row left to right and the next row right to left, which is called serpentine wiring. The pixelIndex function handles that, and you can set SERPENTINE to false if your panel is wired in a plain order. Power is the real safety point. Each pixel can draw about 60 milliamps at full white, so all 64 could need nearly 4 amps, far more than a USB port allows. The sketch caps brightness at 16 out of 255 and uses mostly single colours, which keeps the current to a few hundred milliamps. The 100 microfarad capacitor across the supply and the 330 ohm resistor in the data line protect the first pixel from switching spikes. Raise the brightness slowly and only with a proper 5 volt supply rated for the extra current.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel strip(64, 6, NEO_GRB + NEO_KHZ800);
const int BTN = 2;
const bool SERPENTINE = true;               // set false if the picture looks scrambled
const uint8_t BRIGHT = 16;                  // keep low, full brightness would draw too much for USB

// Rows are drawn top to bottom. R red, G green, Y yellow, B blue, dot = off.
const char* PICS[3][8] = {
  {".RR..RR.", "RRRRRRRR", "RRRRRRRR", "RRRRRRRR", ".RRRRRR.", "..RRRR..", "...RR...", "........"},   // heart
  {"..YYYY..", ".YYYYYY.", "YY.YY.YY", "YYYYYYYY", "Y.YYYY.Y", "YY....YY", ".YYYYYY.", "..YYYY.."},   // smiley
  {"...GG...", "..GGGG..", ".GGGGGG.", "GGGGGGGG", "..GGGG..", ".GGGGGG.", "...YY...", "...YY..."}    // tree
};
int pic = 0;
bool wasDown = false;

uint32_t colourOf(char c) {
  switch (c) {
    case 'R': return strip.Color(255, 0, 0);
    case 'G': return strip.Color(0, 200, 0);
    case 'Y': return strip.Color(255, 160, 0);
    case 'B': return strip.Color(0, 0, 255);
    default:  return 0;
  }
}

int pixelIndex(int x, int y) {
  if (SERPENTINE && (y & 1)) return y * 8 + (7 - x);   // odd rows run right to left
  return y * 8 + x;
}

void draw(int p) {
  strip.clear();
  for (int y = 0; y < 8; y++)
    for (int x = 0; x < 8; x++)
      strip.setPixelColor(pixelIndex(x, y), colourOf(PICS[p][y][x]));
  strip.show();
}

void setup() {
  pinMode(BTN, INPUT_PULLUP);
  strip.begin();
  strip.setBrightness(BRIGHT);
  draw(pic);
}

void loop() {
  bool down = (digitalRead(BTN) == LOW);
  if (down && !wasDown) { pic = (pic + 1) % 3; draw(pic); delay(30); }
  wasDown = down;
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Power onHeart in red at low brightness
Button pressNext picture each time
Third pressReturns to the heart
Panel feelsBarely warm
Picture orderRows not mirrored or scrambled

If it does not work

Nothing lights

Check you are on DIN, not DOUT, and the 5V and GND.

Picture scrambled

Toggle SERPENTINE.

Wrong colours

Change NEO_GRB to NEO_RGB.

First pixel flickers

Check the 330 ohm resistor and capacitor.

Nano resets when bright

Lower BRIGHT or use a separate 5V supply.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the pixel-art frame?

Arduino Nano, WS2812B 8x8 RGB LED matrix, Electrolytic Capacitor 100 µF, Resistor 330 Ω, Tactile push button 6 mm, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points.

How long does the pixel-art frame take to build?

About 90 minutes for a beginner maker, in 8 steps.

How do I know the pixel-art frame works?

Power on: Heart in red at low brightness. Button press: Next picture each time. Third press: Returns to the heart.

Nothing lights: what should I check?

Check you are on DIN, not DOUT, and the 5V and GND.

Picture scrambled: what should I check?

Toggle SERPENTINE.

Wrong colours: what should I check?

Change NEO_GRB to NEO_RGB.

First pixel flickers: what should I check?

Check the 330 ohm resistor and capacitor.