Introduction: Wireless Arduino Shooting Game
This is an game i made for me to shoot at targets with CO2 guns. My other instructable is to my first version of this game, but with cable and hosting on an Arduino Uno.
This version is a little more bigger and is wireless and cable possible.
The goal with this project is to have an electronic game to shoot at targets. Three game types:
- Timed mode
- Rapid fire
It's about the same as my last one but this time it's hosted on an Arduino Mega and i have expand it to save highscore, possible to print result out of an terminal printer, and there is an bigger lcd display.
For updated info and source code to program your arduinos please visit: https://shootinggameblog.wordpress.com
Each targets has Arduino Nano to control the NRF24L01+ transmitter and the sensor to sense a hit.
Follow my guide step by step and you can have your own wireless shooting target game.
This is what you need to make the game:
- 4 shooting targets
- 1 Arduino Mega
- 4 Arduino Nano
- 2 10K Ohm resisto
- 4 Piezo Elements
- 4 Green, Red & Blue led
- 5 nRF24L01+ Transmitter
- 220 ohm resistors
- 100 uF capacitor (for the transmitter)
- 8 Schottky Diods 1N5817
- 4 Zener Diods TZX5V1B-TAP
- 4 1M Ohm Resistors
- 4 Ceramic Capacitors 0.01 uF
Step 1: Making the Wireless Sensors
You can make the sensors either by placing them right on the target with all electronic inside. Or just the cable sensor version where you place an cable (3.5 mm phono) between the target and the transmitters. (this version i use now)
The sensors is loaded with target code, each sensor have unique numbers to listen to so they know when they will be activated. There is just one code needed. All you need to do is to change on top in the code DEFINE SENSOR1 to the specified sensor. The system is built for 4 targets.
The code is available on GitHub.
The piezo is used to feel the vibration on target. When the bullet hits the target, the vibration will inform arduino that an hit is made.
The wireless sensor have three leds (depending on how you build them. The red one is for to indicate that there is problem transmitting, the green one is for success transmitting, and the blue to inform you that target is activated.
When the game send out an signal, the arduino will go in an knock loop to wait for the piezo to inform the arduino that an hit is made. When the hit is made it will start sending back an special code to the main system that is waiting for the transmitter. Follow the electric sheets to make the sensor, and flash the arduino with the software.
Your target is then ready, and you can use cables also if you don't want wireless sometimes.
Step 2: Making the Main System
The main system i have build inside a water proof case.
- It has 4 push buttons
- Two rotary switchs
- One power button
- A battery holder
- 4 phono contacts
- 20x4 lcd display
- Terminal printer
- RTC module
- SD Card module
- 1 Transmitter
This is the main system that holds the game. You can use it with wireless or with cables. Follow the electric sheet to connect everything.
What it have is three game modes:
- Quickdraw (Shoot as fast as you can on the right target)
- Timed Mode (Shoot so much you can in 10, 20 or 30 sec)
- Rapid Fire (Hit 6, 10, 20 or 32 targets on fastest time)
I have made it possible to run on 9v power and 9v battery.
The terminal printer is to print out the result for a game, it even store the high score on an SD card.
It's important to place an capacitor on 3.3v and ground on the transmitter or else you will get problems with transmitting due to powerlost. Also there is good to shield it with aluminum foil to protect it so the other electronic don't disturb the transmitter. (Don't forget to take some plastic foil first on it. I have written more about this on the blog page (link on top.)
Visit my blog page for get updated info on the game, and the source code to program your arduino.
Step 3: Use the Game
When you build everything there is just one more thing to do, play with it. And always wear protection when shooting.
When you startup the game, you will have to choose if you are going to use wireless or cable.
If you are going to use wireless, start the sensors first, and then the game.
After selecting the wireless mode, it will send an test signal to each sensor to confirm that they got connection.
What it does is that the main system will send out an code, each sensor have there own code. And when they get the right code they send another code back to confirm.
Now you can play, select game and start playing with the game switch and press start button.
There is an menu button also (by pressing the OK button) where you can setup options for game, see high score, set the clock and other stuff.
When a game is finish you get an option to print out the result for the game if you use the terminal printer.
If you are going to use the cable version, insert the 3.5 mm phono cables to the sensors and then in the main system.
And on the startup you choose the cable version.
Good luck and if you have any question write an comment or send me an mail.
We have a be nice policy.
Please be positive and constructive.