OLED Animation Maker OLED Maker
🇮🇳 Independence Day · ESP8266

Independence Day OLED Animation 2026, ESP8266 + SSD1306

Every 15 August people ask me the same thing: can a tiny 0.96" SSD1306 OLED show something that feels like a real Independence Day celebration, not just static text? Yes, it can, and I'll show you how...

By Ashish Aug 15, 2026 ~14 min ESP8266, SSD1306, India
🇮🇳

Full 15 August show

You get a flag wave, Ashoka Chakra, rocket, fireworks and Jai Hind.

⚡

ESP8266 ready

It's vector GFX, so it fits your NodeMCU / Wemos flash without huge bitmaps.

🔌

Wiring included

You'll find the SSD1306 I2C pins for NodeMCU and Wemos D1 Mini.

✨

Browser preview

Try Templates → Fun → Independence Show 2026 on the maker.

Pixel art of two happy kids high-fiving beside a flag with a wheel emblem, for the post Independence Day OLED Animation 2026, ESP8266 + SSD1306

Every 15 August people ask me the same thing: can a tiny 0.96" SSD1306 OLED show something that feels like a real Independence Day celebration, not just static text? Yes, it can. I'll show you a complete Independence Day OLED animation for ESP8266 (NodeMCU / Wemos D1 Mini). It covers the year count from 1947 → 2026, a spinning Ashoka Chakra, rocket launch, fireworks, flag hoisting with science icons, a waving tricolour, Jai Hind, confetti and Vande Mataram.

OLED Animation Maker import tab for images, GIFs and video with threshold and dithering options

The full sketch is indipendanceday.ino. It's vector GFX (lines, circles, particles), not huge PROGMEM bitmaps, so it fits comfortably in your ESP8266's flash and RAM. You can also preview a browser version in the free OLED Animation Maker under Templates → Fun → Independence Show 2026 (preview only).

What the show plays (scene list)

The main sequencer is independenceShow(). Each scene is its own function, so you can reorder, shorten or skip parts if you're running a classroom demo:

void independenceShow() {
  yearCount();          // 1947 → 2026
  yearsOfFreedom();     // counts up to 80th Independence Day
  introAugust();        // spinning chakra + "15 AUGUST" / "2026"
  rocketLaunch();       // rocket + exhaust particles
  fireworkExplosion();  // radial burst
  flagHosting();       // pole rise + climb + science icons + birds
  flagWave();           // waving Indian flag
  jaiHind();            // spinning chakra + "JAI HIND"
  confetti();           // particles + "HAPPY INDEPENDENCE DAY"
  vandeMataram();       // type-on salute
  showBranding();       // OLED Animation Maker credit
}

After the show, loop() puts up a home screen with the flag and VANDE MATARAM. It waits a few seconds, then it's back to the start.

Parts list

  • ESP8266, NodeMCU 1.0 or Wemos D1 Mini (I'd pick one of these)
  • 0.96" SSD1306 I2C OLED, 128×64. Yours will usually answer at 0x3C
  • 4 Dupont wires for you to connect (VCC, GND, SDA, SCL)
  • A USB cable, plus Arduino IDE with the ESP8266 board package installed

Why not an Uno? You'll find that particle systems and lots of floating-point waves need more RAM and CPU than it's got. An ESP8266 handles them easily, and you'll find ESP32 works too if you change the I2C pins (often SDA=21, SCL=22).

Wiring (NodeMCU / Wemos D1 Mini)

Use 3.3V for the OLED on ESP8266. Don't carry the 5V habit from Uno tutorials over to VCC on these boards, unless your module's explicitly 5V-tolerant and level-shifted.

OLED pinESP8266GPIO
VCC3.3V:
GNDGND:
SDAD2GPIO4
SCLD1GPIO5
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET   -1
#define OLED_ADDR    0x3C

#define SDA_PIN 4   // D2
#define SCL_PIN 5   // D1

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(115200);
  Wire.begin(SDA_PIN, SCL_PIN);
  if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR)) {
    Serial.println("OLED NOT FOUND!");
    while (1);
  }
  randomSeed(analogRead(A0));
  display.clearDisplay();
  display.display();
}

If your screen stays blank, try address 0x3D, check the 3.3V power, and make sure SDA/SCL aren't swapped. See also OLED blank screen fixes.

Libraries

  1. In Arduino IDE, go to Tools → Manage Libraries
  2. Install Adafruit SSD1306 there
  3. Install Adafruit GFX Library too
  4. Pick your board: NodeMCU 1.0 (ESP-12E Module) or LOLIN(Wemos) D1 R2 & mini

Prefer U8g2? It's covered in U8g2 vs Adafruit for animations, so have a look there. I wrote this sketch for the Adafruit GFX APIs (drawLine, drawCircle, fillRect, text).

How the Indian flag is drawn on a mono OLED

The SSD1306 is monochrome, so you won't get saffron or green. The sketch fakes the tricolour with density patterns: a filled top band, an empty middle band with the Ashoka Chakra, and a filled bottom band. The waving version offsets each column with sin(), which is what makes the cloth move:

float wave = sin(i * 0.25 + frame * 0.32) * 2.8;
int y = topY + wave;
// draw top & bottom stripes on even columns; chakra in the white band

