OPEN LASER BLASTER
Quick edit:
I just realized I never included the link to the STLs so here they are:
https://www.thingiverse.com/thing:4305060
Have fun
-
Hello, this tutorial is going to show you how to make your own laser blasting game.
This project requires some basic knowledge of the Arduino platform. Soldering isn't not required if you use mini breadboards and female to male pin headers., but some basic soldering skills will be necessary if you want to make this project definitive.
I started this fun little project as a quick weekend home hackaton for my son, I just wanted to make a cardboard laser blasting game, but this project quickly grew to become what it is now.
What can you do so far:
Blaster:
_ Switch from 10 shooter mode to fully automatic blasting by pressing the trigger as it loads
_ Change the number of shots in single mode (in Arduino code)
Target
_ Switch between desktop to wall mode
BLASTER AND TARGET DESIGN
I made this model to be the most open possible, feel free to use any breadboards, boards or sensors you like. Everything will fit as long as you have a glue gun and zip-ties.
Print the Models
Link to STL:
https://www.thingiverse.com/thing:4305060
for these models, I use:
Rafts:
No
Supports:
Yes
Resolution:
0.2 Layer Height
Infill:
10%
Filament_brand:
any
Filament_color:
any
Filament_material:
PLA
Notes: Print these models as you wish, but I prefer to use support in for the base and target
Step 1: Gather the Hardware
LASER BLASTER:
Dev board:
Arduino Nano
any Arduino compatible microcontroller should work fine
5V Red Laser (KY 008)
The type of mini 5mw laser you get in the sensor kit
Push button:
I like the arcade style button because they have a screw in ring that will fit the trigger space of the blaster
Mini speaker.
Any type will do even the cheapest
Transistor 2N2222A
for better control of the laser and also for cheap force feedback (to do!).
9v Connector
To connect your battery to the Nano's Vin
Resistor:
One 1.5k Ohm resistor to trigger the transistor
Slide Switch:
any slide switch will work
LASER TARGET:
Dev board:
Arduino Nano
Photoresistor:
Any LDR will work for this project
Servo:
any SG90 9G Servo will be fine
Neopixel Ring:
I'm using a 24 LED pixel ring for this project
Push button:
a 12mm flat button to control the modes
Resistors:
We will need two resistors, one 10K Ohm for the LDR and 470 Ohm to smooth the Neopixel's data
Capacitor:
One 1000 µF, 6.3V will keep your led ring alive and happy
Optional
Mini speaker.(optional)
Any type will do (not implemented yet)
Download Arduino and Servo Library
Arduino IDE:
Download and Install it, we will only require one external library:
https://www.arduino.cc/en/main/software
Library:
PWMServo
I'm using the fantastic servo library from Paul Stoffregen
https://github.com/PaulStoffregen/PWMServo
(installing Arduino Libraries)
Music:
TUNES: Thanks to Robson Couto for his Arduino tune
ARDUINO SONGS
DOWNLOAD CODE
Codes were written for the Arduino Nano Board
Connect It All - LASER BLASTER
BLASTER CONNECTIONS
PIN 10 >> Push button pin
PIN 5 >> 1500 Ohm resistor >> Transistor base pin >> LASER PIN
PIN 8 >> Speaker pin //
Connect 9V >> (+) TO VIN ] - [ (-) TO GND
Download the codes:
Connect the trigger pushbutton to between pin 10 and ground.
Add the transistor. Connect its Base to a 1.5K Ohm resistor then pin 5. connect the emitter leg to the ground rail and the collector to the signal pin of the KY-008.
Connect all components as shown in the first image, upload the codes, If everything is well connected, you should hear the friendly Super Mario tune.
Connect It All - LASER TARGET
TARGET CONNECTIONS
PIN 5 >> Button pin
PIN 6 >> 470 Ohm resistor >> Neopixel pin
PIN 9 >> Servo pin (usually yellow cable) // (+) >> VIN || (-) >> GND
PIN A0 >> LDR pin << 1OKOhm resistor >> GND -- other pin to 5v
Connect the PUSH button between Pin 5 and ground.
Connect a 470 Ohm resistor from Pin 6 to the DIN pin of your Neopixel ring. Do not connect the ground and 5v yet, leave them out.
Make sure the LDR resistor is connected correctly between the ground and pin A0. The other legs goes to the 5V rail of your breadboaed.
Add a 1000µF cap between Ground and 5v Pin.
Connect the servo, positioning it with the moving arm toward the inside of the base print.
Download the library PWMServo and install it.
(installing Arduino Libraries)
Upload the blaster's code to the Nano. Once the code is uploaded the servo should reposition itself. The last position it takes should be the same as when the target is up (sometime the movement will be erratic, push the reset button a few time to see if it position itself, if not check the powering).
Turn on your smartphone flashlight and bring it to the LDR, the servo should move from down to up position.
Plug the Neopixel's ring ground and 5V, press reset. if everything is connected you should see the LED come to life and the Servo move to reset itself.
Use your smartphone light again, you will see the LED ring start moving as if it was hit, so will the servo.
If the servo is jittery or acting weird, check if it's receiving enough power.
Download and Compile Codes
BLASTER
The blaster is easy to use, you press the trigger, it shoots the laser. But I wanted to make it a little bit more fun so I created two shooting modes. When you turn it on, it will start in 10 shooter mode, for every ten shots you'll have a reload time.
For those like me who aren't sharp shooters, if you press the trigger while it boots, you will be able to go into Stormtrooper mode.
If 10 bullets is too much or too few please modify this line in the code with the number you will like
int bulletNumber = 10; // CHANGE THIS IF YOU WANT MORE BULLETS
TARGET
The target has two modes for those like me who would like to hang it on the wall, by pressing the button the position of the target will switch from table to wall mode.
Have Fun
This is a work in progress, so let me know if you have any ideas to make it better.