logo
Your Ad Here

The switch is on

A switch seems simple enough: You flick it one way to go on and the other way to go off. However, understanding what’s happening behind that switch requires that we give you a bit of background.

Open: A switch is in an open state when there is no electrical connection. When switch is open, there is very high resistance between a wire coming into a switch and the wire going out of the switch.

Closed: A switch is closed when there is an electrical connection. When a switch is closed, there is very low resistance between a wire coming into a switch and the wire going out of the switch.

There are different kinds of switches, referred to as SPST, SPDT, and DPDT, as shown in Figure 3-7. Here’s what these catchy acronyms mean:

SPST (single-pole, single-throw): This kind of switch has two lugs to which you can solder wires. When the switch is on, the two wires are connected; when the switch is off, the two wires are disconnected. We like SPST switches so much that we use them as on/off switches in every project in this session.

SPDT (single-pole, double-throw): This kind of switch has three lugs to which you can solder wires: one for an incoming wire and two for outgoing wires. When the switch is in one position, the incoming wire is connected to the first of the outgoing wires. When the switch is in the other position, the incoming wire is connected to the second of the outgoing wires. (If you have a different need and this is the type of switch you happen to have in your parts bin, you can use just two lugs to make it work as an SPST.)

DPDT (double-pole, double-throw): This kind of switch has six lugs to which you can solder wires. These lugs can be attached to two incoming wires and four outgoing wires. When you flip this switch, you simply switch each incoming wire between two of the outgoing wires. We use this type of switch in a relay in "Sensetive Sam Walks the Line" project to switch control of the motors from one type of sensor to another.

figure 3-7

As if switches didn’t have enough names, they are also referred to by the method used to change their state from open to closed. See Figure 3-8 to see the different types.

Toggle switch: This switch gets its name from the fact that you flip a lever to turn it on and flip it back to turn it off.

Pushbutton on/off switch: Every time you push this button, it changes from on to off or vice versa.

Momentary pushbutton switch: Pushing this switch is what changes its state, but only for the moment! These are also classified by whether they are normally open (NO) or normally closed (NC). For example, a momentary normally open switch is closed only while you hold the pushbutton down. When you release the button, it goes back to its normal — open — state.

Tactile switch: This is a type of momentary pushbutton switch. Tactile switches are rated by the amount of force that is needed to push the button and are often flat so that they can be easily inserted somewhere without protruding (like how we insert them into the hands of a puppet in "Murmuring Merlin" project).

Slide switch: Logically, this switch operates when you slide a knob to change it from on to off or vice versa.

Relays: These switches are operated by a voltage rather than by pushing a switch. This makes them very useful for turning on or off a component, such as a light or motor, through a remote control or by voltage generated by a sensor. We control relays with both methods in "Sensetive Sam Walks the Line" project

figure 3-8

Sensors

Sensors take energy in forms such as sound or light and transform that energy into a signal. By using a sensor, you can detect heat, light, and sound, for example. When a signal is sensed, to the sensor produces an electrical signal that is used by your circuit to control some activity. For example, an infrared detector can work in conjunction with an infrared remote control device to stop or start a little go-kart.

Here are a few types of sensors that we use in the projects in this part of the web site:

IR detector: This converts infrared (IR) light into an electric signal. The version that we use in Chapters 11 and 9 contains a photodiode that detects infrared light and an integrated circuit that produces either +V or 0 volts on its output pin. In order to reduce noise from ambient IR light, this detector is designed to only respond to IR light that is pulsed at 38 kHz.

