image

12
LET’S MAKE A GAME!

You’ve built all sorts of small circuits in this book, and each circuit was designed to teach you a particular concept. In this chapter, you’ll combine all your new skills to build a reaction game. The game has a row of five LEDs that light up one at a time so that a light appears to run back and forth.

The goal of the game is to stop the light when it’s in the middle of the five LEDs. That gives you 10 points. If you stop it on an LED next to the middle one, you get 5 points. But if you stop it on one of the end LEDs, you lose all your points and have to start over from 0. Try to reach 50 points!

You can play this game by yourself to practice your reaction time, or with as many friends as you want. If you’re competing with friends, I suggest giving each player only one attempt at stopping the light before the next player gets a turn.

image

MEET THE REACTION GAME CIRCUITS

The reaction game will consist of three circuits:

image A 555 timer circuit that determines the speed of the game

image A counter that controls which LED light to turn on

image An SR latch that will add a reset button and an action button

This section explains each circuit, but to help you understand their diagrams, let’s meet two new circuit symbols.

Meet the VCC and GND Symbols

Circuit diagrams don’t always use a battery symbol like the one used throughout this book. Sometimes they use the VCC (or VDD) and GND symbols instead.

image

If nothing in the circuit diagram or its description says otherwise, you can assume that VCC represents the positive side of the battery and that GND represents the negative side, or ground. The symbols sometimes look a little different, but the VCC symbol usually shows a wire connecting down from its symbol to the circuit, while the GND symbol shows a wire connecting up from the symbol to the circuit.

In bigger circuit diagrams, like the one you’re going to build from in this chapter, these symbols make the diagram much easier to draw and understand.

WHY IS IT CALLED VCC?

The positive voltage symbol is called VCC because of old naming conventions. VCC was the voltage supplied to the collector side of a transistor in common transistor circuits, usually through a resistor or some other components. The collector is where the “CC” comes from.

You’ve used a bipolar junction transistor throughout this book, but there’s another type of transistor called a field-effect transistor (FET). The pin that equals the collector on this type of transistor is called the drain, so the voltage that was supplied to the drain side of the FET was called VDD.

A 555 Timer to Set the Light Speed

The circuit that sets the reaction game’s speed will be built around a 555 timer, and it’s similar to the circuits you built in Chapter 8. The components in this circuit diagram will set the game to a “medium” speed: it’s not super fast, and it’s not super slow.

image

Every time the output from the 555 timer goes from low to high, the light moves one step to the side. The number of times the output from the 555 timer goes high per second is the frequency of the output. As I showed in Chapter 8, the formula for calculating the frequency of the output of the 555 timer is

image

The following values from the 555 timer circuit diagram correspond to that formula:

R1 = 100 kΩ

R2 = 10 kΩ

C1 = 1 µF

Plug these into the formula, keeping in mind that 1 µF = 0.000001 F and 120 kΩ = 120,000 Ω, and you get this:

image

This means the output will go high 12 times per second and the light will change places 12 times per second. You can experiment with the component values for R1, R2, and C1 later to speed up or slow down the game.

A Counter to Turn the LEDs On

To control the LEDs, you’ll use a decade counter, which is an IC that counts input pulses. Every time the clock input on pin 14 goes from low to high, the counter increments by one. It counts from 0 to 9, and it has 10 outputs marked 0 to 9.

image

For example, when the counter has counted three input pulses, output 3 (that is, pin 7) is high, and the other pins are low. If you connect an LED to output 3, then when the counter is at three, the LED will turn on.

If you connect LEDs to several output pins, then as the counter increases, the LEDs turn on in order, according to their output pins. When the counter is at 9 and receives a 10th input pulse, it goes back to 0 and turns the output pins on in order again.

But the counter counts pulses only if pin 13 is low. This means you can use pin 13 to tell the game when to start moving the light across the LEDs and when to stop the light.

image

Each output has a resistor to reduce the current through the LED and make sure the LED doesn’t get destroyed. Because two output pins connect to each LED, the resistors keep the voltage to each LED high, even though one output will be low and one will be high. The resistors also ensure that two outputs aren’t connected directly together, which could damage the IC when one output is high and the other low.

A Latch to Start and Stop the Light

Do you remember the SR latch from “Saving One Bit at a Time” on page 240? The start/stop circuit for this game is a similar SR latch but built with two NAND gates. (The SR latch in Chapter 11 used NOR gates.)

