Escape Room Prop: Secret Morse Code Light-bulb

by PeterTheUnGreat in Circuits > Microcontrollers

2224 Views, 12 Favorites, 0 Comments

Escape Room Prop: Secret Morse Code Light-bulb

light bulb cover.png
20220902_182934.jpg

I love the idea of escape rooms (although I have yet to do one!) and thought it would be really fun to have a suitcase of items that could transform any ordinary room into an escape room puzzle.

This is my first prop for the suitcase. A lightbulb that looks ordinary until you flip the light switch and the room fills with a flashing morse code message revealing a secret code number.

Made from a stock mains lightbulb with an 8 pin PIC microcontroller switching the LEDs on and off using a high voltage FET. The small circuit is stuffed inside the base of the bulb

When the bulb if first powered on it flashes a series of morse code characters, in this case 4 numerical digits which the escapee will then have to use to crack annother puzzle. The digits are hard coded into the PIC as code space is very tight. Once the bulb has flashed the four digit sequence it then stays lit until turned off again.


SAFETY NOTE:

This project involves working with high voltage DC and mains electricity. There is a real risk of fire or shock to users if this project is not made correctly.

I give some safety tips but DO NOT attempt this project unless you are familiar with safe working at high voltages, particulaly the safe use of an isolating transformer and the attendant dangers of inadvertant earthing through test gear.


P.S. Cover image based on an AI generated image by WOMBO dream. As far as I can tell there is no copyright issue using it, but I am open to correction! It seems like a bit of a grey area at the moment

Supplies

20220902_170136.jpg
20220902_170112.jpg

You will need the following components:

  1. An LED light-bulb - this will need some exprerimentation to find a bulb with enough space inside to accomodate the microcontroller
  2. A PIC microcontroller - I used an 8 pin DIP PIC12F629
  3. An N-channel FET with a 600V rating - I used an IRF9610 but many switching power supplies will yeild a suitable salvage FET
  4. A 240K Ohm 0.5W resistor - You may need a diferent value if you have anything other than 230V mains
  5. A few other discrete components, diodes, resistors and capacitors


You will need the following special tools:

  1. A PIC programmer - I used a generic copy of the PICKIT3 programmer

Circuit

20220902_175304.jpg
Morse light bulb circuit.png

The circuit is quite simple.

One output of a tiny 8 bit PIC microcontroller is used to switch on and off a small bipolar NPN transistor. This then applies a higher voltage to the gate of a 600V rated FET. A buffer transistor is neccessary because the FET threshold voltage is arround 4V and the 3V output of the PIC is not enough.

The FET then switches the 350V (approx.) to turn the LED array of the bulb on and off. The bulb used was a 7W bulb and the current through the LEDs was about 40mA.

This curcuit is designed to work in the UK where the mains voltage is a EU harmonised 230V. If you are in a region with a 110V mains you will need to adjust the circuit to suit, particulaly the power supply for the PIC

I did experiment with running the PIC at 5V, at which voltage it switched the FET cleanly without a buffer tranststor. However the current consumption of the PIC increaces at 5V to about 1.2mA which puts too much demend on the very crude power supply arrangement

The power supply to the PIC is very simple, the 240k resistor gives an available current of about 1.2mA. The six diodes have a combined forward voltage of 3V which gives a small regulated supply to the PIC. A 3k3 resistor at 1.2mA gives a total voltage for switching the FET of 6-7V. Because the 240K resistor is carrying 1.2mA or so it is dissipating about 0.3W so it needs to be a chunky resistor or it will burn out. This is a very crude power supply as it wastes far more power than it supplies, however it is very compact and allows the circuit to fit in the light bulb.

(I am sure some of you will chide me for the lack of decoupling - well there is no excuse, I should have included a 10nF decoupling capacitor across the PIC power supply pins!)

I did experiment with taking power from the circuit from the 8V drop across one of the LEDs when the lamp was lit. However this needed a large capacitor to maintain the 1mA supply to the PIC when the bulb was in the off state. I did consider pulsing the lamp on very briefly every millisecond or so to maintain charge on the capacitpor but code space was a bit tight in the PIC to allow for that complexity.

Test the circuit thoroughly, ideally with a long soak test inside the bulb enclosure to make sure no components can overheat and cause fire

Preparing the Bulb

20220902_170309.jpg
20220902_175247.jpg

To prepare the bulb the diffusing cap needs to be carefully unglued and removed using a knife

The existing circuit can then be prised out and a cut made in the track between the negative side of the capacitor and the negagtive supply of the current limiting ICs. This is where the FET will be connected to switch the bulb on and off

You can see that I struck lucky with my bulb and the base moulding had slots for a PCB that was not fitted so I could accomodate my circuit rigidly and safely in the base.

Adding the PIC

20220902_181241.jpg
20220902_181229.jpg

The little PCB containing the PIC, power supply and FET can be made in whatever way you fancy. Ideally surface mounted on a custom PCB. Mine was just made using through hole components and wire wrapping.

Flying leads can then be fitted to the PCB which poke through existing holes in the lamps PCB and are soldered to the leads of the capacitor and the cut track. (The capacitor was contained in the base and would have been in the way of my PCB so I moved it to the front of the lamp)

It is worth extending the wires which connect the existing PCB to the base of the bulb to make assembly easier (Making sure you retain any fuse that may be in line in one of the wires)

Then the diffuser needs to be cemented firmly back in place to ensure it cannot be easily removed by a user. (I just selotaped mine in place to allow reprogramming of the PIC, this is not so safe though)

Be very careful that the PCB cannot be dislodged, for example if the bulb is dropped, as any shorts to the casing could result in fire or electrocution

Code and Notes

I used Xide from Microchip to write the C code and program the PIC.

The source code is attached and documented in the code.

I won't explain the code here as it is quite simple

A nice development would be to make the code in the bulb reprogrammable, perhaps by using an IR remote