Introduction: Arduino Shooting Target Game
This is a project that i made for my hobby of shooting with co2 guns. I needed a fun but a good game to work on my speed to shoot on targets. After a little googling on the internet i find some good projects but i'm going to do this project a little more advanced.
The goal is to have 4 custom made targets that are controlled thru a base that holds Arduino uno. On the 4 targets there will be sensors that reacts on vibration (Piezo) there will also be a led on all targets to indicate when to hit them.
Right now there is 3 games.
First there is Quickdraw (Shoot as fast as you can)
Then there is timed mode (shoot as many times you can in 10 sec)
Then there is Rapid Fire (Shoot 32 times on time
This version of the game will use wires to the targets, but i'm also working on an wireless model to the target.
What you need:
1x Arduino Uno
1x Arduino Uno prototype shield (I use wireless SD shield)
4x Piezo Element
4x Multilayer Ceramic Capacitors MLCC - Leaded 50volts 0.01uF 10% X7R
4x Carbon Film Resistors - Through Hole 1Mohms 0.05
4x Zener Diodes 5.1 Volt 0.5W 5%
8x Schottky Diodes & Rectifiers Vr/20V Io/1A BULK
4x Led diod (i use super strong clear blue model)
1x Serial LCD
4x 220 ohm resistor
4x Targets
And some wires and buttons
Step 1: Step 1: Making the Sensor
The first thing we are going to do is to build the sensors for the game.
For this we need some electric components to succeed. The Piezo is an great component, they can be a buzzer but they also can feel vibrations. When the vibration appear on the target the Piezo will send an signal to an analog pin on the arduino to inform that we made a hit on the target.
To protect the Arduino from high voltage that can come from the Piezo we need some components.
On each sensor we need
1x Zener diod,
2x Schottky diods,
1x 1mohm resistor
1x Capacitor
This components is for the Piezo part to protect the Arduino. Take a look at my schema how to connect them.
You start with one Schottky diod, then the Zener diod, then another one Schottky diod, after that the resistor and then the capacitor.
For the led i Recommend you to add a resistor for protection, i use 220 ohm resistor.
For connection i used 3.5 m.m female phono contacts. I used left for the piezo sensor and right for the led and then the ground for the ground. I also made my own cables from a phone cable so i have 12.5 meters cable to the sensors, but you can use audio cable also.
Make four of this sensor. I put them in a plastic case for protection. The Piezo sensor i placed behind the target, added some super glue on the back of them and i know electric tape is not the best solution but that was the only thing i got at home. Its for to hold the cables and protect the sensor.
Step 2: Step 2: Build the System
For the system I'm using a black waterproof case (i hade one at home that i didn't use) also i use 4 m.m. plywood to install the system on.
I have placed all the electronics on one side of the case, because i'm going to make a little hatch to store the targets inside also.
The LCD is an serial LCD it uses only 3 pins on Arduino.
Connect the ground to ground on arduino, the 5v to 5v out on arduino and the read pin to pin 1 on Arduino.
For the start and reset button i used Arcade buttons (they are big and i like them)
The reset button is added between the ground and the reset pin on arduino.
The start button is added between ground and analog 4 pin.
The game has a game switch to choose game mode. There are 3 types of games right now,
1. Quickfire
2. Timed mode
3. Rapid fire
For this i used a rotary switch to switch game mode.
They are going to be added to digital inputs on Arduino so the incoming signal is going to ground and the three game signal is going to digital pin 2, 3 and 9
The sensors are connected to the game thru 3.5 m.m female phono contacts, add 4 of them. To make it simple i did take an copper plate (the one you have when making pcb) and install them on. That way you don't need to add ground to all contacts sins the ground is in the chassi of the contact.
Connect the Piezo signal to Analog 0-3 and the led diods to digital pin 5, 6, 7 and 8 just remember that the sensor connected to Analog 0 is going to use the led pin 5 and so on.
For the power to the game, i have two options. I can switch between 9v battery and 9v from cable. For that i have also an rotary switch to choose how i will power the arduino. The i have connected the plus pole from battery to one pin on the rotary and the other pin is for the plus pole on the incoming cable (9v). And then it send away the plus pole signal to a power switch.
Take a look at the electric sheet for more detail connection.
Step 3: Step 3: Program the Arduino
It's now time to program the arduino.
Download the code and transfer it over to the Arduino.
Then the system is ready to use.
Please note how i write to my serial lcd, maby you need to change that so it will match your LCD.
Now you have made a shooting game. Feel free to visit my blog page for more info and to follow my development of wireless sensors for the game.
Arduino Shooting Game https://shootinggameblog.wordpress.com
21 Comments
Question 1 year ago on Introduction
I love the project, can you create a link to all the electronics you used? i live in the Netherlands and having trouble to find the right components.
Where do you use the uno prototype shield for i don't see it in the pictures?
I have created target on my 3d printer and am going to adjust to your software hopefully this will work....with a little help?
6 years ago
Hellow basen, i followed your tutorial, and made the game system, i uploaded arduino to my board, did all the wireing .
I only conected START button, THE KEY selects the game, a on off button , and the serial LCD. This is a test run. but i have a problem, i only get black dots on LCD, i have made photo and made a video so you can see. Tahnk you very much
I've checked the Serial monitor from ARDUINO IDE - and the project works...but nothing displayed on the serial LCD
Reply 6 years ago
hi there.
Check with the markers of your serial lcd on how you write to i.
There is different on different serial lcd. Or switch to an normal lcd and use normal (lcd.print("text")).
Sins you use mega you can use an normal lcd.
Reply 6 years ago
Thank you very much, can i send me link to ur specific LCD , i'm ver new at this, so i just copied ur work , but i don't know how to write on LCD , i saw on internet, but. it's very hard .. here is the LCD screen on ebay
http://www.ebay.com/itm/152134577072?_trksid=p2057..... if u check down the guy added a description
QUOTING SELLER "but with a little change in the init lines:
LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity
It is another great blue backlight LCD display. As the pin resources of Arduino controller is limited, your project may be not able to use normal LCD shield after connected with a certain quantity of sensors or SD card. However, with this I2C interface LCD module, you will be able to realize data display via only 2 wires. If you already has I2C devices in your project, this LCD module actually cost no more resources at all. It is fantastic for Arduino based project.
I2C Address: 0x27 ( addres can't be changed !!!).
Backlight (Black character on Yellow background)
Supply voltage: 5V
Size: 82x35x18 mm
Come with IIC interface, which can be connected by DuPont Line
Data Download
Test code
"
Thank you ...
Fl
Reply 6 years ago
You can use that one, just use the lcd.print("Hello, world!"); to print to the lcd.
First you need to add that library in top of the code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
Then in setup add:
lcd.init();
Then to print to screen write:
lcd.backlight(); //This if you want the backlight on the display.
lcd.print("Write text here");
And if you need an variable to be printed out for example:
int ExampleVariable = 212;
Then write like this:
lcd.print(ExampleVariable);
Hope i helped you good.
Best regards
Andreas
Reply 6 years ago
Thx Andreas i managed to get my lcd to print out diiferent things...
the only thing now is to manage and print out ...titles of the game modes...and how do i put in the the SCORE ..TIME and stuff...
Reply 6 years ago
I found out that my general ADDR was 0x3F i uploaded an example and the LCD works with the adress 0x3F , but now where do i change all of these stuff... remember my LCD is serial ..
6 years ago
Thanks for the game design works brilliantly! I converted the screen over to ic2 as you had the strangest LCD screen I've seen. I also added an additional 2 targets via a Mega board rather than uno. I'm working on a few extra game types that would use more than one LED to indicate a friend or enemy, I have just seen that you planned to add a few more LEDs to the wireless version to indicate connectivity and data transmission. How are you doing on the wireless project??
Reply 6 years ago
How did u convert to I2C ? i think i have same problem...if you can help . Thank you
Reply 6 years ago
Hi i have updated my game sins i post this here, upgraded to an mega to, and i have added an terminal printer to print the results, also upgraded to a bigger lcd, and added an sd card reader to store highscore. Your project with more leds sounds fun. Im still working on the wireless, i have made some prototype boards with the sensors and the nrf24l01 but still working on code. I took a little break but im going to start working again with it.
6 years ago
Great little project. Really wanting to make it and looking at sourcing the parts for it. Can you advise whether it's easy enough to modify to run off a 12V power source instead of 9V?
Reply 6 years ago
Hi, you can run with 12v because Arduino can handle 12v. i use 9v so i can run on battery.
6 years ago
Hi, I have also made the project, thanks for the design is the LCD you used IC2? I cant find an LCD that will operate with just 3 wires. I can find IC2 LCDs that require 4 wires is this what you have used?
Thanks again
Reply 6 years ago
Hi, no its a Serial LCD goggle on it, and you will find on eBay.
6 years ago
Hellow i followed this tutorial . At the moment i only have conected
Arduino + 16x2 Generic LCD + Potencimeter for lcd +switch control for game modes
I have conected GND to VDD and K
conected 5V+ to VSS and A
wire from pin Digital TX->1 to RW of lcd
my potenciometer conected to lcd
The switch button for game modes is propperly conected as u instructed in diagram
Uploaded your code..
NOTHING IS SHOWING ON SCREEN
( im trying this tutorial a step by step...cause i see ur diagram is off -- you dont have potenciometer for screen ... you dont have lcd conected in both sides of + and - only in VSS and VDD ) IM AM VERY NEW ... so excuse me
Reply 6 years ago
Hi, you need a Serial Lcd. A normal LCD don't work becouse they can't handle serial comunication. An Serial lcd has an extra chip on them so they can work with serial comunication.
Reply 6 years ago
can u link me to buy ebay one ? or somewhere does not matter if china cheap ones...if i manage to get the game working i will buy the best one :) GREAT PROJECT ..really....JUST EPIC
Reply 6 years ago
This is my sketch ... i'm only getting the colored pixels from putting the potenciometer at full
Reply 6 years ago
On the sketch i used an normal lcd becouse i didn't find any serial lcd in the software. The serial lcd has built in pot for the display and only have 4 connections. (5v gnd rx tx)
7 years ago
Great game design!