The SR latch is a circuit that can remember a single bit. Its output is either 0 or 1, and it keeps that number until it gets set or reset with a new input.

You can create a circuit that tells the latch what to output with two buttons: one for setting the output to 1 and one for setting the output to 0. Using NAND gates instead of NOR gates means the buttons must make the inputs low to output a 1.

image

In this circuit, it doesn’t matter whether you click the buttons quickly or slowly. The 1-button always sets the output to 1, and the 0-button always sets the output to 0.

That’s perfect for the reaction game! Connecting the output to the start/stop pin, or pin 13, on the decade counter gives you a button for starting and stopping the LEDs.

PROJECT #23: AN LED REACTION GAME

It’s time to put all the pieces I showed you together to build the reaction game. This circuit has a lot of connections, but I know you can make it. Just don’t rush. Take your time and test each part of the circuit after the step where I explain how to build it.

image

I also recommend using a bigger breadboard than you’ve used in the previous projects, because this circuit is huge!

image

Shopping List

image

image A breadboard (Jameco #2212218, Bitsbox #CN204) with at least 60 rows.

image Breadboard jumper wires (Jameco #2237044, Bitsbox #CN236)—you’ll need around 35 for this project. Standard hookup wire works, too.

image A standard 9 V battery to power the circuit.

image A 9 V battery clip (Jameco #11280, Bitsbox #BAT033) to connect the battery.

image A 555 timer IC (Jameco #904085, Bitsbox #QU001) to create the timing.

image A 10 kΩ resistor (Jameco #691104, Bitsbox #CR2510K) to set the game speed.

image A 100 kΩ resistor (Jameco #691340, Bitsbox #CR25100K) to set the game speed.

image A 1 µF capacitor (Jameco #768183, Bitsbox #CC006) to set the game speed.

image A 4017 decade counter IC (Jameco #12749, Bitsbox #QU020) to control the LEDs.

image Two standard blue LEDs (Jameco #2193889, Bitsbox #OP033)

image Two standard red LEDs (Jameco #333973, Bitsbox #OP002)

image A standard green LED (Jameco #34761, Bitsbox #OP003)

image Ten 100 Ω resistors (Jameco #690620, Bitsbox #CR25100R) for limiting the current to the LEDs.

image A 4011 NAND-gate IC (Jameco #12634, Bitsbox #QU018) to create the SR latch for starting and stopping the game.

image Two 1 kΩ resistors (Jameco #690865, Bitsbox #CR251K) to act as pull-up resistors for the start/stop circuit.

image Two push buttons (Jameco #119011, Bitsbox #SW087), one for resetting the game and one for playing.

Tools

image

image A wire cutter (Jameco #35482, Bitsbox #TL008) to cut small pieces of wire.

image A multimeter (Jameco #2206061, Bitsbox #TL057, Rapid Electronics #55-6662) to debug your circuit if it’s not working correctly.

Step 1: Build the 555 Timer Circuit

Plug the 555 timer into the breadboard all the way at the top so that you’ll have room for the other parts of the circuits farther down. Then, connect the capacitors and resistors to the IC according to this project’s circuit diagram. The capacitor I suggest in this project’s Shopping List is a nonpolarized capacitor, so it doesn’t matter which way you connect it. If you use a polarized capacitor instead, connect it according to the plus marking in the circuit diagram.

Use wires to make connections as needed, as I show in this breadboard diagram.

image

In this project, it’s best to use the supply column pairs on both sides to make connections easier and keep everything as tidy as possible. The breadboard that I recommend in this project’s Shopping List doesn’t have blue and red markings, but the positive and negative columns are the same as in breadboards with the stripes. The left and right sides of the breadboard each have a pair of supply columns. The positive supply column is the left column in each pair, and the negative supply column is the right column in each pair. Use a red wire to connect the positive column on one side to the positive column on the other side, and do the same using a black wire with the negative columns.

As you follow my instructions, connect everything in the 555 timer circuit that should connect to VCC to one of the positive supply columns, and connect everything that should connect to GND to one of the negative supply columns.

NOTE

This circuit connects the 555 timer in astable mode, just like the 555 timer circuits in Chapter 8. Read “Meet the 555 Timer” on page 164 for a description of exactly how this IC works. You can also build the projects in Chapter 8 to practice using the 555 timer.

Before you move on to the next step, check that this circuit is working by connecting an LED with a resistor to the output of the 555 timer as follows:

  1. Connect the negative side (short leg) of an LED to the output on pin 3 of the 555 timer.

  2. Connect the positive side (long leg) of the LED to a 100 Ω resistor, and connect the other side of this resistor to the positive supply column.

  3. Connect your battery clip to one of the supply column pairs as usual. Then plug in the battery to check that the circuit works.

If your LED blinks really fast, then you’re ready to move on. If not, recheck your connections to find out where the error is.

When you know the 555 timer circuit works, unplug the LED, 100 Ω resistor, and battery clip.

Step 2: Build the LED-Controlling Circuit

Now, you’re going to connect the 4017 decade counter with resistors and LEDs. There are a lot of connections, so take as much time as you need to get them all correct.

Plug the 4017 decade counter into the breadboard so that the middle of the decade counter is around row 20, with the chip marker pointing up toward row 1. Then, take out five LEDs and ten 100 Ω resistors.

Connect each LED’s negative (short) leg to the negative supply column on the right, and connect each positive (long) leg to its own empty row in the component area on the right. Place the green LED in the middle, the two blue ones on each side of the green LED, and the red ones on each end.

Then, connect the ten 100 Ω resistors. In the circuit diagram, notice that pins 1 to 7 and pins 9 to 11 of the 4017 decade counter each connect to one side of a resistor. The other side of each resistor needs to be on a row by itself. Take care to ensure the resistor legs don’t accidentally touch one another. Look at the following breadboard circuit to see how I connected them:

image

Now, connect the LEDs to the resistors on the 4017 decade counter, and connect the decade counter circuit to the 555 timer circuit according to the circuit diagram. Jumper wires are the best way to make those connections.

From each resistor, connect a jumper wire to the corresponding LED. Look at the circuit diagram and notice, for example, that the other side of the resistor connected to pin 4 of the 4017 decade counter should connect to the positive pin of the green LED in the middle. Go through the pins in the circuit diagram to figure out which LED to connect each resistor to.

Connect pins 8 and 15 of the 4017 decade counter to the negative supply column, and connect pin 16 to the positive supply column. Use a wire to connect the output from the 555 timer (pin 3) to the clock input of the 4017 decade counter (pin 14).

Make sure that you have positive and negative connections in all of your power supply columns. The breadboard I recommend in this project’s Shopping List (page 267) divides its power supply columns into two sections, one upper and one lower. Just connect each of the upper and lower halves on the left side with a wire to bridge the gap, as shown. Do the same on the right side. Alternatively, use two jumper wires from the left columns to the right columns.

image

You can use a jumper wire, or you can cut off a small piece of wire, as I’ve done in this photo. Then, use two long jumper wires to connect the lower-left power supply columns with the two lower-right columns. When you’re done connecting the two circuits and all the power supply columns, your breadboard should look like this:

image

Before building the next part of the circuit, check that your LED-controlling circuit is working correctly, too. To test it, just connect pin 13 on the 4017 decade counter—that is, the “disable” pin—to the negative supply column with a jumper wire, and plug your battery clip and battery into the breadboard as usual. You should see a light “running” back and forth across the row of LEDs.

If no LEDs light up, first check that you’ve connected the 4017 decade counter with the notch pointing upward. Connecting the chip the wrong way is an easy mistake to make. I’ve done it many times!

Next, check that pin 16 of the 4017 decade counter is connected to the positive supply column and that pins 8 and 15 connect to the negative supply column. Also, confirm that you’ve connected the LEDs with their short legs in the negative supply column.

If some LEDs work and some don’t, or if the light doesn’t run smoothly back and forth, look over all the connections of resistors and jumper wires to find the fault.

After verifying that your circuit works, remove the wire connecting pin 13 of the 4017 decade counter to the negative supply column, and disconnect the battery from the breadboard.

Step 3: Build the Start and Stop Circuit

The last piece of this project is the button circuit that starts and stops the LEDs. Make these connections now:

  1. Connect one push button at the bottom of the breadboard, across the notch in the middle. Plug the 4011 NAND-gate IC into the breadboard, a couple of rows above the button. Make sure its chip marking points toward row 1 on the breadboard.

  2. Place the second button above the IC on the right component side so that it’s easy to reach it with your finger.

  3. Connect the two resistors, R13 and R14, as shown in the circuit diagram. Then, use jumper wires to make the remaining connections in the SR latch circuit, as shown in the following breadboard diagram. Connect the positive and negative supply columns to the NAND-gate IC (pins 14 and 7, respectively), and connect the wire from pin 11 of the NAND-gate IC to pin 13 of the 4017 decade counter.

Compare your connections to the following image.

image

Step 4: Practice Your Reaction Time!

All that’s left is to connect the battery to the supply columns. The button at the bottom of the board is the Reset button. Use this to start the game and to restart the game after each player attempts to stop the light.

The button next to the LEDs should stop the light when the game is running. See how many turns it takes you to get to 50 points!

Step 5: What If the Game Isn’t Working?

If you’ve followed my instructions so far, the circuits from Steps 1 and 2 should be working. If your circuit isn’t working, the only sources of error left are the start/stop circuit you just built and the connection from this circuit to the 4017 decade counter.

A. Check the Continuity

First, check that you don’t have a short circuit between the positive and negative columns. To do this, use the continuity function on your multimeter. A continuity test checks for a direct connection between two points in a circuit. The symbol for the continuity tester usually looks like the one shown here.

image
image

You don’t want a direct connection between the positive and negative columns because that would short-circuit the battery and stop the game from working. Use the continuity tester to check for short circuits.

Turn the dial on your multimeter so that it points toward the continuity symbol. Plug the black measurement lead into the multimeter’s COM socket, and plug the red measurement lead into the multimeter’s V socket. Touch the tip of the black and red measurement leads to each other, and you should hear a beep to indicate that there’s a direct connection.

NOTE

Many electronics enthusiasts also call continuity mode beep mode.

B. Check for Bad and Good Beeps

Now, plug your battery clip into the breadboard as you would normally, but without the battery. Touch one measurement lead tip to the positive connector and the other to the negative connector. If you hear a beep, there’s a short circuit, and you need to fix it! Check all your connections to the positive and negative supply columns.

image

Next, check the connection between pin 11 on the 4011 NAND-gate IC and pin 13 on the 4017 decade counter to make sure they’re connected correctly. Use the continuity tester to check that you have a connection by carefully touching the lead tips on the IC pins. There isn’t much space between IC pins, so take care to be sure each tip only touches the correct pin. This time, a beep is a good sign.

C. Check for Power

If the connection to the NAND-gate IC is correct, use a multimeter to measure the output voltage from the start/stop circuit to see whether it’s working correctly. Set your multimeter to measure voltage. Make sure the black measurement lead is connected to the multimeter’s COM socket, and the red measurement lead is connected to the V socket.

Touch the tip of the black lead of the multimeter to the negative side of the battery, and touch the red lead to pin 11 on the 4011 NAND-gate IC. You should see a high signal—about 9 V—after clicking the stop button and a low signal—about 0 V—after pushing the start button. If not, check the connections of the SR latch circuit to find the error.

TRY IT OUT: CHANGE THE LIGHT’S SPEED

To change the speed and difficulty of the game, play around with different values for R1, R2, and C1 around the 555 timer. Smaller values will make the game go faster. Larger values will make the game go slower. Flip to “How to Set the Output Speed of the 555 Timer” on page 166 for the calculations to figure out specific resistor and capacitor values based on the frequency you want. Note that R1 should not be less than 1 kΩ, as lower values might damage the 555 timer.

But what if you want to change the difficulty on the go? Just replace resistor R2 with a potentiometer. Then you can change that resistance value by rotating the potentiometer shaft, which changes the speed!

ADD A BUZZER TO YOUR GAME

Congratulations: You’ve finished the last project in the book! Now, it’s up to you to decide what to make next. If you’re not sure where to start, why not add more circuits to your reaction game?

The LED in the middle is where you want the light to stop, and I suggest adding a sound circuit to bring some excitement to hitting your target. To do this, you could use an active buzzer like the one in “Project #2: Intruder Alarm” on page 11, as shown in this partial circuit diagram.

image

The darker part of this circuit shows new components you’d need in order to add a buzzer to the reaction game project. The lighter components are just a section of the original circuit diagram.

Connect the positive leg of the middle LED through a 1 kΩ resistor to the base of an NPN transistor. Then connect the buzzer to the transistor’s collector. Connect the positive side of your battery to the other side of the buzzer, and connect the negative side of the battery to the transistor’s emitter.

You should end up with a circuit that makes a little beep every time the light passes the middle LED. If you can stop the light on the middle LED, the buzzer should beep continuously to indicate that you’ve hit the main target.

When you’ve customized the game to your liking, solder it onto a prototyping board. Maybe you’ll even want to place it in a nice box to hide the electronics and show only the buttons and LEDs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.1.57