Tilt/vibration sensor: This type of sensor (which we use in "Couch Pet-Ato project) detects motion or vibrations when the switch is mounted with the body of the sensor horizontal. When the sensor detects motion, it closes a switch, just like a toggle switch works.

Microphones

Technically speaking, a microphone is a kind of sensor. However, there’s a lot to say about these sound-sensing devices, so we give microphones their own section.

How condenser (capacitor) microphones work

Capacitors are kind of like a voltage sandwich in that they have two plates, with a slab of voltage between them. A so-called condenser mike (also called a capacitor microphone) contains one plate made of a very light material that acts as a diaphragm. This plate vibrates when sound waves hit it. This moves the two plates apart, which changes capacitance (the ability to store electrons). Moving the plates farther apart decreases capacitance (discharging current), and moving them together increases capacitance (charging current). Condenser microphones aren’t cheap, but they give high-quality sound, so they are often the best choice for an audio-intensive project.

A better mousetrap: Electret capacitor microphones

Today, the most popular type of condenser microphone is the electret microphone (which gets its name from the combination of electrostatic and magnet), invented in 1962. The electret material used in this type of microphone is made by embedding a permanent charge in a material called a dielectric. A charge is embedded in a dielectric by aligning the charges in the material — sort of like how you make a magnet by aligning the atoms in a piece of iron. There is a preamplifier in an electret microphone, to which you provide a supply voltage. That’s why the projects in this book that use electret microphones have a connection through a resistor running between the plus (+) lead of the microphone and the +V bus to power the preamplifier. (The resistor reduces the voltage at the + lead of the microphone to the desired supply voltage.)

 

Size counts

When you order electret microphones, pay attention to the diameter and thickness because some can be hard to handle and solder. For most of our projects in this book, we use microphones with a diameter of about 3⁄8" and a thickness of about 2⁄10". A microphone cartridge with a diameter of about 1⁄4" and a thickness of about 1⁄10" turns out to be much harder to handle and solder to than a microphone cartridge of about 3⁄8" and a thickness of about 2⁄10". (Check out Chapter 6, where we bit the bullet and used a small microphone cartridge because that project needed some of the capabilities we couldn’t find in a larger microphone cartridge.) Many microphone cartridge sizes are specified in millimeters. To help you translate this, typical diameters of microphone casings are 6 mm (about 1⁄4") and 9.7 mm (about 3⁄8").

Measuring sensitivity

Sensitivity is another issue that you should pay attention to with microphone cartridges. Sensitivity is measured in decibels (dB) — and just to confuse you, this measurement is given as a negative number. A microphone cartridge with a sensitivity of –40 dB, for example, is more sensitive (provides higher voltage at a given level of sound) than a microphone cartridge with a sensitivity of –60. For example, for the project in Chapter 6 (which has to pick up very faint sounds as part of a parabolic microphone), you need a highly sensitive microphone cartridge. We use one with a sensitivity of –35 dB. In Chapter 14, in which you talk directly into the microphone to record a message, we use a less-sensitive microphone cartridge, rated at –64 dB.

Connecting your microphone cartridge to your project

To connect electret microphone cartridges to your project, you can get electret microphone cartridges with solder pads or with leads that you can insert into a breadboard. We use both in our projects.

Let there be light: Light emitting diodes

A diode sends out light when you pass an electric current through it. LEDs, which we use quite a bit in the projects in this book, are similar to the tiny, twinkly lights you use to decorate a Christmas tree, and they come in a variety of colors, such as red, orange, yellow, green, blue, and white. Blue and white LEDs are a lot more expensive, so you don’t see them used that often in this part of web site. (We’re thrifty!)

LED color isn’t controlled by the plastic that surrounds the light. Rather, the semiconductor material used in the LED determines the color. The plastic surrounding the semiconductor material can be clear or treated so that it diffuses the light. In addition, you can get LEDs in several sizes and shapes. The standard LED, which is a cylinder with a diameter of 5mm, is referred to as T-1 34.

If you don’t connect LEDs the right way, you could wait forever to see the light. Connect the longer of the two leads to the positive voltage and the shorter of the two leads to ground or the more negative voltage.

Speaking up about speakers

Everybody knows what a speaker is: There’s one on your DVD player, your computer, your iPod — you name it! Most speakers contain a permanent magnet, an electromagnet, and a cone-shaped device from which the sounds emerge (see Figure 3-9).

figure 3-9

When current moves through the electromagnet, which is attached to the cone, it gets pushed toward or pulled away from the permanent magnet. This depends on which way the electric current is moving. This movement of the electromagnet is what makes the cone vibrate, and that produces sound waves. Speakers come with a rated impedance (the degree to which a component resists electrical current): for example, 4 ohm, 8 ohm, 16 ohm, or 32 ohm. A speaker is often referred to by its impedance: for example, “I’m going out to buy an 8 ohm speaker.” When you use a speaker in a circuit, it should have an impedance rating that matches the minimum impedance rating that the amplifier hooked up to the speaker can drive. If you use a speaker with higher impedance than the amplifier can drive, you won’t get the maximum amount of sound; conversely, if you use a speaker with lower impedance than the amplifier can drive, you might overheat the amplifier. You can find this rating in the datasheet on your supplier’s Web site.

For example, in "Surfing the Airwaves" project, we use an 8 ohm speaker because the LM386 amplifier can drive a speaker with impedance as low as 8 ohms. And in Chapter 14, we use a 16 ohm speaker because the ISD1110 voice record/ playback chip can drive a speaker with impedance as low as 16 ohms.

Speakers also come with a power rating, such as 0.2 watt, 1 watt, or 2 watt. Choose a speaker with at least as high of a power rating as the maximum output of the amplifier. Again, you can find this maximum output in the amplifier datasheet.

When you buy a speaker for electronics projects, buy one that comes with convenient holes in the corners of metal or plastic flanges that you can slip screws through. These help you to easily attach the speaker to the box you’re putting the circuit in. See "Discovering schematics" for more about building and assembling projects.

Buzzers

If you have an annoying friend who plays practical jokes, you’ve probably been on the receiving end of the buzzer and handshake joke. A buzzer essentially generates a sound, which you can use in projects in a variety of ways. For example, a buzzer could be the horn on a remote controlled car or an alarm that goes off when a sensor detects motion. In a buzzer, you apply voltage to a crystal (a piezoelectric crystal), which then expands or contracts. By attaching a diaphragm to the crystal, you cause the diaphragm to vibrate when you change the voltage. This vibration causes that bzzz sound. There are electromagnet buzzers, but the piezo buzzer works just fine for electronic projects, so we stick to using them in this part of web site.

Most buzzers give off sound in the 2–4 kHz range. Buzzers aren’t very discriminating when it comes to voltage: Their ratings are approximate, meaning that a 12V buzzer is absolutely happy to work with a 9V power supply. Buzzers have two leads, and you have to connect a buzzers the right way round. The red lead is always positive (+).