Anda di halaman 1dari 13


Final Project: Laser

Reaction Game
EE 330
Design a laser, build, and demonstrate a laser beam reaction
game to see how fast players can react to a sequence of visual

Nguyen, Minh C
and Daniel Mallek
Iowa State University

Page |1


Introduction ------------------------------------------------------------------------------------------2
Component Choice---------------------------------------------------------------------------2
Component list -------------------------------------------------------------------------------3
Data Analysis:---------------------------------------------------------------------------------3
Circuit Design:--------------------------------------------------------------------------------7

Iowa State University


Page |2

1. Introduction:
This project is to design a laser game which will randomly light up 9 LEDs one by one.
The user need to use a laser pointer to point at detectors, the detector detects the laser, then
that LED will be turned off and another LED is turned on. After the ninth LED is turned
off, the game ends, and the total reaction time will be recorded. In this project, there are 4
steps that we worked on: coding, packages choices and data analysis, circuit design, and
the last part is wiring and testing.

2. Components choice:
We have two basic components to our project: a counting circuit and a LED driving circuit.
The counting circuit consists of two binary counters and two BCDs with their associated 7
segment displays. We used several 7-segment displays, 7-segment driver, and binary
counters. We used the packages CD4055 as a 7-segment driver, 74LS93 as a 4 bit
binary counter
The LEDs need to be lit up in a random order and then turn off when their respective
photoresistor is hit by a laser. We are using a Microcontroller, a STM Nucleo F411RE, to
create random lights is the easiest way to do it because that microcontroller already has 9
analog pins, even though there are also other ways to do it. We are using photo-resistors
and regular resistors to make a voltage divider so we can detect the voltage changes
between the photo-resistor and resistor using microcontroller. A SCR can also be used to
reduce the power dissipation instead of a voltage divider, however, for this project a voltage
divider is sufficient.

Page |3

3. Component list:

STM Nucleo F411RE microcontroller

2 CD4055 7-segment drivers

2 7-segment displays

2 74LS93 Binary Counter

9 LEDs

Resistors and photoresistors

4. Data Analysis:
a. Binary counter74LS93:

Figure 1: Logic Diagram of 74LS93 Binary Counter

From the figure, there are two inputs, four outputs. If circuit requires 4 bit, the input B
should be connected to output QA. RO(1) and RO(2) are used to enable or disable the
bottom three flip-flops.

Page |4

b. 7-segment driver CD4055:

Figure 2: CD4055 Terminal Assignment

This 7-segment driver has 4 binary inputs, which means either the input voltage is or
to represent a 1 or a 0. It takes the binary number, and represents the corresponding
hexadecimal number on the 7-segment display. There are total 7 outputs which go to the
7-segment display.

Figure 3: Option for Biasing

The above are options for biasing out binary counter from the data sheet. The second option is
better for our design since we also need 5V to bias the many other circuits (the
microcontroller, the driver, etc.), so it is more convenient to have just one positive voltage

Page |5

Figure 4: Truth Table

This figure above is a truth table of 4 bits counting from 0 to A, but using as a timer
driver, we only need to count from 0 to 9 and then repeat the cycle. Then RO(1) should
be connected to QB, RO(2) should be connected to QD. This will make it reset after it
finished counting to 9. We have 2 binary counter so that we can count up to 99 seconds. We
feed 2 different clock to these counter, so one will count every second and the other counts
every 10 seconds, allowing us to count up to 99.

Page |6

c. 7-segments display:

Figure 5: Pin Assignment of 7-segment Display

7-segment LEDs are sensitive components which are easily burned if too much current
is passed through. PINs 2, 3, 4, 5, 7, 8, 9, and 10 are the input which are connected to
the output of driver. The highest voltage is 5V. From data sheet, it is also known that
the, voltage across the LEDs is 2V, the maximum current can go through LED is about
25 mA, which is shown below. Then it is easy to calculate the resistance range we can
add to connect the LED to the output of driver. We used 150 ohms resistors.
1. Binary counter test:
After building the circuit below, a 10Hz square wave is applied on the pin 14 so we can
actually see the LEDs change. When only LED0 lit up, it means that the binary number
is 0001; if LED0 and LED1 lit up, the binary number that represents is 0011; etc.

Page |7

5. Circuit Design:
In this section, the design of 3X3 grid of LED will be shown. In order to randomly pick
LED and detect the change of voltage, a microcontroller is used. There is a 3x3 grid of
LED and each LED in the grid has a corresponding photo-resistor near-by. Meanwhile, a
2200ohm resistor is in series with the photo-resistor. The reason why connect photoresistor and resistor in series is to make a voltage divider.

Page |8

6. Software:
The software for this project was written in C for an STM32F411RE microcontroller.
The software is written to generate a random order for the LEDs to light up in, and be
able to detect when the laser lands on the photoresistor. Each time the laser hit an LED, it
will turn off the corresponding LED, and turn on the next random LED, until it cycles
through all 9 LEDs. While the microcontroller is controlling the LEDs, it simultaneously
provides a 1Hz and 1/10Hz clock signal, which it feeds to the binary counters, which in
turn count up on our 7-segment displays. It is able to generate a clock signal while
running other code because it uses the on chip PWM hardware to generate a signal, which
only requires initial setup. When all of the LEDs are cycled though, the clock signals are
stopped, and the 7-segment displays will show the amount of time it took to complete the
game. Below is our code.

Figure 6 - The development board we used to complete this project, a NucleoF411RE. It utilizes an ARM STM32F4

Page |9

P a g e | 10

P a g e | 11

P a g e | 12

7. Conclusion
The objective of this project was to create a laser reaction game. Using a combination of
hardware and software, we were able to complete this project.