During flagHosting(), the pole grows and the flag climbs. Side icons cycle through an ISRO rocket, atom, satellite, chip, lightning, network and lab flask, a nod to India's science story. Small bird shapes rise in the sky too.

Rocket, fireworks & confetti (particles)

Two particle pools drive the show, and you can tune both:

  • Rocket exhaust, up to 28 particles spawn behind the rocket as it flies up
  • Confetti, up to 45 particles explode then fall under gravity for HAPPY / INDEPENDENCE / DAY

The firework burst is simpler: concentric radial lines from the top center. Stars are fixed pixels for the night sky. Everything's drawn each frame with GFX instead of stored bitmaps. You can tweak delays and radii without regenerating byte arrays, and I like that.

Text scenes that stay readable

I use a helper, printCentered(), with getTextBounds(), so labels like 15 AUGUST, JAI HIND and VANDE MATARAM stay centered on 128×64. The year counter steps from 1947 to 2026, and yearsOfFreedom() counts to the 80th Independence Day. I'd keep text size 1 for long phrases. Size 2 is fine for short years like 2026.

Upload & run

  1. Open indipendanceday.ino in your Arduino IDE
  2. Select your ESP8266 board and COM port, then check you've got the right one
  3. Click Upload and wait until it finishes, since it's flashing your board
  4. Watch Serial at 115200. If you see OLED NOT FOUND!, fix your wiring or address
  5. You'll see the full Independence Day show start on its own, and it loops

You'll find the full copy-paste sketch below (jump to full code). Or download it from GitHub: github.com/WitbloxAshish · Preview in browser: oledanimationmaker.com (Templates → Fun → Independence Show 2026).

Customize for your event

  • Shorter demo: comment out scenes inside independenceShow()
  • Faster pace: cut the delay() values in each scene, though you won't gain as much as you'd expect
  • Bigger flag: change FLAG_W / FLAG_H, but keep it within 128×64
  • ESP32: set SDA_PIN/SCL_PIN to 21/22, or whatever your board defaults to
  • Classroom branding: edit the strings in showBranding()
Generated Arduino code window in OLED Animation Maker with Adafruit SSD1306 includes and PROGMEM frames

Preview vs export

The maker site includes an Independence Show 2026 template marked preview only. You can watch it on the virtual OLED, but you can't export code for that template. The project you can actually deploy is this Adafruit sketch. It's procedural animation, not frame-by-frame bitmaps. For your own bitmap animations and GIF imports, use the normal templates and Get the Code on oledanimationmaker.com.

Troubleshooting

  • Blank screen, so check the 3.3V power and I2C pins, try 0x3D, and run an I2C scanner
  • Garbled graphics, which means your display size is wrong. This sketch assumes 128×64, so you'll need to change it if yours isn't
  • Slow / stutter, which is usually a USB power brownout. Don't power your board from a weak port, so use a solid 5V supply
  • Compile errors on math, so keep #include <math.h> for sin/cos
  • Random looks fixed, randomSeed(analogRead(A0)) needs a floating A0. If it isn't floating, you'll see similar-looking particles on every boot

Full sketch (copy-paste), indipendanceday.ino

Here's the complete ESP8266 + Adafruit SSD1306 Independence Day show. Copy everything into a new Arduino sketch named indipendanceday.ino, install Adafruit GFX + Adafruit SSD1306, select NodeMCU / Wemos D1 Mini, and upload.

⬇ Download from GitHub

/*
  Independence Day OLED Animation 2026
  ESP8266 + 0.96" SSD1306 OLED

  Made with OLED Animation Maker
  https://www.oledanimationmaker.com/
  Instagram : https://www.instagram.com/oled_animator
  GitHub    : https://github.com/WitbloxAshish

  Wiring:
    VCC -> 3.3V
    GND -> GND
    SDA -> D2 (GPIO4)
    SCL -> D1 (GPIO5)
*/

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <math.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET   -1
#define OLED_ADDR    0x3C

// NodeMCU / Wemos D1 Mini I2C
#define SDA_PIN 4   // D2
#define SCL_PIN 5   // D1

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


// =====================================================
// FLAG
// =====================================================
#define FLAG_W 58
#define FLAG_H 30


// =====================================================
// CONFETTI
// =====================================================
#define MAX_PARTICLES 45

struct Particle {
  float x;
  float y;
  float vx;
  float vy;
  bool active;
};

Particle particles[MAX_PARTICLES];


// =====================================================
// ROCKET SIDE PARTICLES
// =====================================================
#define ROCKET_PARTICLES 28

struct RocketParticle {
  float x;
  float y;
  float vx;
  float vy;
  bool active;
};

RocketParticle rocketParticles[ROCKET_PARTICLES];


// =====================================================
// SETUP
// =====================================================
void setup() {

  Serial.begin(115200);

  Wire.begin(SDA_PIN, SCL_PIN);

  if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR)) {

    Serial.println("OLED NOT FOUND!");

    while (1);
  }

  randomSeed(analogRead(A0));

  display.clearDisplay();
  display.display();
}


// =====================================================
// LOOP  — auto-start, then repeat
// =====================================================
void loop() {

  independenceShow();

  showHome();

  delay(4000);
}


