Laser Shoot-Out Game
System Block Diagram
Our project is to design and build a laser shoot-out game, in the manner of mythical old west "quick-draw" contests. The game will consist of two players standing across from each other and using harmless laser weapons to shoot at each other. Each player will wear a reflective vest to reflect laser signals so they may be detected by the transmitting weapon. The following narrative discusses the hardware and software components and subsystems of the project.
Hardware
The system consists of one central controller, and a weapon and display board for each player. Figure 1 gives an overall block diagram of the main hardware components and its subsystems.
Central Controller
The central controller starts the games and decides which player wins the game. The central controller consists of a microcontroller, a serial communication unit, and a user interface. The user interfaces are a power and a reset button. The serial communication unit allows the microcontroller to talk to the display units.
Display Boards
The displays are small scoreboards located near each player. They communicate with the weapons and the central controller, and display game information (See table 1). The display consists of a serial communication unit, a user interface, a speaker, a microcontroller, and an RF receiver. The serial communication unit allows communication between the microcontroller in the display and the microcontroller in the central controller. The RF receiver allows the weapon to talk to the display board. The user interface is several LED’s and LCD’s that display game information. It displays a light if the system is ready. The LCD displays the ammo count and a countdown to begin the game. The LCD also displays the result of the game when it is over. The speaker makes a noise when the gun is fired. There are also several buttons in the user interface for power and reset. When the system is set up, the Display ID may also be set to match the Weapon ID of a weapon, so the wireless communication may be synchronized.
Weapons
The weapon is a portable, wireless unit. It consists of a RF transmitter, user interface, microcontroller, laser transmitter, and laser receiver. The RF transmitter sends information to the display. The user interface has several LED’s that represent battery power, low power, and out of ammo. The user interface on the weapon also has buttons for the hammer, trigger, and weapon reset. The laser transmitter sends out the laser when the microcontroller tells it to. An opponent is hit if the laser reflects off of their vest and returns to the firing weapon. The laser receiver detects the reflected laser and informs the microprocessor to indicate a hit. Each weapon’s ID should be set to match a display’s ID, so that when it sends data, the correct display will receive it.
Software
Figures 2 through 4 show the proposed software flowcharts for this project. There are three separate algorithms, one for each microcontroller-driven component: the central controller, the display boards, and the players' weapons.
Central Controller
Figure 2 shows the software flowchart for the central controller. This is a simple algorithm: When the system is turned on or the master reset button is pushed, the processor will first initialize itself. It will then transmit a signal to the display boards, telling them to reset, in preparation for a game. The processor will then wait for the displays to respond with ready signals. After both display boards are ready, it will broadcast a "game start" signal, and let the other microcontrollers run the game. The central controller then waits for one "hit" signal (a game victory) or two "out of ammo" signals (a tie) from the display boards. When one of these situations happen, the central controller broadcasts the game results, and waits for the next game.
Display Boards
The algorithm for the display board is shown in figure 3. When a display board is turned on, or when it receives a "reset" signal from the central controller, it will power-up and initialize, clearing the LCD display. It will then wait for a "game start" signal, which is generated by a player pushing a button on the display board. It will also wait for a "gun ready" signal from the player's weapon, to ensure that the wireless communication link works. After that is received, the display board transmits a ready signal to the central controller, and when the central controller responds with its "game start" signal, the game begins, and the display will show a countdown for each player to draw their weapon.
At this point, the display board's microcontroller waits for further communications from the weapon or central controller. As the interrupt-handler flowcharts show, if a signal is received from the gun (shot, hit, or out of ammo), the processor will take the appropriate action. Also, when a signal is received from the central controller (Game reset, win, loss, or tie), the processor will perform the necessary end-of-game actions and return to waiting for a new game.
Weapons
Figure 4 shows the flowchart for each weapon's microcontroller. Because the gun has a wireless transmitter but not a receiver, it operates in isolation and transmits signals that the display board will analyze for the game. Each signal is prefaced by the weapon’s Weapon ID (set to match a display’s ID) so that the matching display will know it’s being addressed. When the weapon is turned on, it initializes and waits for the "gun reset" button to be pushed. When this occurs the weapon transmits a "gun ready" signal so the display board can verify the wireless transmission. Then the gun is ready to fire. When the hammer is "pulled" and the trigger pressed, a "shot" signal is sent. The microcontroller then uses the laser to transmit a pulse. If the pulse is reflected and received properly, a hit is scored, and a "hit" signal is sent. Then the microcontroller returns to waiting for another trigger-pull or reset. There is also an interrupt handler in each weapon to light a "low power" LED and warn the display if the battery voltage falls below a certain minimum level.
Table 1 - Description of Inputs and Outputs
Signal Name |
Input/Output |
Description |
Central Controller |
||
Power |
Input |
Power provided by a wall outlet |
Reset Central Controller |
Input |
Button pushed to reset the entire game |
Displays |
||
Power |
Input |
Power provided by a wall outlet |
Disaply ID |
Input |
ID Number to match Display and Weapon |
Begin Game |
Output |
Row of LED’s counts down to game start |
Speaker |
Output |
Makes sound effects for gun noises |
Ammo Count |
Output |
Displays remaining ammo count on LCD |
Win/Lose |
Output |
Displays outcome of game on LCD |
Weapon Ready |
Output |
LED lights up from when the weapon is reset until the game is over |
Weapons |
||
Battery Power |
Input |
Power provided by a battery |
Reset |
Input |
Button pushed to reset gun in order to start game |
Hammer |
Input |
Button pushed to cock the gun |
Trigger |
Input |
Button pushed to fire the gun |
Laser Receiver |
Input |
Sensor used to detect reflected laser beam |
Weapon ID |
Input |
ID Number to match Display and Weapon |
Laser Transmitter |
Output |
Emits laser beam when the gun is fired |
Low Power |
Output |
LED lights up when battery voltage is low |
Power |
Output |
LED lights up when gun is on |
Table 2 - Coaxial Cable Signal Description
Signal Name |
Direction |
Description |
Game Reset |
From Central Controller to Displays |
Resets entire system |
Game Start |
From C.C. to Displays |
Starts countdown to beginning of game |
Game Winner |
From C.C. to Displays |
Reports game outcome |
Display/Gun Ready |
From Display to C.C. |
Tells C.C. that display and weapon are ready |
Target Hit |
From Display to C.C. |
Tells C.C. that player hit opponent |
Weapon Out of Ammo |
From Display to C.C. |
Tells C.C. that player has shot all six rounds |
Table 3 - RF Link Signal Description
Signal Name |
Direction |
Description |
Weapon Reset |
From Weapon to Display |
Tells display that weapon and player are ready to start a game |
Weapon Fire |
From Weapon to Display |
Tells display to decrease ammo count and make gunfire sound effect |
Target Hit |
From Weapon to Display |
Tells display that player hit opponent |
Low Power |
From Weapon to Display |
Tells display that weapon battery voltage low |