Make: Electronics

get any
Free ebooks from Code With OJ

Make: Electronics

Dimming Your LED

Begin with the potentiometer turned all the way counterclockwise, otherwise you’ll burn out the LED before we even get started. (A very, very small num- ber of potentiometers increase and decrease resistance in the opposite way to which I’m describing here, but as long as your potentiometer looks like the one in Figure 1-48 after you open it up, my description should be accurate.)

Now connect everything as shown in Figures 1-50 and 1-51, taking care that you don’t allow the metal parts of any of the alligator clips to touch each other. Now turn up the potentiometer very slowly. You’ll notice the LED glowing brighter, and brighter, and brighter—until, oops, it goes dark. You see how easy it is to destroy modern electronics? Throw away that LED. It will never glow again. Substitute a new LED, and we’ll be more careful this time.

While the batteries are connected to the circuit, set your meter to measure volts DC as shown in Figures 1-52 through 1-54. Now touch the probes either side of the LED. Try to hold the probes in place while you turn the potentiometer up a little, and down a little. You should see the voltage pressure around the LED changing accordingly. We call this the potential difference between the two wires of the LED.


How to Read a Data Sheet

ALike most information, the answer to this question is available online. Here’s how you find a manufacturer’s data sheet (Figure 1-68). First, find the component that you’re interested in from a mail-order source. Next, Google the part number and manufacturer’s name. Usually the data sheet will pop up as the first hit. A source such as Mouser.com makes it even easier by giving you a direct link to manufacturers’ data sheets for many products.


Finishing the Job

I always use bright illumination. This is not a luxury; it is a necessity. Buy a cheap desk lamp if you don’t already have one. I use a daylight-spectrum fluo- rescent desk lamp, because it helps me identify the colored bands on resistors more reliably. Note that this type of fluorescent lamp emits quite a lot of ultra- violet light, which is not good for the lens in your eye. Avoid looking closely and directly at the tube in the lamp, and if you wear glasses, they will provide additional protection. No matter how good your close-up vision is, you need to examine each joint with that close-up magnifier. You’ll be surprised how imperfect some of them are. Hold the magnifier as close as possible to your eye, then pick up the thing that you want to examine and bring it closer until it comes into focus. Finally, you should end up with a working circuit. You can insert the wires from your power supply into two of the tiny power sockets, and plug a red LED into the remaining two sockets. Remember that the two center sockets are nega- tive, and the two outer sockets are positive, because it was easier to wire the circuit this way. You should color-code them to avoid mistakes. So now you have a tiny circuit that pulses like a heartbeat. Or does it? If you have difficulty making it work, retrace every connection and compare it with the schematic. If you don’t find an error, apply power to the circuit, attach the black lead from your meter to the negative side, and then go around the circuit with the red lead, checking the presence of voltage. Every part of this circuit should show at least some voltage while it’s working. If you find a dead connection, you may have made a bad solder joint, or missed one entirely. When you’re done, now what? Well, now you can stop being an electronics hobbyist and become a crafts hobbyist. You can try to figure out a way to make this thing wearable. First you have to consider the power supply. Because of the components that I used, we really need 9 volts to make this work well. How are you going to make this 9-volt circuit wearable, with a bulky 9-volt battery? I can think of three answers: You can put the battery in a pocket, and mount the flasher on the outside of the pocket, with a thin wire penetrating the fabric. Note that the tiny power connector on the perforated board will accept two 22-gauge wires if they are solid core, or if they are stranded (like the wires from a 9-volt battery connector) but have been thinly coated with solder. 2. You could mount the battery inside the crown of a baseball cap, with the flasher on the front. 3. You can put together three 3-volt button batteries in a stack, held in some kind of plastic clip. If you try this option, it may not be a good idea to try to solder wire to a battery. You will heat the liquid stuff inside the battery, which may not be good for it, and may not be good for you if the liquid starts boiling and the battery bursts open. Also, solder doesn’t stick easily to the metallic finish on most battery terminals. Most LEDs create a sharply defined beam of light, which you may want to dif- fuse to make it look nicer. One way to do this is to use a piece of transparent acrylic plastic, at least 1/4 inch thick, as shown in Figure 3-82. Sandpaper the front of the acrylic, ideally using an orbital sander that won’t make an obvious pattern. Sanding will make the acrylic translucent rather than transparent. Drill a hole slightly larger than the LED in the back of the acrylic. Don’t drill all the way through the plastic. Remove all fragments and dust from the hole by blasting some compressed air into it, or by washing it if you don’t have an air compressor. After the cavity is completely dry, get some transparent silicone caulking or mix some clear five-minute epoxy and put a drop in the bottom of the hole. Then insert the LED, pushing it in so that it forces the epoxy to ooze around it, making a tight seal. See Figure 3-82.