// =====================================================
// HOME SCREEN
// =====================================================
void showHome() {

  display.clearDisplay();

  drawHomeFlag(35, 5, 58, 34);

  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);

  const char *text = "VANDE MATARAM";

  int16_t x1, y1;
  uint16_t w, h;

  display.getTextBounds(
    text,
    0,
    0,
    &x1,
    &y1,
    &w,
    &h
  );

  int centerX = (128 - w) / 2;

  display.setCursor(centerX, 50);

  display.print(text);

  display.display();
}


// =====================================================
// HOME FLAG
// =====================================================
void drawHomeFlag(
  int x,
  int y,
  int w,
  int h
) {

  int stripe = h / 3;

  display.drawRect(
    x,
    y,
    w,
    h,
    SSD1306_WHITE
  );

  display.fillRect(
    x + 1,
    y + 1,
    w - 2,
    stripe - 1,
    SSD1306_WHITE
  );

  display.fillRect(
    x + 1,
    y + stripe,
    w - 2,
    stripe,
    SSD1306_BLACK
  );

  display.fillRect(
    x + 1,
    y + stripe * 2,
    w - 2,
    h - stripe * 2 - 1,
    SSD1306_WHITE
  );

  int cx = x + w / 2;
  int cy = y + stripe + stripe / 2;

  display.drawCircle(
    cx,
    cy,
    7,
    SSD1306_WHITE
  );

  display.drawCircle(
    cx,
    cy,
    2,
    SSD1306_WHITE
  );

  for (int i = 0; i < 24; i++) {

    float angle =
      i * (2.0 * PI / 24.0);

    int x2 =
      cx + cos(angle) * 7;

    int y2 =
      cy + sin(angle) * 7;

    display.drawLine(
      cx,
      cy,
      x2,
      y2,
      SSD1306_WHITE
    );
  }
}


// =====================================================
// MAIN SHOW
// =====================================================
void independenceShow() {

  // 1. 1947 → 2026
  yearCount();

  // 2. 80th Independence Day
  yearsOfFreedom();

  // 3. 15 August 2026
  introAugust();

  // 4. Rocket
  rocketLaunch();

  // 5. Firework
  fireworkExplosion();

  // 6. Flag hosting
  flagHosting();

  // 7. Flag wave
  flagWave();

  // 8. Jai Hind
  jaiHind();

  // 9. Confetti + HAPPY INDEPENDENCE DAY
  confetti();

  // 10. Vande Mataram last
  vandeMataram();

  // 11. Branding
  showBranding();
}


// =====================================================
// YEAR COUNT
// =====================================================
void yearCount() {

  for (
    int year = 1947;
    year <= 2026;
    year += 4
  ) {

    display.clearDisplay();

    display.setTextColor(SSD1306_WHITE);
    display.setTextSize(2);

    char yearText[5];

    sprintf(
      yearText,
      "%d",
      year
    );

    int16_t x1, y1;
    uint16_t w, h;

    display.getTextBounds(
      yearText,
      0,
      0,
      &x1,
      &y1,
      &w,
      &h
    );

    display.setCursor(
      (SCREEN_WIDTH - w) / 2,
      (SCREEN_HEIGHT - h) / 2
    );

    display.print(yearText);

    display.display();

    delay(18);
  }

  display.clearDisplay();

  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(2);

  display.setCursor(43, 24);

  display.print("2026");

  display.display();

  delay(300);
}


// =====================================================
// CENTERED TEXT
// =====================================================
void printCentered(
  const char *text,
  int y,
  int size
) {

  display.setTextSize(size);
  display.setTextColor(SSD1306_WHITE);

  int16_t x1, y1;
  uint16_t w, h;

  display.getTextBounds(
    text,
    0,
    0,
    &x1,
    &y1,
    &w,
    &h
  );

  display.setCursor(
    (SCREEN_WIDTH - w) / 2,
    y
  );

  display.print(text);
}


// =====================================================
// SPINNING ASHOKA CHAKRA
// =====================================================
void drawSpinningChakra(
  int cx,
  int cy,
  int r,
  int frame
) {

  display.drawCircle(
    cx,
    cy,
    r,
    SSD1306_WHITE
  );

  display.drawCircle(
    cx,
    cy,
    2,
    SSD1306_WHITE
  );

  float spin =
    frame * 0.18;

  for (
    int i = 0;
    i < 24;
    i++
  ) {

    float angle =
      i * (2.0 * PI / 24.0) +
      spin;

    int x2 =
      cx + cos(angle) * r;

    int y2 =
      cy + sin(angle) * r;

    display.drawLine(
      cx,
      cy,
      x2,
      y2,
      SSD1306_WHITE
    );
  }
}


// =====================================================
// 15 AUGUST 2026 INTRO
// =====================================================
void introAugust() {

  for (
    int frame = 0;
    frame < 72;
    frame++
  ) {

    display.clearDisplay();

    drawStars();

    drawSpinningChakra(
      64,
      18,
      10,
      frame
    );

    if (frame > 10) {

      printCentered(
        "15 AUGUST",
        36,
        1
      );
    }

    if (frame > 26) {

      printCentered(
        "2026",
        50,
        1
      );
    }

    display.display();

    delay(40);
  }
}


