Independence Day OLED Animation 2026 — ESP8266 + SSD1306
Every 15 August makers ask the same question: can a tiny 0.96" SSD1306 OLED show something that feels like a real Independence Day celebration — not just static text? Yes. This guide walks through a complete Independence Day OLED animation for ESP8266 (NodeMCU / Wemos D1 Mini): year count from 1947 → 2026, spinning Ashoka Chakra, rocket launch, fireworks, flag hoisting with science icons, waving tricolour, Jai Hind, confetti, and Vande Mataram.
The full sketch is indipendanceday.ino — vector GFX (lines, circles, particles), not huge PROGMEM bitmaps —
so it fits comfortably on ESP8266 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 for classroom demos:
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() shows a home screen with the flag and VANDE MATARAM,
waits a few seconds, then repeats.
Parts list
- ESP8266 — NodeMCU 1.0 or Wemos D1 Mini (recommended)
- 0.96" SSD1306 I2C OLED, 128×64, usually address
0x3C - 4 Dupont wires (VCC, GND, SDA, SCL)
- USB cable + Arduino IDE with ESP8266 board package
Why not Uno? Particle systems and many floating-point waves need more RAM/CPU. ESP8266 handles it easily. ESP32 works too if you change I2C pins (often SDA=21, SCL=22).
Wiring (NodeMCU / Wemos D1 Mini)
Use 3.3V for the OLED on ESP8266 — do not feed a 5V-only habit from Uno tutorials into VCC on these boards unless your module is explicitly 5V-tolerant and level-shifted.
| OLED pin | ESP8266 | GPIO |
|---|---|---|
| VCC | 3.3V | — |
| GND | GND | — |
| SDA | D2 | GPIO4 |
| SCL | D1 | GPIO5 |
#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 the screen stays blank, try address 0x3D, check 3.3V power, and confirm SDA/SCL are not swapped.
See also OLED blank screen fixes.
Libraries
- Arduino IDE → Tools → Manage Libraries
- Install Adafruit SSD1306
- Install Adafruit GFX Library
- Board: NodeMCU 1.0 (ESP-12E Module) or LOLIN(Wemos) D1 R2 & mini
Need U8g2 instead? Read
U8g2 vs Adafruit for animations.
This sketch is written for Adafruit GFX APIs (drawLine, drawCircle, fillRect, text).
How the Indian flag is drawn on a mono OLED
SSD1306 is monochrome — no saffron/green. The sketch fakes the tricolour with density patterns:
filled top band, empty middle band with Ashoka Chakra, filled bottom band. The waving version
offsets each column with sin() so the cloth moves:
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, the flag climbs, and side icons cycle through
ISRO rocket, atom, satellite, chip, lightning, network, and lab flask — a nod to India’s science story —
while small bird shapes rise in the sky.
Rocket, fireworks & confetti (particles)
Two particle pools drive the spectacle:
- 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
Firework burst is simpler: concentric radial lines from the top center. Stars are fixed pixels for night sky. Because everything is drawn each frame with GFX (not stored bitmaps), you can tweak delays and radii without regenerating byte arrays.
Text scenes that stay readable
Helper printCentered() uses getTextBounds() so labels like
15 AUGUST, JAI HIND, and VANDE MATARAM stay centered on 128×64.
The year counter steps from 1947 to 2026; yearsOfFreedom() counts to the 80th Independence Day.
Keep text size 1 for long phrases — size 2 is fine for short years like 2026.
Upload & run
- Open
indipendanceday.inoin Arduino IDE - Select ESP8266 board + COM port
- Click Upload
- Watch Serial at 115200 — if you see
OLED NOT FOUND!, fix wiring/address - The full Independence Day show starts automatically and loops
Full copy-paste sketch is below on this page (jump to full code). Download 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: reduce
delay()values in each scene - Bigger flag: change
FLAG_W/FLAG_H(keep within 128×64) - ESP32: set
SDA_PIN/SCL_PINto 21/22 (or your board defaults) - Classroom branding: edit strings in
showBranding()
Preview vs export
The maker site includes an Independence Show 2026 template marked preview only — you can watch it on the virtual OLED, but code export is disabled for that showcase. The real deployable project is this Adafruit sketch: 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 — 3.3V power, I2C pins, try
0x3D, run I2C scanner - Garbled graphics — wrong display size; this sketch assumes 128×64
- Slow / stutter — USB power brownout; use a solid 5V supply to the board
- Compile errors on math — keep
#include <math.h>forsin/cos - Random looks fixed —
randomSeed(analogRead(A0))needs a floating A0; otherwise particles look similar each boot
Full sketch (copy-paste) — indipendanceday.ino
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.
/*
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 Arduino Uno?
It targets ESP8266. Uno has much less RAM/flash; particle-heavy scenes may crash. Use ESP8266/ESP32, or strip rocket/confetti for a lighter Uno port. See Uno memory limits.
What OLED size does the 15 August animation use?
128×64 SSD1306 (0.96" I2C) at address 0x3C, drawn with Adafruit GFX — not bitmap frame dumps.
Can I preview without uploading?
Yes — open the tool, Templates → Fun → Independence Show 2026 (browser preview only).
How do I change SDA/SCL?
Edit SDA_PIN and SCL_PIN, keep Wire.begin(SDA_PIN, SCL_PIN).
ESP32 often uses 21 / 22.
Is this only for India Independence Day?
The theme is 15 August / Indian flag / Jai Hind. You can reuse the structure (intro → rocket → flag → finale) for other national days by swapping text and flag drawing.
Popular searches: independence day oled animation · 15 august oled arduino · esp8266 ssd1306 indian flag · jai hind oled · vande mataram animation · nodeMCU oled project · ashoka chakra oled · wemos d1 mini ssd1306
Related guides
- ESP32 OLED animation guide
- How to create SSD1306 OLED animations
- drawCircle / drawRect GFX shapes
- SSD1306 I2C wiring tutorial
- GIF to OLED Arduino
Preview Independence Day on OLED Animation Maker
Open Templates → Fun → Independence Show 2026, or design your own 15 August frames and export Arduino code.
Open oledanimationmaker.com → ⬇ Download from GitHub