Magnetic Sensor Switches

A typical alarm sensor switch consists of two modules: the magnetic mod- ule and the switch module, as shown in Figures 3-85 and 3-86. The magnetic module contains a permanent magnet, and nothing else. The switch module contains a “reed switch,” which makes or breaks a connection (like a contact in- side a relay) under the influence of the magnet. When you bring the magnetic module close to the switch module, you may faintly hear the reed switch click as it flips from one state to the other. Like all switches, reed switches can be normally open or normally closed. For this project, you want the kind of switch that is normally open, and closes when the magnetic module is close to it. Attach the magnetic module to the moving part of a door or window, and at- tach the switch module to the window frame or door frame. When the window or door is closed, the magnetic module is almost touching the switch module. The magnet keeps the switch closed until the door or window is opened, at which point the switch opens. The only question is: how do we use this component to trigger our alarm? As long as a small current flows through all our magnetic sensor switches, the alarm should be off, but if the flow of current stops, the alarm should switch on. We could use a relay that is “always on” while the alarm is armed. When the cir- cuit is interrupted, the relay relaxes and its other pair of contacts closes, which could power up the alarm noisemaker. But I don’t like this idea. Relays take significant power, and they can get hot. Most of them are not designed to be kept “always-on.” I’d prefer to handle the task using a transistor.


A Break-to-Make Transistor Circuit

First, recall how an NPN transistor works. When the base is not sufficiently posi- tive, the transistor blocks current between its collector and emitter, but when the base is relatively positive, the transistor passes current. Take a look at the schematic in Figure 3-87, which is built around our old friend the 2N2222 NPN transistor. When the switch is closed, it connects the base of the transistor to the negative side of the power supply through a 1K resistor. At the same time, the base is connected with the positive side of the power supply through a 10K resistor. Because of the difference in resistances and the relatively high turn-on voltage for the LED, the base is forced below its turn-on threshold, and as a result, the transistor will not pass much current. The LED will glow dimly at best. Now what happens when the switch is opened? The base of the transistor loses its negative power supply and has only its positive power supply. It be- comes much more positive, above the turn-on threshold for the transistor, which tells the transistor to lower its resistance and pass more current. The LED now glows brightly. Thus, when the switch is turned off and breaks the con- nection, the LED is turned on. This seems to be what we want. Imagine a whole series of switches instead of just one switch, as shown in Figure 3-88. The circuit will still work the same way, even if the switches are scattered all over your home, because the resis- tance in the wires connecting the switches will be trivial compared with the resistance of the 1K resistor. I have shown the switches open, because that’s the way the schematic for a switch is drawn, but imagine them all closed. The base of the transistor will now be supplied through the long piece of wire connecting all the closed switches, and the LED will stay dark. Now if just one switch is opened, or if anyone tampers with the wire linking them, the base of the transistor loses its connection to negative power, at which point the transistor conducts power and the LED lights up. While all the switches remain closed, the circuit is drawing very little current— probably about 1.1 mA. So you could run it from a typical 12-volt alarm battery. Now suppose we swap out the LED and put a relay in there instead, as shown in Figure 3-89. I don’t mind using a relay in this location, because the relay will not be “always on.” It will normally be off, and will draw power only when the alarm is triggered.


Self-Locking Relay

There’s only one remaining problem: we want the alarm to continue making noise even after someone who has opened a door or window closes it again quickly. In other words, when the relay is activated, it must lock itself on. One way to do this would be by using a latching relay. The only problem is that we would then need another piece of circuitry to unlatch it. I prefer to show you how you can make any relay keep itself switched on after it has received just one jolt of power. This idea will be useful to you later in the book as well. The secret is to supply power to the relay coil through the two contacts inside the relay that are normally open. (Note that this is exactly opposite to the relay oscillator, which supplied power to its coil through the contacts that were nor- mally closed. That setup caused the relay to switch itself off almost as soon as it switched itself on. This setup causes the relay to keep itself switched on, as soon as it has been activated.) In Figure 3-90, the four schematics illustrate this. You can imagine them as be- ing like frames in a movie, photographed microseconds apart. In the first pic- ture, the switch is open, the relay is not energized, and nothing is happening. In the second, the switch has been closed to energize the coil. In the third, the coil has pulled the contact inside the relay, so that power now reaches the coil via two paths. In the fourth, the switch has been opened, but the relay is still powering its own coil through its contacts. It will remain locked in this state until the power is disconnected.


Aurther

Charles Platt


Downlaod Book

Download Book