// =====================================================
// VANDE MATARAM
// =====================================================
void vandeMataram() {

  const char *msg =
    "VANDE MATARAM";

  int len = 13;

  for (
    int n = 1;
    n <= len;
    n++
  ) {

    char buf[16];

    memcpy(buf, msg, n);

    buf[n] = '\0';

    display.clearDisplay();

    drawSpinningChakra(
      64,
      22,
      14,
      n * 4
    );

    printCentered(
      buf,
      48,
      1
    );

    display.display();

    delay(110);
  }

  delay(2500);
}


// =====================================================
// 80th INDEPENDENCE DAY
// =====================================================
void yearsOfFreedom() {

  for (
    int n = 2;
    n <= 80;
    n += 2
  ) {

    display.clearDisplay();

    char num[4];

    sprintf(num, "%d", n);

    printCentered(
      num,
      18,
      2
    );

    printCentered(
      "INDEPENDENCE",
      44,
      1
    );

    display.display();

    delay(28);
  }

  display.clearDisplay();

  printCentered(
    "80th",
    10,
    2
  );

  printCentered(
    "INDEPENDENCE",
    34,
    1
  );

  printCentered(
    "DAY",
    50,
    1
  );

  display.display();

  delay(1400);
}


// =====================================================
// JAI HIND FINALE
// =====================================================
void jaiHind() {

  for (
    int frame = 0;
    frame < 100;
    frame++
  ) {

    display.clearDisplay();

    drawStars();

    drawSpinningChakra(
      64,
      24,
      16,
      frame
    );

    printCentered(
      "JAI HIND",
      50,
      1
    );

    display.display();

    delay(35);
  }
}


// =====================================================
// FLAG HOSTING
// =====================================================
void flagHosting() {

  const int poleX = 64;
  const int groundY = 60;

  const int revealHeight = 22;

  for (
    int poleTop = groundY;
    poleTop >= revealHeight;
    poleTop--
  ) {

    display.clearDisplay();

    // Ground
    display.drawLine(
      40,
      groundY,
      88,
      groundY,
      SSD1306_WHITE
    );

    // Pole
    display.drawLine(
      poleX,
      groundY,
      poleX,
      poleTop,
      SSD1306_WHITE
    );

    int progress =
      groundY - poleTop;

    int scienceFrame =
      (progress / 4) % 7;

    if (scienceFrame == 0) {

      drawISRORocket(22, 36);

    }
    else if (scienceFrame == 1) {

      drawAtom(22, 36);

    }
    else if (scienceFrame == 2) {

      drawSatellite(22, 36);

    }
    else if (scienceFrame == 3) {

      drawComputerChip(22, 36);

    }
    else if (scienceFrame == 4) {

      drawElectricity(22, 36);

    }
    else if (scienceFrame == 5) {

      drawDigitalNetwork(22, 36);

    }
    else {

      drawScience(22, 36);
    }

    display.display();

    delay(28);
  }


  // ===================================================
  // FLAG CLIMB
  // ===================================================

  int startY =
    revealHeight - 2;

  for (
    int flagY = startY;
    flagY >= 7;
    flagY--
  ) {

    display.clearDisplay();

    // Pole
    display.drawLine(
      poleX,
      groundY,
      poleX,
      7,
      SSD1306_WHITE
    );

    // Flag
    drawHostedFlag(
      poleX,
      flagY
    );

    // Birds
    int movement =
      startY - flagY;

    drawRisingBirds(
      movement + 20
    );

    display.display();

    delay(32);
  }
}


// =====================================================
// ISRO ROCKET ICON
// =====================================================
void drawISRORocket(
  int x,
  int y
) {

  display.drawTriangle(
    x,
    y - 9,
    x - 5,
    y,
    x + 5,
    y,
    SSD1306_WHITE
  );

  display.drawRect(
    x - 5,
    y,
    10,
    13,
    SSD1306_WHITE
  );

  display.drawCircle(
    x,
    y + 5,
    2,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 5,
    y + 7,
    x - 10,
    y + 13,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 5,
    y + 7,
    x + 10,
    y + 13,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 2,
    y + 13,
    x,
    y + 18,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 2,
    y + 13,
    x,
    y + 18,
    SSD1306_WHITE
  );
}


// =====================================================
// ATOM
// =====================================================
void drawAtom(
  int x,
  int y
) {

  display.drawCircle(
    x,
    y,
    3,
    SSD1306_WHITE
  );

  for (
    int a = 0;
    a < 360;
    a += 15
  ) {

    float angle =
      a * PI / 180.0;

    int px =
      x + cos(angle) * 12;

    int py =
      y + sin(angle) * 5;

    display.drawPixel(
      px,
      py,
      SSD1306_WHITE
    );
  }

  for (
    int a = 0;
    a < 360;
    a += 15
  ) {

    float angle =
      a * PI / 180.0;

    int px =
      x + cos(angle) * 5;

    int py =
      y + sin(angle) * 12;

    display.drawPixel(
      px,
      py,
      SSD1306_WHITE
    );
  }
}


// =====================================================
// SATELLITE
// =====================================================
void drawSatellite(
  int x,
  int y
) {

  display.drawRect(
    x - 4,
    y - 4,
    8,
    8,
    SSD1306_WHITE
  );

  display.drawRect(
    x - 14,
    y - 3,
    9,
    6,
    SSD1306_WHITE
  );

  display.drawRect(
    x + 5,
    y - 3,
    9,
    6,
    SSD1306_WHITE
  );

  display.drawLine(
    x,
    y - 4,
    x,
    y - 10,
    SSD1306_WHITE
  );

  display.drawPixel(
    x,
    y - 11,
    SSD1306_WHITE
  );
}


