Skip to content

(Updated ) 6 min read Homelab Web Dev

Building a Real-Time Digital Graffiti Wall with MongoDB Realm and RGB LEDs

Blog How I built a real-time digital graffiti wall - a shared drawing canvas that shows up live on an RGB LED grid, synced with MongoDB Realm.

Corrections
  • : I said the display was WS2812B LED strips wired in a serpentine pattern and run by a microcontroller. It was a 32x32 HUB75 panel run by a Raspberry Pi with the rpi-rgb-led-matrix library.
  • : The TL;DR said Realm synced pixels between clients in real time. Realm stored them; every client polled the grid every 5 seconds.
  • : cell.id.split(' ') passed the coordinates on as strings. It now maps them to numbers.

MongoDB ended support for the Realm Web SDK (later Atlas Device SDK) on September 30, 2025, so the sync code here shows how the wall worked, not code you can run today.

TL;DR The Digital Graffiti Wall is an interactive art installation where audiences draw on a shared 32x32 pixel canvas in their browsers, and their artwork appears in real-time on a physical RGB LED grid. MongoDB Realm stored the pixels, with anonymous auth and atomic updates, and every client polled the grid every 5 seconds.

On this page
  1. The Concept
  2. Architecture
  3. The Drawing Interface
  4. Real-Time Sync with MongoDB Realm
  5. The Physical Display
  6. Database Seeding
  7. Design Decisions
  8. Running It at Events
  9. What I Learned

The Digital Graffiti Wall is an interactive art installation I built that lets multiple people draw simultaneously on a shared canvas - and then displays their collaborative artwork on a physical RGB LED grid, live.

The idea came from wanting to make audience interaction with speakers at tech events more collaborative and visual. (If you like physical computing projects, check out my IoT Kitty Litter Box too.) Instead of just typing questions in a chat, what if everyone in the room could paint on a shared wall together?

The Concept

The setup is straightforward: attendees open a URL on their phones or laptops, pick a color, and start drawing on a 32x32 pixel grid. Every stroke syncs to every other connected client and to a physical RGB LED matrix mounted on stage. It’s collaborative pixel art, but tangible.

The constraints shaped the design:

  • 32x32 pixels - matches common addressable LED matrix sizes
  • 8 colors - simple enough for quick interaction, limited enough for visual coherence
  • No accounts - anonymous access means zero friction at an event
  • Touch support - most users would be on phones

Architecture

BROWSER canvas UI: 32×32 div grid, pointer events, optimistic updates MONGODB ATLAS 1,024 pixel documents, { color, coord: { x, y } } LED CONTROLLER a microcontroller reads pixel state and drives the WS2812B matrix MongoDB Realm SDK, anonymous auth reads pixel state
BROWSER canvas UI: 32×32 div grid, pointer events, optimistic updates MONGODB ATLAS 1,024 pixel documents, { color, coord: { x, y } } LED CONTROLLER a microcontroller reads pixel state and drives the WS2812B matrix MongoDB Realm SDK, anonymous auth reads pixel state

Each of the 1,024 pixels is stored as a document in MongoDB:

{
  _id: ObjectId,
  color: "rgb(255,0,0)",
  coord: { x: 15, y: 20 }
}

Each pixel is a flat document, so it can be updated on its own, atomically.

The Drawing Interface

The canvas is built from plain HTML divs - no Canvas API, no WebGL. Each of the 1,024 cells is a 20x20 pixel <div> with a unique ID encoding its coordinates.

Drawing uses pointer events for cross-platform support (mouse, touch, stylus):

clickGrid(event) {
    this.fillOnHover = true;
    const cell = event.target;
    cell.style.backgroundColor = this.currentColor;

    const [x, y] = cell.id.split(' ').map(Number);
    this.mongo.updateOnePixel([x, y], this.currentColor);
}

When you click or tap a cell, two things happen simultaneously:

  1. The cell changes color instantly (optimistic update)
  2. The database write fires asynchronously

This means the UI feels instant even though the database round-trip takes a few hundred milliseconds. If you drag your finger or mouse, pointerover events continue painting cells as long as the button is held down.

Real-Time Sync with MongoDB Realm

MongoDB Realm (later Atlas Device SDK, since shut down) did most of the work. Users authenticate anonymously - no sign-up, no passwords:

const app = new Realm.App({ id: CONFIG.appID });
const credentials = Realm.Credentials.anonymous();
await app.logIn(credentials);

Note: The Realm Web SDK became the Atlas Device SDK, and MongoDB deprecated it in September 2024 and shut it down on September 30, 2025. To build this today you’d need another real-time layer, like a small server that watches a MongoDB change stream and pushes pixels over WebSockets.

Every 5 seconds, each client polls for the current grid state:

async getCurrPixelGrid() {
    return await this.collection.aggregate([
        { $match: {} },
        { $sort: { "coord.y": 1, "coord.x": 1 } }
    ]);
}

