Skip to content

834 Bytes of Feluda

Before you read โ€” press play on the video above.

19 notes across two octaves โ€” if you felt that, welcome. You've heard the Feluda theme by Satyajit Ray ๐Ÿกฅ.

Feluda โ€” the fictional Bengali detective Ray created in 1965 โ€” reached the screen in Sonar Kella ๐Ÿกฅ (1974) with a theme that, for many, behaves less like music and more like a trigger hidden deep inside memory. It revives quiet afternoons filled with imagination, the nervous thrill of mystery, strange places waiting to be explored, coded conversations, and the comforting certainty of Feluda thinking three steps ahead. The nostalgia arrives gently โ€” not as sadness, but as atmosphere. A return to a slower inner world shaped by curiosity, attention, and wonder.

Now, on a good holiday afternoon, you are absorbed in nostalgia accompanied by a smoking cuppa tea, counting blessings, when you are startled by multiple ding-dongs from the doorbell - just over your head. The doorbell worked. It announced. It fulfilled its contract. It had no opinion about any of this.

Through this abrupt, humorless ding-dong - I had one.

My doorbell should have a personality, and it must respect my holiday. It will play these famous 19 notes with a character of suspense, intelligence, and adventurous energy, without heaviness. And I must build it.

How? The ATtiny13A ๐Ÿกฅ in my parts drawer answered that question before I finished asking it. Could I bit-bang it to produce a sequence of square waves with periods? It has 1 kilobyte of flash. 64 bytes of RAM and 1 Timer/Counter. You don't ask if something will fit in a chip like that. You find out. So, I started giving it the brains. Yes, it can generate nice square waves. The timer holds good enough. The output needs to be amplified, but that's a concern for later. My initial blocker is removed, now the main problem.

I didn't have sheet music for the score. Googling, I found a veteran YouTuber who had played it on keyboard and, in the video description, quietly listed which notes he used. Thank you, Sir.

Next Problem โ€“ Note duration, rest periods. These weren't in the video description. So, I listened to the original score - again and again, and adjusted by ear until it sounded like Feluda. Not until the math was correct. Until it sounded right. The math, if you check it, doesn't fully explain what you heard at the top of this post. The ear does.

I took those notes and durations and wrote them in RTTTL ๐Ÿกฅ. If you were alive during the Nokia era, you know RTTTL. Ring Tone Text Transfer Language โ€” the format Nokia used for composable ringtones in the late 1990s. You could write a melody in plain text, send it via SMS, and your phone would play it. An entire generation composed music this way, mostly while avoiding homework. My firmware will not use RTTTL at runtime โ€” it's just note frequencies and durations in code. But I documented it anyway. Consider it my sheet music. If you want to hear what it sounds like โ€” or compose something of your own โ€” the player is here ๐Ÿกฅ.

When I laid out the sequence of equivalent frequencies for the notes in the score, and the duration each instruction will generate square waves, including delays as silence in between, it just worked. No magic here, the microcontroller is just doing its work as instructed. The tune ended with applause - Arduino IDE reported the whole thing compiled to 834 bytes successfully. 190 bytes remaining.

I just needed a few more problems to solve, and I didn't need to be creative to solve them. Number one โ€“ how to trigger it, the doorbell button sits on the 220V AC mains line. And the 19 notes start playing on the MCU reset - no interrupt handler, no event loop. The kind of solution that feels obvious only after you've found it.

It's a straightforward optocoupler use case you can extract from a salvaged AC Fan regulator. I found PC817 ๐Ÿกฅ. Press the AC Bell-Push to activate the optocoupler; it pulls the ATtiny's reset pin low, the chip wakes, plays once, and goes back to deep sleep.

Number two โ€“ amplify the sound. Again, a pack rat like me can find a basic 2-piece PC speaker somewhere in the garage. Take one of them, and you may find a PAM8403 ๐Ÿกฅ Class-D amplifier as I did. Kill two birds with one stone โ€” enclosure and amp both. The birds in question were already dead.

Number three โ€“ Power. Use a repurposed Nokia BL-5C โ€” still useful thirty years later โ€” charged via a TP4056 module.

Schematic

Fig: Complete schematic, perfboard layout, and module interconnections for the Feluda theme doorbell.

Wire everything, stuff it in the speaker enclosure, and call it done.

Set it up, press the bell push, if it completes its tune cycle โ€“ "Exorcise thee, O every unclean spirit", the exorcism is done, you now know the malevolent spirit is evicted, and you can continue enjoying your tea.

Build

Fig: Clockwise from top-left โ€” front side of the circuit board, back side of the circuit board, Nokia BL-5C battery with TP4056 charging module and main circuit board, and an enclosure salvaged from an old PC speaker.

I built this in 2023, quietly, the way you build things when the building is the point. It worked on the first run, which almost never happens, and which I chose to accept without investigating why. For a while, it lived on the wall and did its job. Guests would press the button, hear Feluda, and look confused in the best possible way. Then the mains line started having opinions โ€” occasional spikes that tripped the optocoupler without anyone pressing anything. Feluda at midnight is atmospheric exactly once, so I took it down.

I didn't think about it much after that. Until recently, when I was moving an old carton and found the prototype sitting there exactly as I'd left it. If you've seen Sonar Kella โ€” Ray's 1974 film based on his 1971 novel โ€” you know Mukul, the boy whose past-life memories return without warning, triggered by a drawing, a color, or a particular quality of light. An old perf board in a carton is apparently enough. I picked it up, turned it over, and three years collapsed without effort. That's when I went looking for the Git repo. It was still there, exactly as I'd left it โ€” 19 notes, 834 bytes, waiting.


Schematic, firmware, perf board layout, RTTTL notation โ€” all open. GitHub ๐Ÿกฅ

Schematic and Perfboard layouts drawn by DIYLC ๐Ÿกฅ

Want to Play RTTTL on Browser?