OLED Animation Maker OLED Maker
💭 Free Arduino project · SSD1306

Khayalon Ki Duniya OLED Animation

Play Khayalon Ki Duniya (खयालों की दुनिया) as a looping mono animation on a 0.96" SSD1306 — 124 PROGMEM frames, ready-to-flash Adafruit sketch, free on GitHub.

By Ashish Sep 26, 2026 ~10 min read Arduino · ESP8266 · ESP32
💭

124 song frames

Full Khayalon Ki Duniya visuals as 1024-byte PROGMEM bitmaps for 128×64.

⚡

Plug & play sketch

Adafruit SSD1306 + GFX — open main.ino and upload.

🔌

Clear wiring

Uno / ESP8266 / ESP32 pin tables included below.

🆓

Free on GitHub

Clone or ZIP download — no paywall, no signup.

Want Khayalon Ki Duniya (खयालों की दुनिया — “world of thoughts”) to come alive on a tiny 0.96" SSD1306 OLED? This project plays a full 124-frame mono animation loop using Adafruit SSD1306 — perfect for desk toys, classroom demos, Hindi song-themed makers, and GIF-to-OLED experiments.

⬇ Free download — Khayalon Ki Duniya OLED code

Full main.ino with all PROGMEM frames · ZIP or git clone

Open GitHub repo →

Parts list

  • Board: ESP8266 NodeMCU / Wemos D1 Mini, ESP32, or Arduino Mega (recommended)
  • Display: 0.96" SSD1306 I2C OLED, 128×64, usually 0x3C
  • 4 Dupont wires (VCC, GND, SDA, SCL)
  • USB cable + Arduino IDE

Connection / wiring

Match your board. Wrong SDA/SCL is the #1 blank-screen cause.

OLED pinArduino Uno / NanoESP8266 (NodeMCU)ESP32
VCC5V (or 3.3V if module requires)3.3V3.3V
GNDGNDGNDGND
SDAA4D2 (GPIO4)GPIO21
SCLA5D1 (GPIO5)GPIO22

On ESP8266, call Wire.begin(4, 5) before display.begin() if default I2C pins fail. If the screen stays black, try address 0x3D and read OLED blank screen fixes.

Libraries

  1. Arduino IDE → Tools → Manage Libraries
  2. Install Adafruit SSD1306
  3. Install Adafruit GFX Library
  4. Select your board + correct COM port

How the player works

All frames are stored as const uint8_t PROGMEM frameN[1024] from frame0 through frame123. In loop() the sketch advances the index on a timer and draws the current bitmap:

void loop() {
  static uint8_t frameIdx = 0;
  static unsigned long lastMs = 0;
  const uint8_t* frames[] = { frame0, frame1, /* ... */ frame123 };
  const uint8_t numFrames = 124;

  if (millis() - lastMs >= 67) {
    lastMs = millis();
    display.clearDisplay();
    display.drawBitmap(0, 0, frames[frameIdx], 128, 64, SSD1306_WHITE);
    display.display();
    frameIdx = (frameIdx + 1) % numFrames;
  }
}

Change 67 to speed up or slow down the loop. Smaller = faster FPS (example: 100 ≈ 10 fps, 67 ≈ 15 fps). Full loop ≈ 8.3 seconds.

Upload & run

  1. Open khayalokiduniya → download ZIP or clone
  2. Open main.ino in Arduino IDE
  3. Install Adafruit GFX + SSD1306
  4. Pick ESP8266 / ESP32 / Mega + COM port
  5. Click Upload
  6. Watch Serial at 115200 — if you see SSD1306 allocation failed, fix power/wiring/address

Ready to flash?

Get the complete Khayalon Ki Duniya main.ino from GitHub now.

⬇ Download code

Make your own song animation

Khayalon Ki Duniya was exported from oledanimationmaker.com:

  1. Open the free tool in Chrome/Edge
  2. Go to Import → drop a short GIF or video clip
  3. Tune FPS / frame count for your board flash
  4. Click Get the Code → Adafruit SSD1306 Arduino
  5. Paste into IDE (or push to your own GitHub)

