Here’s an inexpensive electronic circuit that you can build to put in your Jack-o’lantern. It provides power to drive a few LEDs at night, and automatically turns them off during the daytime. It’s a simple and automatic dark-detecting circuit that you can use to for your very own photosensitive pumpkin.
Our pumpkin project is closely related to the minimalist dark-detecting LED circuit that we showed previously.
In that project– basically an LED throwie with a sensor– a phototransistor controls a single LED.
While the minimalist circuit is marvelously compact and simple, it is limited both in terms of sensitivity, LED driving capability, and extensibility. It can drive a single red or yellow LED from a lithium coin cell– but that’s it– and it requires fairly bright light (e.g., direct sunlight) to turn off the LED.
So our new dark-detecting circuit is only almost as compact or simple, but is much more sensitive, and is capable of driving several bright LEDs for your Jack-o’lantern. We’ll get started with the basic circuit construction, using two LEDs for eyes, and then look at how to modify the circuit to use more or different types of LEDs.
Here’s a list of parts for the basic design (with two LEDs):
- A phototransistor (we use type LTR-3208E)
- 2N3904 (or similar) transistor, QTY 2.
- 5k ohm resistor
- Yellow or red LEDs, QTY 2. (We used 10 mm diffused yellow LEDs)
- 50 ohm resistors (one for each LED)
- Battery holder with 2 AA-size alkaline batteries
[Technical description of the circuit:
The photosensitive element is a phototransistor. We use type LTR-3208E here; it’s an infrared-sensitive type with a dark lens. Being IR sensitive it sees sunlight and incandescent lights, but not fluorescent or (most) discharge lamps– it really will come on at night. The typical “saturation” current of this type of phototransistor is only of order 1 mA, which means that under conditions much less bright than sunlight, we get much less than 1 mA of output current. To increase the sensitivity of our pumpkin enough to detect indirect daylight lighting– not just direct sunlight– we use the phototransistor as one element of a Darlington pair. When daylight is detected, the phototransistor turns on (just a little bit), which turns on the first 2N3904, which pulls the base of the second 2N3904 to ground, and preventing the LEDs from turning on. When it’s dark out, no current can flow through the phototransistor or the first 2N3904, which allows the base of the second 2N3904 to be pulled high through the 5 k transistor, which turns on the LEDs through that transistor. As drawn here, the circuit draws 0.5 – 1 mA (depending on ambient light) when it’s daytime and up to about 35 mA when driving the two LEDs at night. (If your LEDs are superbright types, you might want to cut down on brightness and power usage by using larger load resistors.) The photosensitive part of the circuit is independent of what’s actually driven by the second 2N3904, so you can change the load applied there easily. Our circuit is drawn with two LEDs, each with its own load resistor, however you can actually use 1-4 parallel LEDs if each has its own load resistor.]
A good place to start playing with a circuit like this is on a solderless breadboard. For the most part you can follow the circuit diagram. You’ll need to know that on our type of phototransistor the flat side that denotes the “collector” pin (“C” on the diagram). Also, the pins of the 2N3904 are called (left-to-right) Emitter, Base, Collector (E, B, and C on the diagram), when viewing it from the front such that you can read the writing. On the LEDs, the side with the short lead and/or flatted faced on the lens is generally the cathode, which is the side with the flat bar in the diagram.
From there, we constructed the same circuit on a small piece of plain perfboard. There are three twisted wire pairs going off from this little board to (1) the photosensor and (2,3) the LEDs. (There are really just the two transistors and three resistors on the board– the resistor-looking thingies with one black stripe are just fancy wire jumpers.)
Here’s the whole setup with the phototransistor and LEDs visible at the ends of their wire leads. We use the long leads to be able to put the LEDs and sensor exactly where we want them in the pumpkin. We’ve protected the end of the leads with heat-shrink tubing. (No use shorting out our circuit with pumpkin goo.) The circuit board is strapped to the 2 x AA battery box with a cable tie.
Our pumpkin design here is subtle– just a pumpkin with light up eyes, close together like some kind of small creature in the dark. But, you can go nuts in all kinds of ways with LEDs in jack-o’-lanterns, so please do! (And don’t forget to add your pictures to the Evil Mad Science Auxiliary on flickr!) Regular twist drills, turned by hand, work very well for making LED holes in pumpkins.
Here are the LEDs inserted into the holes. They’re nearly invisible. Note that the LEDs are off, because the room lights are on.
Next, to drill a hole for the phototransistor. We put this hole in the back side of the lid of the pumpkin, behind the stem.
And here is the photosensor installed neatly in place. (You won’t notice it unless you look for it.)
You can test the pumpkin for photosensitivity by covering up the sensor by hand.
As we hinted earlier, this circuit is extensible– you can use it as the starting point for other things as well. You can add extra LEDs (each with its own load resistor) in parallel with the two shown in the diagram to use a total of about 35 mA. If you require slightly more output current, you can somewhat decrease the value of the 5k resistor, which will increase the base current through the second 2N3904, and produce a higher output current. (Note that this will make the circuit both more power hungry and a little bit less efficient.)
The circuit as drawn is fairly flexible in terms of input voltage, up to about 5 V, if you also increase the value of the LED load resistors to keep the LED current at a safe level. One consequence of this is that you could drive the circuit from 3-4 cells of rechargeable NiMH/NiCd battery or 4.5 V (from 3 AA’s) to provide a large enough voltage to directly drive green, white, or blue LEDs. Another approach to driving drive green, white, or blue LEDs is to leave the voltages where they are, but to use a joule thief, and hook that up where an LED would normally go.
Finally, here is a slight variation on the design:
This variation allows you to tune the light-sensitivity of the circuit. In this, we’ve replaced the 5 k fixed resistor with a 5 k potentiometer, and added a 1k resistor to restrict the maximum current into the second 2N3904.
You can find more pumpkin projects in our Halloween Project Archive.