// =====================================================
// COMPUTER CHIP
// =====================================================
void drawComputerChip(
  int x,
  int y
) {

  display.drawRect(
    x - 8,
    y - 8,
    16,
    16,
    SSD1306_WHITE
  );

  display.drawRect(
    x - 4,
    y - 4,
    8,
    8,
    SSD1306_WHITE
  );

  for (
    int i = -5;
    i <= 5;
    i += 5
  ) {

    display.drawLine(
      x - 8,
      y + i,
      x - 12,
      y + i,
      SSD1306_WHITE
    );

    display.drawLine(
      x + 8,
      y + i,
      x + 12,
      y + i,
      SSD1306_WHITE
    );

    display.drawLine(
      x + i,
      y - 8,
      x + i,
      y - 12,
      SSD1306_WHITE
    );

    display.drawLine(
      x + i,
      y + 8,
      x + i,
      y + 12,
      SSD1306_WHITE
    );
  }
}


// =====================================================
// ELECTRICITY
// =====================================================
void drawElectricity(
  int x,
  int y
) {

  display.drawLine(
    x + 3,
    y - 14,
    x - 5,
    y - 2,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 5,
    y - 2,
    x + 1,
    y - 2,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 1,
    y - 2,
    x - 5,
    y + 13,
    SSD1306_WHITE
  );

  display.drawPixel(
    x - 11,
    y - 8,
    SSD1306_WHITE
  );

  display.drawPixel(
    x + 10,
    y + 5,
    SSD1306_WHITE
  );
}


// =====================================================
// DIGITAL NETWORK
// =====================================================
void drawDigitalNetwork(
  int x,
  int y
) {

  display.fillCircle(
    x - 10,
    y,
    2,
    SSD1306_WHITE
  );

  display.fillCircle(
    x,
    y - 9,
    2,
    SSD1306_WHITE
  );

  display.fillCircle(
    x + 10,
    y,
    2,
    SSD1306_WHITE
  );

  display.fillCircle(
    x,
    y + 10,
    2,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 8,
    y,
    x - 2,
    y - 7,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 2,
    y - 7,
    x + 8,
    y,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 8,
    y + 1,
    x + 2,
    y + 8,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 2,
    y + 8,
    x - 8,
    y + 1,
    SSD1306_WHITE
  );
}


// =====================================================
// SCIENCE / LAB
// =====================================================
void drawScience(
  int x,
  int y
) {

  display.drawLine(
    x - 3,
    y - 12,
    x + 3,
    y - 12,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 2,
    y - 12,
    x - 2,
    y - 5,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 2,
    y - 12,
    x + 2,
    y - 5,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 2,
    y - 5,
    x - 8,
    y + 8,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 2,
    y - 5,
    x + 8,
    y + 8,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 8,
    y + 8,
    x + 8,
    y + 8,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 5,
    y + 2,
    x + 5,
    y + 2,
    SSD1306_WHITE
  );
}


// =====================================================
// RISING BIRDS
// =====================================================
void drawRisingBirds(
  int movement
) {

  int y1 =
    52 - (movement % 38);

  display.drawLine(
    10,
    y1,
    13,
    y1 - 2,
    SSD1306_WHITE
  );

  display.drawLine(
    13,
    y1 - 2,
    16,
    y1,
    SSD1306_WHITE
  );


  int y2 =
    43 - ((movement + 12) % 35);

  display.drawLine(
    25,
    y2,
    28,
    y2 - 2,
    SSD1306_WHITE
  );

  display.drawLine(
    28,
    y2 - 2,
    31,
    y2,
    SSD1306_WHITE
  );


  int py =
    55 - ((movement * 2) % 45);

  display.drawPixel(
    8,
    py,
    SSD1306_WHITE
  );

  display.drawPixel(
    34,
    py + 7,
    SSD1306_WHITE
  );

  display.drawPixel(
    17,
    py + 14,
    SSD1306_WHITE
  );
}


// =====================================================
// HOSTED FLAG
// =====================================================
void drawHostedFlag(
  int poleX,
  int y
) {

  int x = poleX;
  int w = FLAG_W;
  int h = FLAG_H;

  int stripe = h / 3;

  display.drawRect(
    x,
    y,
    w,
    h,
    SSD1306_WHITE
  );

  display.fillRect(
    x + 1,
    y + 1,
    w - 2,
    stripe - 1,
    SSD1306_WHITE
  );

  display.fillRect(
    x + 1,
    y + stripe,
    w - 2,
    stripe,
    SSD1306_BLACK
  );

  display.fillRect(
    x + 1,
    y + stripe * 2,
    w - 2,
    h - stripe * 2 - 1,
    SSD1306_WHITE
  );

  int cx =
    x + w / 2;

  int cy =
    y + stripe + stripe / 2;

  display.drawCircle(
    cx,
    cy,
    6,
    SSD1306_WHITE
  );

  display.drawCircle(
    cx,
    cy,
    1,
    SSD1306_WHITE
  );

  for (int i = 0; i < 24; i++) {

    float angle =
      i * (2.0 * PI / 24.0);

    int x2 =
      cx + cos(angle) * 6;

    int y2 =
      cy + sin(angle) * 6;

    display.drawLine(
      cx,
      cy,
      x2,
      y2,
      SSD1306_WHITE
    );
  }
}