Related guides: GIF to OLED, Image to byte array, SSD1306 animation basics, Kalayani song OLED.

Troubleshooting

  • Sketch too big — use ESP8266/ESP32 or fewer frames
  • Blank OLED — 3.3V on ESP, check SDA/SCL, try 0x3D
  • Slow / laggy — keep frame delay ≥ 50–80 ms; solid USB power
  • Compile OOM — on ESP8266 set higher flash size in Tools
  • Garbage at end of file — delete stray characters after the last } in main.ino

FAQ

Is the Khayalon Ki Duniya OLED code free?

Yes — github.com/itzmeAshish/khayalokiduniya.

Does it play audio?

No — this is a visual OLED animation only. Pair a speaker separately if you need sound.

Can I change the clip?

Yes. Import a different GIF/video into OLED Animation Maker and export a new sketch.

What does Khayalon Ki Duniya mean?

It is Hindi for “world of thoughts.” This sketch is a 124-frame visual loop at ~15 fps — about 8.3 seconds per cycle on a 0.96" SSD1306.

Build more OLED song & GIF animations

Pixel editor, GIF import, WebSerial live preview, Arduino & MicroPython export — free in the browser.

Open OLED Animation Maker →

What main.ino contains for this Hindi loop

Clone itzmeAshish/khayalokiduniya and you get one sketch: main.ino. The Hindi title on the page is Khayalon Ki Duniya (खयालों की दुनिया), “world of thoughts.” The file does not store lyrics, a singer credit block, or an audio sample. It stores the visual loop: frame0 through frame123, 124 arrays, each const uint8_t PROGMEM ... [1024]. setup() brings up the SSD1306 at 0x3C and prints to Serial at 115200 if allocation fails. loop() calls drawBitmap(0, 0, ..., 128, 64, SSD1306_WHITE) and then display().

Because the file is main.ino, the folder on disk must be named main. Arduino IDE compares those two names. A ZIP that unpacks to khayalokiduniya-main will prompt you to move the sketch. Rename that folder to main before the first compile. Do not rename the file to code.ino unless you also rename the folder. This repo is the main layout, unlike the Kalayani repo.

Speed table for the 67 ms step

Stock timing is 67 ms, about 15 fps. A full cycle is 124 × 67 ms = 8,308 ms, the 8.3 seconds quoted above. That is a short, smooth loop compared with the slower song players on this site. It is also close to the time it takes to ship a full frame over I2C.

DelayApprox. fps124-frame cycleI2C note
134 ms~7.5~16.6 sEasy on the default 100 kHz bus
100 ms1012.4 sStill fine for most modules
67 ms (stock)~158.3 sWorks best if the bus can finish a 1024-byte transfer in time
50 ms206.2 sUsually limited by display() itself, not by the number you typed

At 100 kHz, 1024 data bytes plus ACK bits take roughly 90 ms on the wire. A 67 ms test can expire while display() is still clocking the previous frame, so the picture advances as fast as the bus allows and the 15 fps label becomes a target. If the motion looks slower than 8.3 seconds per pass, add Wire.setClock(400000); after the bus starts. At 400 kHz the same payload is on the order of 25 ms, and the 67 ms step is real again. Do not set the clock before Wire.begin().

Pins and power for a 15 fps bitmap

The generated header mentions Uno (SDA A4, SCL A5). Treat that as the pin legend for a short test, not as permission to compile 124 KB of frames for a 32 KB Uno. For the published sketch:

  • ESP8266 NodeMCU / Wemos D1 Mini: 3.3V to VCC, GND to GND, D2 (GPIO4) to SDA, D1 (GPIO5) to SCL. Call Wire.begin(4, 5) if the board package does not pick those pins.
  • ESP32: 3.3V, GPIO21 SDA, GPIO22 SCL. ESP boards do not use the 5V pin to run the OLED.
  • Uno or Nano, only after you cut the frame count: 5V is acceptable on modules that have a regulator, SDA A4, SCL A5, address 0x3C.

