Batman Keychain With ESP8266




I have recently bought a batman key chain from amazon. There is a small button in the key chain, when pressed it lights the batman's eye and sounds a pathetic tune. So I thought of customising it a bit.

The key chain will be able to produce a pacman monotone with a customizable light from the batman's eye. The tune is customizable. I chose pacman tone because it was easy to generate the monotone. If anybody can come up with a batman monotone I am happy to replace the tone.

Things needed.

  1. ESP8266 01
  2. 3.7 V LiPo Battery
  3. USB LiPo Charger
  4. Old earphone speaker
  5. LEDs
  6. 220 resistor

Step 1: Open the Keychain

The above video shows how it behaves when I got the key chain. Now open the key chain. There is enough room to put some custom electronic parts.

Step 2: Find an Old Earphone and Take One of Its Speaker

Earphone speakers are small and if you are going to generate some monotone sound, it is loud enough to be used in our purpose.

Step 3: Connection

Make the connection as per the circuit diagram. I have used 3 SMD (Red, Green, and Blue) LEDs. I soldered it to a small protoboard with 220 ohm resistor in series with the LEDs. You can use any LEDs, but SMD will save you a lot of space.

Connect the LiPo charger to the battery.

Step 4: Program the ESP

Program the ESP01 using a USBtoSerial converter. You can use arduino IDE for programming ESP8266.

Step 5: Put Everything Back Inside the Keychain

Make some space using your dremel tool to put everything inside the key chain.

Step 6: Test Your Keychain & Future Additions

Things that can be added in the futuree

  1. Pressing for a long time will enable a hotspot
  2. Option to change the tone by writing it to EEPROM on the go (ESP8266 has 512 bytes of EEPROM).
  3. Option to play PCM encoded 8 bit WAV file.



    • Trash to Treasure

      Trash to Treasure
    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest

    12 Discussions


    1 year ago

    Its overkill to use ESP8266 for such kind of task, i would rather use some Attiny, but you migt add some aditional functionalitirs in the future.

    3 replies

    Reply 1 year ago

    Yes. But compare the prices. You can buy both using the same price. I am also planning to control my DSLR using this one. From phone, I can remotely trigger the shutter and also set time lapse option (which is not present in my nikon DSLR). See this


    Reply 1 year ago

    Attiny also can blast IR :) you can get Attiny a bit cheaper but it's irelevent when you making only one copy. Maybe the main advantage would be power consumtion.


    Reply 1 year ago

    I know ny controller can do that job. :P But I need it to be controlled by my phone. From phone I will set the time lapse config and it will trigger automatically. Regarding power consumption I think, it will be the reverse. Most of the avr uC will consume much less current comparing with esp8266 without enabling any deep sleep. (I have seen people messing with deep sleep mode in esp8266 resulting in much less current consumption < 1mA. ( ) )

    don't you need a flyback diode across the speaker?
    Also, you may want to consider playing wav files from SPIFFS memory. I posted some code for that a while ago at

    1 reply

    Reply 1 year ago

    I already read your post in esp8266 forum. I will definitely try that out. But quality of the sound will not be that good,right?

    I don't think it will create ny problems due to back emf, but adding a diode will be a good idea. Thanks for the input.


    1 year ago

    You could make this open your garage door.

    1 reply