// =====================================================
// FLAG WAVE
// =====================================================
void flagWave() {

  const int poleX = 64;
  const int topY = 7;

  for (
    int frame = 0;
    frame < 90;
    frame++
  ) {

    display.clearDisplay();

    display.drawLine(
      poleX,
      60,
      poleX,
      topY,
      SSD1306_WHITE
    );

    drawWaveFlag(
      poleX,
      topY,
      frame
    );

    drawRisingBirds(
      frame + 20
    );

    display.display();

    delay(40);
  }
}


// =====================================================
// WAVING FLAG
// =====================================================
void drawWaveFlag(
  int poleX,
  int topY,
  int frame
) {

  const int w = FLAG_W;
  const int h = FLAG_H;

  for (
    int i = 0;
    i < w;
    i++
  ) {

    float wave =
      sin(
        i * 0.25 +
        frame * 0.32
      ) * 2.8;

    int y =
      topY + wave;

    if (i % 2 == 0) {

      display.drawLine(
        poleX + i,
        y,
        poleX + i,
        y + h / 3,
        SSD1306_WHITE
      );

      display.drawLine(
        poleX + i,
        y + h * 2 / 3,
        poleX + i,
        y + h,
        SSD1306_WHITE
      );
    }
  }

  int cx =
    poleX + 29;

  int cy =
    topY +
    h / 2 +
    sin(frame * 0.32) * 2.8;

  display.drawCircle(
    cx,
    cy,
    6,
    SSD1306_WHITE
  );

  for (
    int i = 0;
    i < 16;
    i++
  ) {

    float angle =
      i * (2.0 * PI / 16.0);

    int x2 =
      cx + cos(angle) * 6;

    int y2 =
      cy + sin(angle) * 6;

    display.drawLine(
      cx,
      cy,
      x2,
      y2,
      SSD1306_WHITE
    );
  }
}


// =====================================================
// INITIALIZE ROCKET PARTICLES
// =====================================================
void createRocketParticles() {

  for (
    int i = 0;
    i < ROCKET_PARTICLES;
    i++
  ) {

    rocketParticles[i].active = false;

    rocketParticles[i].x = 64;
    rocketParticles[i].y = 60;

    rocketParticles[i].vx = 0;
    rocketParticles[i].vy = 0;
  }
}


// =====================================================
// SPAWN ROCKET PARTICLE
// =====================================================
void spawnRocketParticle(
  int rocketY
) {

  for (
    int i = 0;
    i < ROCKET_PARTICLES;
    i++
  ) {

    if (!rocketParticles[i].active) {

      rocketParticles[i].active = true;

      rocketParticles[i].x =
        64 + random(-5, 6);

      rocketParticles[i].y =
        rocketY + 16;

      rocketParticles[i].vx =
        random(-18, 19) / 10.0;

      rocketParticles[i].vy =
        random(5, 14) / 10.0;

      return;
    }
  }
}


// =====================================================
// UPDATE ROCKET PARTICLES
// =====================================================
void updateRocketParticles() {

  for (
    int i = 0;
    i < ROCKET_PARTICLES;
    i++
  ) {

    if (!rocketParticles[i].active)
      continue;

    rocketParticles[i].x +=
      rocketParticles[i].vx;

    rocketParticles[i].y +=
      rocketParticles[i].vy;

    rocketParticles[i].vy +=
      0.045;

    rocketParticles[i].vx *=
      0.985;

    int x =
      (int)rocketParticles[i].x;

    int y =
      (int)rocketParticles[i].y;

    if (
      x >= 0 &&
      x < 128 &&
      y >= 0 &&
      y < 64
    ) {

      if (i % 3 == 0) {

        display.fillCircle(
          x,
          y,
          2,
          SSD1306_WHITE
        );

      }
      else {

        display.drawPixel(
          x,
          y,
          SSD1306_WHITE
        );
      }
    }

    if (
      y > 65 ||
      x < -5 ||
      x > 133
    ) {

      rocketParticles[i].active =
        false;
    }
  }
}


// =====================================================
// ROCKET LAUNCH
// =====================================================
void rocketLaunch() {

  delay(250);

  createRocketParticles();

  for (
    int y = 57;
    y >= -12;
    y -= 2
  ) {

    display.clearDisplay();

    drawStars();

    spawnRocketParticle(y);

    if (random(0, 3) == 0) {

      spawnRocketParticle(y);
    }

    updateRocketParticles();

    drawRocket(
      64,
      y
    );

    display.display();

    delay(42);
  }

  delay(180);
}


// =====================================================
// ROCKET
// =====================================================
void drawRocket(
  int x,
  int y
) {

  display.fillTriangle(
    x,
    y - 9,
    x - 5,
    y,
    x + 5,
    y,
    SSD1306_WHITE
  );

  display.fillRect(
    x - 5,
    y,
    10,
    13,
    SSD1306_WHITE
  );

  display.fillCircle(
    x,
    y + 5,
    2,
    SSD1306_BLACK
  );

  display.drawLine(
    x - 5,
    y + 7,
    x - 10,
    y + 14,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 5,
    y + 7,
    x + 10,
    y + 14,
    SSD1306_WHITE
  );

  display.drawLine(
    x - 3,
    y + 13,
    x,
    y + 19,
    SSD1306_WHITE
  );

  display.drawLine(
    x + 3,
    y + 13,
    x,
    y + 19,
    SSD1306_WHITE
  );
}