A fast loop makes a weak USB cable obvious. If the panel browns out every few seconds, the 15 fps refresh is pulling the rail down. Shorten the cable or power the board from a charger that can hold 5V at the USB socket. The OLED still wants 3.3V on an ESP.

124 KB is why the Uno line in the header misleads

124 frames × 1024 bytes = 126,976 bytes, about 124 KB of flash for the pictures alone. Classic Uno and classic Nano stop near 32 KB total. The compiler error appears before any pixel is drawn. Mega 2560 (256 KB flash) can be in range after libraries. An ESP32 or a 4MB ESP8266 is the straightforward board: set the flash size in Tools so the build is not aimed at a 1MB layout with a large SPIFFS slice that steals the bitmap space.

Slowing the delay does not shrink the binary. If you need an Uno, re-export a handful of frames from the maker and keep this 124-frame file for the ESP. Mixing the two by pasting half of main.ino into an empty sketch usually breaks the pointer list that loop() indexes.

How to change the delay without losing the cycle

The only timing constant is 67 in if (millis() - lastMs >= 67). Replace it, leave numFrames at 124, and upload. The wrap frameIdx = (frameIdx + 1) % 124 (via numFrames) is what makes the 8.3 second visual repeat. There is no end screen.

For a calmer desk loop, 100 or 134 ms is the change I would make first. You keep every bitmap and you give the bus a full transfer window, so you do not need setClock just to look smooth. For a recording, 100 ms gives you a 12.4 second pass, which is easier to film than a loop that laps the camera’s start button.

Filming one 8.3 second cycle

Set the phone so the 0.96" window fills the frame, and turn off lights that reflect in the glass. Start recording, wait until the opening picture comes back, and stop after that second arrival. That is one honest pass of Khayalon Ki Duniya on the panel. A two-second clip from the middle can look like a frozen poster.

You will not hear the song in that take. The OLED is monochrome pictures only. If you later edit the footage, do not expect lip sync against a studio track: the stock loop is 8.3 seconds of bitmaps at ~15 fps, not a clock locked to the recording. Dither speckle, if you re-export your own clip with dither on, is data. It should look like a fine pepper on gradients, not like a rolling bar down the panel. A rolling bar is a power or I2C problem.

Black panel, wrong chip, not enough flash

  • Black screen: confirm 3.3V on ESP VCC, GND continuity, and that SDA/SCL match the table. Swapped data and clock lines look exactly like a dead module.
  • Wrong address: if Serial prints SSD1306 allocation failed, edit the address from 0x3C to 0x3D once. Most of these 0.96" boards are 0x3C. A few are strapped the other way. No ACK on either address means the wires, not the song file.
  • Board menu: NodeMCU 1.0 is the usual ESP8266 entry. An ESP32-S3 or a classic ESP32 Dev Module will not accept each other’s upload. If the port vanishes when you plug in, install the matching board package and the USB driver before you touch the OLED code.
  • Flash: 124 KB of frames plus Adafruit libraries needs a real sketch region. On ESP8266 choose 4MB (1MB or more for the sketch, not a tiny 512KB profile). Uno will always report that the sketch does not fit. That message is accurate.

Questions that come up with this 124-frame file

Is the Hindi title spoken or printed by the sketch?

Neither. Khayalon Ki Duniya is the name of the visual. main.ino does not scroll the title and does not play audio. You are uploading 124 monochrome frames.

Why must the folder be called main?

The sketch file is main.ino. The IDE requires the containing folder to use that same name. Rename the unzipped GitHub folder to main, then open the file.

The loop takes longer than 8.3 seconds. Did the upload drop frames?

Usually the bus is slower than the 67 ms target. Time one cycle. If it is closer to 12 seconds, display() is stretching each frame. Wire.setClock(400000) after begin, or a delay of 100 ms, makes the timing match the table. A missing frame looks like a jump, not like a uniformly slow loop.

Can the Uno run it if I select a huge flash size?

No. The Uno has about 32 KB of flash and the menu cannot add more. 124 KB of bitmaps needs an ESP32 or a 4MB ESP8266 (Mega is the AVR exception if you rewire I2C to pins 20 and 21).

Related posts