Extreme Paintball Mods -Using a laser sensor and motion detector to fire a paintball gun.
Registered Users: 62
Users online: 0
 Home  Game Reservations  Members  Team Roster  Matches  Photo Galleries  Articles  Forums  News  Newsletters  Contact  Events  Enlist  FAQ's  Paintball Resources  Map and Directions

 

Cynergy vs ?? = WIN! Cynergy vs ?? = WIN!
Home >> Article >> Building a laser based motion detector to fire a paintball gun
  Building a laser based motion detector to fire a paintball gun
This is a detailed overview of our news release, Motion Detecting, Laser Activated X7 Mod video. 

Here's the entire "Making of the Laser Sensing, Motion Detecting Tippmann X7" Video.


This article details how to set up a Laser sensor as a motion detector and then fire your paint ball gun when ever the plane bewteen the laser and your gun is intruded by an object, like an unsuspecting maggot trying to breach your paintball fort. 

OK, so here's the details.  This laser sensor motion detecting paint ball trigger was programmed using the BASIC Stamp 2 micro controller manufacturered by Parralax.


I picked up the kit at my local radio shack, and choose the kit for three reasons.  First of all, I could program the board on my own pc, and for $65 this alone made the purchase well worth it.  Next it came with a great instructional book "What is a micro controller".  The book gave me step by step instructions on how to program the controller using the P BASIC 2.5 programming language.  In particular, Chapter 5 walked me through programming the Servo, and chapter 7 walked me through programming the photo resisitor.

A microcontroller in short is a electronic chip that controls other languages.  The servo is a motor, and the one that came with this kit had four arms, which rotated about 180 degrees.  To better understand a servo, just think of the motor in a remote control car that turns the wheels left and right to steer.  Same thing here.  I configured the Servo using the layout in Chapter 5 of the book. 

Next, I went on to chapter 7 that explains how to use a little electronic device called a photo resistor to measure the intensity of light.  By adding the configuration shown in Chapter 7, the normal house lamps in my house showed an intensity of 300.  Moving the lamp very close to photo resitor raise the intensity somewhere around 50.  Finally, using the laser sight that came with my X7 Egrip Sniper kit, I was able to get a reading of 1. 

Using the chip I programmed the Basic Stamp 2 Module to sense at least  three consecutive seconds of direct laser contact before entering into "Fire Mode".  This would allow me plenty of time to point the laser at the photo resistor and mount it, with out the gun firing at me (or the walls inside my house, (yes there's paint on my wall now).

Once in firing mode, I programmed the micro controller reads the strength of the photo resistor 20 times a second checking to see if the value drops.  Once the controller detects the intensity of light from the laser beam has dropped it begins spinning the servo, which in turn pulls the trigger on the X7.

With the extremely light amount of pressure need to fire the X7's Egrip, the server simple spins less than one quarter of a turn in each direction, in effect firing 10 times, in about one second of time.  After firing, it pauses about 1/2 a second and begins detecting the sensitivity of the light again.  It is programmed to fired burst so it can take out a target with wasting to much gas or paint.

So But what happens if the gun is knocked over during play, or something permanently obstructs the path between the laser and the photo sensor?  I solved this one by programming the gun to fire and poll for the laser up to five times per obstruction.  After the fifth round of firing, the controller then re runs its main logic.  If you remember, when this code initially launches, it needs to detect direct laser contact for 3 consecutive seconds before re-entering "fire mode".

And for one last twist, I went back though my program and randomized the timing.  So the first time the code enters fire mode may take 3 seconds, and the second may only be 1/2 a second and the third may be 2 seconds, and so on choosing an random "read timeout" each time.  To cap it off, the number of rounds fired before re-initializing has also been randomized.

Here's the Basic Stamp 2 P Basic 2.5 microcontroller source code:

'--------------------------LaserDetectandFire.bs-----------------------------
' Detects Laser and Fires when Laser contact is broken.

' {$STAMP BS2}
' {$PBASIC 2.5}

'DEBUG "The LED is Connected to Pin 14"
time VAR Word
set VAR Word
firecount VAR Word
firecount = 0
counter VAR Word
lasercounter VAR Word
go VAR Word

' -----[ Subrountine Main ] --------------
GOSUB init
END
Init:
firecount = 0

set = 0
DO
GOSUB DetectLaser
FOR lasercounter = 0 TO 4
IF (go =1) THEN
DEBUG HOME, "go=", go, CR
GOSUB DetectLaser
ENDIF
NEXT

IF (go=1) THEN
DEBUG HOME, "Initiailized ", DEC5 time, CR
set =1
GOSUB main
ELSE
DEBUG HOME, "Detecting laser ", DEC5 time, CR
ENDIF
LOOP UNTIL set =1
RETURN

DetectLaser:
HIGH 2
PAUSE 500
RCTIME 2, 1, time
IF (time < 5) THEN
go =1
ELSE
go = 0
ENDIF
DEBUG HOME, "Light ", DEC5 time, CR
PAUSE 20
RETURN
Main:


DO
HIGH 2
PAUSE 10
RCTIME 2, 1, time
IF (time >5 AND firecount < 5) THEN
DEBUG HOME, "Fire = ", DEC5 time
GOSUB fire
ELSEIF firecount < 4 THEN
'GOSUB fire
DEBUG HOME, "time = ", DEC5 time , CR, "Fired ", DEC firecount
ELSE
DEBUG HOME, "time = ", DEC5 time , CR, "Fired ", DEC firecount
ENDIF
LOOP UNTIL firecount > 4
GOSUB init
RETURN

Fire:
HIGH 2
PAUSE 10
RCTIME 2, 1, time
FOR time = 1 TO 10
'DEBUG HOME, "Counterclockwise 10 o'clock.", CR
FOR counter =1 TO 3
PULSOUT 14, 900
PAUSE 20
NEXT

'DEBUG HOME, "Clockwise 2 o'clock.", CR

FOR counter =1 TO 3
PULSOUT 14, 700
PAUSE 20
NEXT
NEXT

'Reset the Servo to non firing position
DEBUG HOME, "Center 12 o'clock.", CR
FOR counter = 1 TO 25
PULSOUT 14, 900
PAUSE 20
NEXT
' Turn off the LED to Save battery power
LOW 14

firecount = firecount + 1
DEBUG HOME, "Fired ", DEC firecount, " times"
' wait on second before returning.
PAUSE 1000
RETURN
' -----------------------------End LaserDetectandFire.bs---------------------



Comments (6)

Posted By James on 11/26/2007 9:28:00 PM
Wow, that is awesome..
Posted By faluj on 11/26/2007 9:49:00 PM

Gives me some ideas, especially after reading this..

http://www.engadget.com/2007/11/26/automated-paintball-gun-keeps-the-residence-secure/

Posted By Carl on 11/29/2007 3:42:00 PM
Sounds extremely unsafe.
Posted By Alex on 12/5/2007 1:52:00 AM

In its current state it could be unsafe. I am working on some mods taking suggestions from users on forums, blogs, and YouTube that have watched this video.

Posted By Carl on 12/18/2007 3:50:00 PM
No, I meant just generally unsafe. It is like the reason that blindfiring is not allowed, you can't see what it's shooting at. If the ref calls to stop the game because some kid took off his goggles, it can't recognize that the game has stopped and could shoot at the goggleless player. Or is a pedestrian who doesn't know better walks by, and is shot by it
Posted By Sergio on 2/21/2008 4:46:00 PM

WOW seireasly you should like give me one