// =====================================================
// STARS
// =====================================================
void drawStars() {

  display.drawPixel(12, 9, SSD1306_WHITE);
  display.drawPixel(18, 34, SSD1306_WHITE);
  display.drawPixel(108, 10, SSD1306_WHITE);
  display.drawPixel(94, 30, SSD1306_WHITE);
  display.drawPixel(116, 43, SSD1306_WHITE);
  display.drawPixel(35, 17, SSD1306_WHITE);
}


// =====================================================
// FIREWORK
// =====================================================
void fireworkExplosion() {

  int cx = 64;
  int cy = 9;

  display.clearDisplay();

  display.fillCircle(
    cx,
    cy,
    5,
    SSD1306_WHITE
  );

  display.display();

  delay(80);

  for (
    int r = 3;
    r <= 30;
    r += 2
  ) {

    display.clearDisplay();

    for (
      int i = 0;
      i < 24;
      i++
    ) {

      float angle =
        i * (2.0 * PI / 24.0);

      int x1 =
        cx +
        cos(angle) * (r - 5);

      int y1 =
        cy +
        sin(angle) * (r - 5);

      int x2 =
        cx +
        cos(angle) * r;

      int y2 =
        cy +
        sin(angle) * r;

      display.drawLine(
        x1,
        y1,
        x2,
        y2,
        SSD1306_WHITE
      );
    }

    display.display();

    delay(45);
  }
}


// =====================================================
// CREATE CONFETTI
// =====================================================
void createParticles() {

  for (
    int i = 0;
    i < MAX_PARTICLES;
    i++
  ) {

    particles[i].x = 64;
    particles[i].y = 10;

    float angle =
      random(0, 360) *
      PI / 180.0;

    float speed =
      random(10, 28) / 10.0;

    particles[i].vx =
      cos(angle) * speed;

    particles[i].vy =
      sin(angle) * speed;

    particles[i].active = true;
  }
}


// =====================================================
// CONFETTI + FINAL WISH
// =====================================================
void confetti() {

  createParticles();

  const int totalFrames = 120;
  const int wishStart = 55;

  for (
    int frame = 0;
    frame < totalFrames;
    frame++
  ) {

    display.clearDisplay();

    for (
      int i = 0;
      i < MAX_PARTICLES;
      i++
    ) {

      if (!particles[i].active)
        continue;

      int x =
        (int)particles[i].x;

      int y =
        (int)particles[i].y;

      if (i % 3 == 0) {

        display.fillRect(
          x,
          y,
          2,
          3,
          SSD1306_WHITE
        );

      }
      else {

        display.drawPixel(
          x,
          y,
          SSD1306_WHITE
        );
      }

      particles[i].x +=
        particles[i].vx;

      particles[i].y +=
        particles[i].vy;

      particles[i].vy +=
        0.06;

      particles[i].vx *=
        0.995;

      if (
        particles[i].y > 64 ||
        particles[i].x < -3 ||
        particles[i].x > 131
      ) {

        particles[i].x =
          random(5, 123);

        particles[i].y =
          random(-15, 0);

        particles[i].vx =
          random(-20, 21) / 10.0;

        particles[i].vy =
          random(5, 15) / 10.0;
      }
    }


    // =================================================
    // FINAL WISH
    // =================================================

    if (frame >= wishStart) {

      int popFrame =
        frame - wishStart;

      int wishOffset = 0;

      if (popFrame < 10) {

        wishOffset =
          18 -
          (popFrame * 2);

      }

      drawFinalWish(
        wishOffset
      );
    }

    display.display();

    delay(32);
  }
}


// =====================================================
// FINAL WISH
// =====================================================
void drawFinalWish(
  int offset
) {

  display.setTextColor(
    SSD1306_WHITE
  );

  display.setTextSize(1);

  const char *line1 =
    "HAPPY";

  const char *line2 =
    "INDEPENDENCE";

  const char *line3 =
    "DAY";

  int16_t x1, y1;

  uint16_t w1, h1;
  uint16_t w2, h2;
  uint16_t w3, h3;

  display.getTextBounds(
    line1,
    0,
    0,
    &x1,
    &y1,
    &w1,
    &h1
  );

  display.getTextBounds(
    line2,
    0,
    0,
    &x1,
    &y1,
    &w2,
    &h2
  );

  display.getTextBounds(
    line3,
    0,
    0,
    &x1,
    &y1,
    &w3,
    &h3
  );

  display.setCursor(
    (128 - w1) / 2,
    10 + offset
  );

  display.print(line1);

  display.setCursor(
    (128 - w2) / 2,
    27 + offset
  );

  display.print(line2);

  display.setCursor(
    (128 - w3) / 2,
    44 + offset
  );

  display.print(line3);
}


// =====================================================
// OLED ANIMATION MAKER BRANDING
// =====================================================
void showBranding() {

  display.clearDisplay();

  printCentered(
    "Made with",
    2,
    1
  );

  printCentered(
    "OLED ANIMATION",
    16,
    1
  );

  printCentered(
    "MAKER",
    28,
    1
  );

  printCentered(
    "@oled_animator",
    42,
    1
  );

  printCentered(
    "WitbloxAshish",
    54,
    1
  );

  display.display();

  delay(2500);
}


