Want Lord Ganesha to come alive on a tiny 0.96" SSD1306 OLED for Ganeshotsav Day 7? This project plays a full 150-frame mono animation loop using Adafruit SSD1306 — perfect for Ganesh Chaturthi desk toys, classroom demos, festival makers, and GIF-to-OLED experiments.
⬇ Free download — Ganesha Day 7 OLED code
Full code.ino with all PROGMEM frames · ZIP or git clone
Parts list
- Board: ESP8266 NodeMCU / Wemos D1 Mini (this sketch), ESP32, or Arduino Mega
- 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. This repo was generated for ESP8266 NodeMCU.
| OLED pin | Arduino Uno / Nano | ESP8266 (NodeMCU) | ESP32 |
|---|---|---|---|
| VCC | 5V (or 3.3V if module requires) | 3.3V | 3.3V |
| GND | GND | GND | GND |
| SDA | A4 | D2 (GPIO4) | GPIO21 |
| SCL | A5 | D1 (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
- Arduino IDE → Tools → Manage Libraries
- Install Adafruit SSD1306
- Install Adafruit GFX Library
- Select your board + correct COM port (example: NodeMCU 1.0)
How the player works
All frames are stored as const uint8_t PROGMEM frameN[1024]. 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, /* ... */ frame149 };
const uint8_t numFrames = 150;
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 Ganesha loop. Smaller = faster FPS
(example: 100 ≈ 10 fps, 67 ≈ 15 fps). Full loop ≈ 10 seconds.
Upload & run
- Open GaneshaDay7 → download ZIP or clone
- Open
code.inoin Arduino IDE - Install Adafruit GFX + SSD1306
- Pick ESP8266 / ESP32 / Mega + COM port
- Click Upload
- Watch Serial at 115200 — if you see
SSD1306 allocation failed, fix power/wiring/address
Ready to flash?
Get the complete Ganesha Day 7 code.ino from GitHub now.
Make your own Ganpati animation
Ganesha Day 7 was exported from oledanimationmaker.com:
- Open the free tool in Chrome/Edge
- Go to Import → drop a short GIF or video clip of Lord Ganesha / Ganpati
- Tune FPS / frame count for your board flash
- Click Get the Code → Adafruit SSD1306 Arduino
- 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 (4MB typical)
- Garbage at end of file — delete stray characters after the last
}incode.ino
FAQ
Is the Ganesha OLED code free?
Yes — github.com/itzmeAshish/GaneshaDay7.
Does it play aarti audio?
No — this is a visual OLED animation only. Pair a speaker separately if you need sound.
Can I change the Ganesha clip?
Yes. Import a different GIF/video into OLED Animation Maker and export a new sketch.
What is Day 7?
This sketch is a Ganeshotsav Day 7 Lord Ganesha (Ganpati Bappa / Vinayaka) loop — 150 frames at ~15 fps, about 10 seconds per cycle on a 0.96" SSD1306.
Build more OLED festival & GIF animations
Pixel editor, GIF import, WebSerial live preview, Arduino & MicroPython export — free in the browser.
Open OLED Animation Maker →What the Day 7 sketch is made of
itzmeAshish/GaneshaDay7
plays a Ganeshotsav Day 7 visual of Lord Ganesha
(Ganpati Bappa / Vinayaka) on a 0.96" SSD1306. The file is code.ino,
not main.ino. Inside it: frame0 through frame149,
150 PROGMEM arrays of 1024 bytes, a pointer table, Adafruit SSD1306 at
0x3C, and a loop() that steps every 67 ms. There is no aarti
audio, no bell pin, and no scrolling verse. The festival part is the picture loop.
Rename the unzipped folder to code before you compile. The IDE matches the
folder to code.ino. A folder that is still called GaneshaDay7
triggers the “sketch name must match” prompt. Do not rename this one to main
unless you rename the file too. That main rule belongs to other repos on
this site, not to this file.
The header was generated with ESP8266 NodeMCU in mind. setup()
talks to Serial at 115200 and stops in a clear way if display.begin()
cannot allocate or cannot find the panel. If you see
SSD1306 allocation failed, you are still in setup(). The 150
frames never get a chance to draw.
Festival loop timing at 67 ms
150 × 67 ms = 10,050 ms, about 10.1 seconds per cycle at about 15 fps. The page rounds that to a 10 second Ganpati loop. It is the same step the Khayalon Ki Duniya sketch uses, on a longer frame list, so the cycle is a couple of seconds longer than that 8.3 second Hindi loop.
| Delay | Approx. fps | 150-frame cycle | How it feels on a desk |
|---|---|---|---|
| 200 ms | 5 | 30 s | A slow darshan-style hold on each bitmap |
| 100 ms | 10 | 15 s | Calm, and kind to a 100 kHz bus |
| 67 ms (stock) | ~15 | ~10 s | The published Day 7 speed |
| 50 ms | 20 | 7.5 s | A target more than a guarantee on default I2C |
A full frame on a 100 kHz bus takes on the order of 90 ms to clock out. The stock 67 ms
test can fire again before that transfer finishes, so a pass may run a little longer
than 10 seconds until you raise the clock. Wire.setClock(400000) after
Wire.begin() brings the payload down to roughly 25 ms, which makes 15 fps
honest. For a festival desk toy, 100 ms is often nicer than chasing 15 fps: every
Ganesha bitmap stays readable and the wires can be ordinary dupont leads.
NodeMCU wiring this file expects
Build it on the board the repo names first.
- ESP8266 NodeMCU: VCC to 3.3V (not the 5V pin, even if the module has a regulator), GND to GND, SDA to D2 (GPIO4), SCL to D1 (GPIO5). In the IDE choose NodeMCU 1.0 (ESP-12E) unless your board really is a different module. If the default pins miss,
Wire.begin(4, 5)beforedisplay.begin(). - ESP32, if you move the same file: 3.3V, SDA GPIO21, SCL GPIO22. Change the board menu to the ESP32 you own. The NodeMCU pin labels on the comment no longer apply.
- Uno pins A4 and A5 are correct for a classic Uno, and 5V is fine on a regulated 0.96" module, but only after the frame count is small enough for 32 KB of flash. This 150-frame file is not that sketch.
Select the COM port that appears when the NodeMCU is plugged in. A port left over from an Uno you used earlier will time out on upload, and the old Ganesha binary (or no binary) stays in the module. That looks like “the animation did not change” even though the IDE compiled the new delay.
Why 150 Ganpati frames miss the Uno
150 × 1024 = 153,600 bytes, about 150 KB of pictures. Uno flash is about 32 KB including the bootloader’s share. The IDE stops at link time. Classic Nano is the same chip family and the same wall. ESP8266 with a 4MB flash size, or any common ESP32, has room for this table plus Adafruit. Mega 2560 can also be large enough if you move SDA and SCL to the Mega’s I2C pins (20 and 21) instead of believing the Uno A4/A5 silk.
Cutting the delay does not cut the binary. If the class only has Unos, open the maker,
keep a dozen frames of the Ganesha motion, and export a different sketch. Keep
code.ino as published for the NodeMCU build. Deleting
frame80 through frame149 in a text editor without rebuilding
the pointer list leaves loop() reading addresses that are not bitmaps.
Retiming the loop
The constant sits in if (millis() - lastMs >= 67). Change 67, leave
numFrames at 150, upload to the NodeMCU you already selected. The wrap
back to frame0 is the whole repeat. There is no “end of Day 7” screen
and no audio cue to line up.
A 200 ms step turns the same frames into a 30 second cycle. That is the change to make
when you want each picture held long enough for people across a table to see it, or
when you are about to film. A 50 ms step rarely looks twice as fast, because
display() still has to move 1024 bytes. Measure one return to the opening
frame with a watch before you edit the constant a second time.
Filming the 10 second cycle
Record about 15 seconds so the stock pass can finish and the first Ganesha frame can come back. Put the phone close. The 128×64 window should dominate the shot. Room light behind the camera becomes a white bar across the glass and hides the lit pixels.
You should see continuous motion and a clean loop, with no soundtrack from the board. This build does not play aarti. If you add a speaker later, it belongs on its own circuit and its own sketch. A good take of the display has even brightness from left to right. A band that flickers on the right side is usually a loose GND or a long SCL wire, not a frame that was exported half-empty. Half-empty exports look like a stable picture with a missing region, the same on every loop.
Board mismatch and a dark 0.96 inch panel
- Black screen: NodeMCU VCC must be 3.3V. D2 is SDA and D1 is SCL. Swapping them is the mistake that survives three library reinstalls.
- Wrong address: change
0x3Cto0x3Dif Serial reports allocation failed. Most Day 7 builds on a generic 0.96" module stay at 0x3C. Both addresses failing means the bus is not there. - IDE board: compiling for Uno and uploading to NodeMCU, or compiling for ESP32 and uploading to ESP8266, leaves the panel dark because the chip never reaches
display.begin(). Choose NodeMCU 1.0 for this repo’s intended board, and the port that shows up on plug-in. - Not enough flash: Tools → Flash Size → a 4MB entry. A 1MB setting can fail this 150 KB table once the core is linked. Uno cannot be given more flash from that menu.
- Stray characters: if compile errors start at the last line, the download picked up junk after the final brace. The troubleshooting note above still applies. Fix that before you touch the delay.
Day 7 questions before you flash
Does the sketch play aarti or only show Ganesha?
Visual only. It is a 150-frame Ganeshotsav Day 7 loop of Lord Ganesha on the OLED. There is no audio in code.ino.
The repo is GaneshaDay7 but the file is code.ino. Which folder name wins?
The file name wins. Rename the folder to code, then open code.ino. The IDE is matching the sketch file, not the GitHub repo title.
My cycle is slower than 10 seconds. Are frames missing?
Count a full return to the first picture. If every frame is simply late, the 67 ms target is losing to I2C at 100 kHz. Raise the clock with Wire.setClock(400000), or set the delay to 100 ms and expect about 15 seconds. Missing frames show up as a jump, not as a steady slowdown.
Can I run all 150 frames on an Uno for the class demo?
No. The bitmaps are about 150 KB and Uno flash is about 32 KB. Use the NodeMCU this sketch was generated for, an ESP32, or a 4MB ESP8266. For Uno, export a much shorter Ganesha loop.