Project tutorial
Motion Sensor Water Gun

Motion Sensor Water Gun © GPL3+

Soak your unsuspecting friends with a motion-activated water gun!

  • 14,941 views
  • 4 comments
  • 29 respects

Components and supplies

Ard nano
Arduino Nano R3
×1
13285 01
PIR Motion Sensor (generic)
×1
Adafruit industries ada64 image 75px
Solderless Breadboard Half Size
×1
Fairchild semiconductor pn2222abu. image
General Purpose Transistor NPN
I used the 2N3904
×1
08377 02 l
Resistor 330 ohm
Does not need to be exactly 330 ohm, slightly larger or smaller values also worked.
×1

Necessary tools and machines

Lasercutter
Laser cutter (generic)

About this project

Overview

This project was inspired by Tinkernut's Arduino Motion Detecting Squirt Gun:

I wanted to replicate Tinkernut's project but the problem was that I could not get my hands on a Raid Auto Trigger because it is not available in China where I was living. However, a quick search on Taobao.com led me to discover this interesting product:

Very similar to the Raid Auto Trigger and at the reasonable price of ¥78.80 I decided to purchase one. It turned out to be considerably easier to hack since you did not need to tamper with any of the internal components. You only needed to modify the push button so that it was breadboard/Arduino compatible. If you happen to live in China (or if Taobao ships to your country) you can purchase the squirt gun here.

We turned this into a workshop, hence all the powerpoint slides and big text.

STEP 1: Hack the water gun

STEP 2: Interfacing with the Arduino

Set up and test the PIR motion sensor with the Arduino Nano.

/* 
* PIR sensor 
*/ 
int calibrationTime = 10;    //the time we give the sensor to calibrate (10-60 secs according to the datasheet) 
int outputPin = 2;                // choose the pin for the LED 
int inputPin = 4;               // choose the input pin (for PIR sensor) 
int pirState = LOW;             // we start, assuming no motion detected 
int val = 0;                    // variable for reading the pin status 
void setup() { 
 pinMode(outputPin, OUTPUT);      // declare LED as output 
 pinMode(inputPin, INPUT);     // declare sensor as input 
 digitalWrite(outputPin, LOW); //prevents gun firing at powerup
 Serial.begin(9600); 
 //give the sensor some time to calibrate 
 Serial.print("calibrating sensor "); 
   for(int i = 0; i < calibrationTime; i++){ 
     Serial.print("."); 
     delay(1000); 
     } 
   Serial.println(" done"); 
   Serial.println("SENSOR ACTIVE"); 
   delay(50); 
} 
void loop(){ 
 val = digitalRead(inputPin);  // read input value 
 if (val == HIGH) {            // check if the input is HIGH 
   digitalWrite(outputPin, HIGH);  // turn LED ON 
   if (pirState == LOW) { 
     // we have just turned on 
     Serial.println("Motion detected!"); 
     // We only want to print on the output change, not state 
     pirState = HIGH; 
   } 
 } else { 
   digitalWrite(outputPin, LOW); // turn LED OFF 
   if (pirState == HIGH){ 
     // we have just turned of 
     Serial.println("Motion ended!"); 
     // We only want to print on the output change, not state 
     pirState = LOW; 
   } 
 } 
} 

Use the serial monitor to check that it's working, and then it's time to connect the water gun.

Set up the transistor and resistor like so:

And with that you should be have a working motion-soaker! We used a laser cutter to make a wooden enclosure (since it's very fast and we needed a bunch of them for the workshop), but you could use a 3D printer as well.

Keep in mind, I have put in a 10-second delay in the code so as to allow the motion sensor to calibrate.

Comments

Similar projects you might like

Complete Digital Clock Including Alarm and Motion Sensor

Project tutorial by LAGSILVA

  • 12,677 views
  • 11 comments
  • 50 respects

Touchless Automatic Motion Sensor Trash Can

Project showcase by Will Su

  • 19,788 views
  • 17 comments
  • 34 respects

Coolest Motion Detection Sensor ever

by remnis

  • 8,138 views
  • 2 comments
  • 8 respects

Getting started with IMU (6 DOF) motion sensor

Project tutorial by Aritro Mukherjee

  • 72,586 views
  • 19 comments
  • 42 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by Team IoTBoys

  • 35,608 views
  • 11 comments
  • 15 respects
Add projectSign up / Login