DIY Arduino Laser Pointer Shooting Game
by mircemk in Circuits > Arduino
605 Views, 6 Favorites, 0 Comments
DIY Arduino Laser Pointer Shooting Game
This time I will show you how to make a simple but addictive game for one or more players. The game consists of the following:
We have five blue LEDs that light at random order and intervals. Under each LED is a photoresistor that is actually a target. The object of the game is to shoot the LDR (target) under the active LED with a light beam from a laser pointer. As soon as you hit this LDR, the corresponding LED goes out. You need to shoot as many targets as possible.
This project is sponsored by PCBgogo:
https://www.pcbgogo.com/promo/from_MirkoPavleskiMK
You get one point and one more shot for each destroyed Target (at the beginning of the game you have 5 points). The game is lost if you fail to shoot down a target (too slow) or if you run out of ammunition. The course of the game is accompanied by appropriate sounds for the start, hit the target, or end of the game. Basically, the code is taken from the elektro.turanis.de site, and I added an I2C LCD display so that instead of the serial monitor, the result is displayed on the display, so now this is a standalone device.
Parts and Building
Otherwise, the device is very simple to make and contains only a few components:
- Arduino nano microcontroller
- 16x2 I2C LCD display
- 5 LEDs
- 5 LDR resistors
- momentary switch
- and 10 resistors
LDR resistors have a resistance of about 2 kiloohms in normal lighting and about 300 ohms when illuminated with a laser pointer. Consequently, the resistors connected to them should have a resistance in the range of 680 ohms, up to 1.2 kiloohms. Depending on the type of LDR resistors used, this value may vary. Otherwise, for this project, it is best to make a custom PCB on which the Arduino and all the resistors and components will be mounted, so we will have greater visibility in case there is a need for any intervention. For that purpose, you can visit my sponsor PCBgogo. They offer 24 hours expedited service. Make your PCB on the link in the description.
Schematic and Code
Immediately after switching on, all LEDs start flashing and together with the corresponding sounds mark the beginning of the game. The end of the game is also marked by flashing all the diodes, and the LCD display shows the result in the form of points. For a new game, you have to press the Start button.