// =====================================================
// OLED Animation Maker
// https://www.oledanimationmaker.com/
// Instagram : https://www.instagram.com/oled_animator
// GitHub    : https://github.com/WitbloxAshish
// =====================================================

FAQ

Will this Independence Day OLED sketch run on my Arduino Uno?

No, it targets ESP8266. An Uno has far less RAM and flash, so the particle-heavy scenes may crash on you. I'd use an ESP8266 or ESP32. If you really want an Uno, strip out the rocket and confetti for a lighter port. See Uno memory limits.

What OLED size do I need for the 15 August animation?

You need a 128×64 SSD1306 (0.96" I2C) at address 0x3C, drawn with Adafruit GFX rather than bitmap frame dumps.

Can I preview it without uploading?

Yes, you can. Open the tool and go to Templates → Fun → Independence Show 2026 (browser preview only).

How do I change SDA/SCL?

Edit SDA_PIN and SCL_PIN, and keep Wire.begin(SDA_PIN, SCL_PIN) as it is. ESP32 often uses 21 / 22.

Can I use this for something other than India's Independence Day?

Yes. The theme is 15 August, the Indian flag and Jai Hind, but you can reuse the structure (intro → rocket → flag → finale) for other national days. You just swap the text and flag drawing.

I cut the delays and my rocket is barely faster

Don't forget that each display() still sends a full 128×64 frame, 1024 bytes, over I2C. At the default clock near 100 kHz that transfer takes roughly 90-100 ms, so the delay(42) in rocketLaunch() isn't the big slice. If you need a shorter scene, you can raise Wire.setClock(400000) after Wire.begin(SDA_PIN, SCL_PIN), or draw fewer particles.

My board resets halfway through the rocket or confetti

An ESP8266 will watchdog-reset a tight loop that never calls delay() or yield(). The stock scenes already delay every frame, and that's what feeds the watchdog, so you don't need to add anything. If you remove those delays to "go faster," put yield() in once per frame. A weak USB supply can also reset your board when the panel's busy. It looks the same, but you can fix it with a better cable or a powered hub.

Where the show actually spends its time

If you shorten a scene by editing delay(), you only gain something when that delay is a big part of the frame. It usually isn't. Every display() pushes a full 128×64 buffer, 1024 bytes, to your SSD1306 at 0x3C. On the Arduino default I2C clock near 100 kHz, that transfer takes roughly 90-100 ms of bus time, before the delay you typed. I'm giving you bus arithmetic for a typical module here, not a scope plot of one Wemos. It's why rocketLaunch() still feels measured after you change delay(42) to delay(5). The wire's the metronome.

Count the loops that are really in the sketch, then add the transfer. yearCount() steps from 1947 to 2026 by fours. That's 20 frames, each with delay(18) plus one full display(). Your delays add up to well under half a second, but the transfers dominate, so you'll watch the year roll for a couple of seconds. That's the bus, not your code. rocketLaunch() walks y from 57 down to −12 by twos, about 35 frames, with delay(42) beside each flush. Confetti uses delay(32) inside a much longer particle life, and the chakra draws 24 spokes with sin / cos on top of the same flush. If you cut spokes or lower MAX_PARTICLES (45 for confetti, 28 exhaust), you remove CPU work and lit pixels. If you cut only the delay, you remove the smaller term.

If the show feels...Change this firstLeave this alone
Every scene feels equally slowWire.setClock(400000) after Wire.begin(4, 5) on D2/D1Flag geometry and text strings
Rocket or confetti hitch, other scenes fineFewer particles per frameThe year-count step of 4
Chakra stutter onlyDraw 12 spokes instead of 24The 1024-byte buffer size, that's the panel
Random reboot mid-sceneKeep a delay() or yield() every frame; use a solid USB supplyPROGMEM, this sketch is vector GFX, not stored frames

An ESP8266 resets when a rewritten loop never yields. The published scenes call delay() each frame, and that delay feeds the watchdog. If you delete those calls to chase speed, without yield(), the board reboots halfway up the rocket and it looks like a power bug. A thin USB cable causes the same reboot when the panel and the radio-less ESP8266 surge together, so swap your cable before you comment out fireworkExplosion(). After any pin edit, SDA stays D2 (GPIO4) and SCL stays D1 (GPIO5) unless you change Wire.begin too. On an ESP32 you'd use GPIO21 and GPIO22 for those two arguments. Raise the I2C clock only after a full show completes at 100 kHz. If the flag sparkles at 400 kHz, shorten your jumpers. The timing table above assumes the bus is keeping up.

Related guides

Preview Independence Day on OLED Animation Maker

Open Templates → Fun → Independence Show 2026, or design your own 15 August frames and export your Arduino code.

Open oledanimationmaker.com → ⬇ Download from GitHub

Free tools: OLED Animation Maker for your SSD1306 and SH1106 animations, Assemble Studio for your name and logo animations, the Shadow Box Lamp Generator for your 3D-printed shadow lamps, Text to STL for your 3D-printed names and keychains, and 3MF to Web to show your 3D prints on any website. New: the Image to Byte Array converter, the OLED Robot Eyes generator and the Lithophane Maker. See all tools.