4 minute read
Construction
Figure 3-15 The light switch breadboard layout
CHAPTER 3: Basic Hacks 41
Case 2: When It’s Light
When it is light, we have to consider the resistance of the LDR R1. The lighter it is, the lower the resistance of R1 and the more of the current otherwise destined for the base of the transistor will be diverted through R1, preventing the transistor from turning on.
I think the time has come to build the project on breadboard. Figure 3-15 shows the breadboard layout, and Figures 3-16a and 3-16b the finished breadboard.
When placing the LED on the breadboard, make sure you get it the right way around. The longer lead is the positive lead, and it should be on row 10 connected to R3. (See Figure 3-16a.)
If everything is fine, you should find that when you cover the LDR, the LED should light (Figure 3-16b).
Construction
Now that we have proved our circuit works, we can get on with modding the push light. Figure 3-17 shows the push light the author used. Unless you are very lucky, yours is likely to be
42 Hacking Electronics
(a) (b)
different, so read through the following sections carefully and you should be able to work out how to change your light. To make life easy for yourself, try and find a push light that operates from 6V (4 AA or AAA cells).
You will probably find screws on the back of the push light. Remove these and put them somewhere safe. The inside of the push light is shown in Figure 3-18. The various connections on the light are marked. You can find the corresponding connections on your light using a multimeter.
Setting the multimeter to its 20V DC range will let you determine which battery lead is positive and which is negative. Looking at the wiring, we can draw a schematic diagram for the light as it stands, before we start altering it (Figure 3-19).
Figure 3-16 The light switch breadboard
Figure 3-17 A push light
Battery + Yellow wires to lamp
Wire linking left and right halves of battery box
Battery –
Switch
CHAPTER 3: Basic Hacks 43
Figure 3-19 The schematic diagram for the original push light
Figure 3-20 Replacing the bulb with an LED and a resistor
This light uses an old-fashioned incandescent bulb. We will replace that with a high-brightness LED. If you don’t have one of these, a regular LED of the color of your choice will work, but not be very bright.
Figure 3-20 shows how we replaced the bulb with the LED and the 220Ω resistor. Make sure the longer positive lead of the LED is connected to the resistor and the far side of that resistor is connected to the positive terminal of the battery.
Try pressing the switch to make sure the LED is working.
We can now draw a schematic that combines what we have in the existing lamp and our LDR circuit (Figure 3-21).
In fact, all this really amounts to is adding in the switch to the original LED schematic. We have already installed R3 and D1 when we replaced the bulb with an LED. The switch is already there, so all we need to add is the transistor, LDR, and R2. Figure 3-22 shows how we will rewire the push light. Figure 3-23 shows the sequence of steps in soldering the extra components onto the light.
1. Start by desoldering the lead from the switch that isn’t connected to the negative battery terminal (Figure 3-23a).
2. Solder the 10kΩ resistor R2 between the middle lead of the transistor (the base) and the positive terminal on the battery box. 3. With the flat of the transistor facing upward, as shown in the diagram, connect the left-hand lead of the transistor to the wire you just disconnected from the switch (Figure 3-23b). 4. Solder the LDR between the left and middle pins of the transistor, and connect the combined left-hand transistor lead and LDR lead to the connection on the switch that the wire used to be attached to. (See Figure 3-23c.) 5. Tuck the components away neatly, bending the leads to make sure there is no way the bare leads can touch each other. (See Figure 3-23d.)
There you are! You have hacked some electronics.
44 Hacking Electronics
Figure 3-22 The push light wiring diagram
Figure 3-23 Soldering the project
(a) (b)