The aggregation pipeline returns all 1,024 pixels sorted in display order (top-to-bottom, left-to-right), which maps directly to the DOM structure. The refresh loop walks through the sorted results and updates each cell’s background color.

Individual pixel writes use findOneAndUpdate for atomic updates:

async updateOnePixel(cellID, color) {
    await this.collection.findOneAndUpdate(
        { "coord.x": cellID[0], "coord.y": cellID[1] },
        { $set: { color } }
    );
}

If two people paint the same pixel at the same time, last-write-wins. At a 32x32 resolution with 8 colors, that’s totally fine - the collaborative chaos is part of the fun.

The Physical Display

A square LED panel glowing in a green-to-purple gradient, propped on a desk in front of a monitor showing a terminal, with red and black wires running to it.
The 32x32 panel on my desk while I wired it up, Nov 2020.

The 32x32 grid size isn’t arbitrary - it’s the size of a standard HUB75 RGB LED panel. A Raspberry Pi drives the panel through an Adafruit RGB Matrix HAT with the rpi-rgb-led-matrix library, reading pixel state from the same MongoDB collection.

The data flow is simple: browser writes pixel to database, LED controller reads pixel from database, physical LED updates. The 5-second polling interval means there’s a slight delay between drawing and physical display, but at an event with 50+ people drawing simultaneously, the wall is constantly changing anyway.

Database Seeding

On first load, the app checks whether the collection has exactly 1,024 documents. If not, it seeds a fresh grid:

async seedDB() {
    const count = await this.collection.count();
    if (count !== 1024) {
        await this.collection.deleteMany({});

        const pixels = [];
        for (let y = 0; y < 32; y++) {
            for (let x = 0; x < 32; x++) {
                pixels.push({
                    color: "rgb(255,255,255)",
                    coord: { x, y }
                });
            }
        }
        await this.collection.insertMany(pixels);
    }
}

A “Clear” button resets all pixels to white using a bulk update. This is useful at events when you want to give the audience a fresh canvas.

Design Decisions

1 Change streams allow applications to access real-time data changes without the prior complexity and risk of manually tailing the oplog.MongoDB's manual

Polling vs. real-time subscriptions. I went with 5-second polling instead of MongoDB change streams1. It’s simpler, and a 5-second delay doesn’t matter for collaborative pixel art.

1 Change streams allow applications to access real-time data changes without the prior complexity and risk of manually tailing the oplog.MongoDB's manual

Divs vs. Canvas API. Individual divs are less performant than a Canvas element, but they’re easier to make interactive. Each cell gets its own click handler, hover state, and color. For 1,024 elements, the performance is perfectly fine.

Anonymous authentication. At an event, you don’t want people creating accounts to participate. MongoDB Realm’s anonymous auth means anyone with the URL can draw immediately. The trade-off is no per-user history or moderation, but for a fun collaborative installation, that’s the right call.

8-color palette. Limiting colors keeps the collaborative output visually coherent. When 50 people are drawing at once, a 16-million color picker would produce visual noise. Eight distinct, saturated colors create recognizable patterns and pixel art.

Running It at Events

The setup is minimal: point a projector at the LED grid (or just let people watch the physical display), share a URL or QR code, and let people draw. The NES.css styling gives it a retro 8-bit aesthetic that matches the pixel art constraints.

The best moments are when the audience self-organizes - someone starts drawing a recognizable shape and others join in, or competing groups try to “claim” corners of the grid.

What I Learned

MongoDB as a pixel buffer works surprisingly well. 1,024 documents with simple reads and writes is well within MongoDB’s comfort zone, and the aggregation pipeline handles the sorting/querying cleanly.

Optimistic updates. Nobody wants to click a pixel and wait 200ms for it to change color. Update locally first, sync to the database in the background.

Physical computing amplifies digital experiences. The web canvas alone is fun. Seeing your pixels appear on a physical LED grid is exciting.

The source code is on GitHub if you want to run your own at an event. All you need is a MongoDB Atlas account, a replacement for Realm (see the note above), and a dream.

The LED panel half of this project still lives on the shelf next to my desk. In 2026 I rebuilt it as PixelPane, an open source pixel art frame that Home Assistant drivesOct 12, 2026I built a 32x32 pixel art frame that shows what my house is doing.

Works on My Machine

Get the next post by email. My newsletter covers homelab builds, AI tools and open source, and it goes out when I have something to say.

It’s free, and you can unsubscribe anytime. You’ll get an email to confirm first.

If you liked this post, consider sharing it on Hacker News, Bluesky, LinkedIn, or X.

Joe Karlsson at his desk, chin on hand, with a microphone in front of him

Joe Karlsson

Technology is better when it's weird and it's yours. Everything I write about runs in my house.

More about me →

BlueskyLinkedInGitHub