After a neighbourhood dog decided my front lawn was a fantastic place to poop on and his owners decided that they don’t care for bylaws I set upon finding a solution. Sure you could try cayenne pepper, mothballs, ammonia or even marking your own territory (take that!) but I already had an IP camera monitoring my front yard for security purposes, so I figured I’d just hook up an Arduino and a sprinkler valve. This yard defense solution has two added benefits, it keeps my lawn healthy (I can set up timed watering through this system) and it sends offending dogs home stinkin’ wet. From me having to shovel dookie off my lawn to negligent owners having to deal with wet dog — perfect.
When the IP camera detects motion in configured regions of its video stream (the rectangles in the screenshot) it triggers one of its General Purpose Input/Output ports (GPIO). The Arduino is listening for this GPIO signal and once its received the Arduino triggers a relay which connects a 24v power supply to the sprinkler solenoid valve. The valve opens when 24v is applied to it and “sprinkles” whatever was responsible for the motion.
The TRENDnet IP camera I employed works great as it already records video of events to network or attached storage, sends email alerts with snapshots and allows manual triggering of its GPIO.
The TRENDnet monitoring plugin only works in IE but after some reverse engineering and C# coding I had an easy to use web interface for all browsers and mobile devices.
If there’s enough interest I’ll post circuit and wiring diagrams. Ensure the valves you get are non-latching 24v solenoids, some 9v valves seem tempting but are magnetic and require a more complex circuit.
Why Spaghetti? Watch more ATHF.
Parts
- Arduino (any old one will do)
- 10k resistor (for GPIO pull-down)
- 6v relay
- 24v adapter (for solenoid valve)
- 9v adapter (for Arduino)
- Orbit Watermaster 3/4″ 24v solenoid valve
- TRENDnet IP Camera w/ GPIO (I used an IP-422, keep your firmware up to date!)
Update: Some folks have asked why not just trigger the valve relay directly from the GPIO on the camera. This could’ve been done, but then I wouldn’t have gotten as much control as I wanted. This way I can configure timing to prevent the sprinkler itself from setting off the motion detector, set up timed watering as well as trigger other devices at various timings (DSLR for reaction shots). Another addition may be an XBee based remote control or hardwired buttons for various functions.
Update: I’ve added a quick circuit diagram and simple Arduino code.
Arduino Code
int gpioPin = 1; // GPIO input int val = 0; // value read from GPIO input int trigPin = 13; // solenoid relay output void setup() { pinMode(trigPin, OUTPUT); } void loop() { val = analogRead(gpioPin); // read the GPIO input pin if (val > 500) { // GPIO triggered, open the valve digitalWrite(trigPin, HIGH); } else { // GPIO off, close the valve digitalWrite(trigPin, LOW); } }
Great work! Would it be possible getting circuit/wiring diagrams?
Cheers and good luck with your future projects!
Sure, give me a week or so, the circuit is quite simple at this point.
Second request for the diagrams here! Just getting started with home projects and this would be the perfect thing to work towards. My goal is to stop the neighbourhood cats from leaving ‘gifts’ in the veg garden.
Which model of Trendnet camera did you use?
The TRENDnet TV-IP422W was the camera used.
Cool idea and good effort! I was wondering if you would share the “reverse engineering” work you’ve done to get the IP cam to work on other browsers (other than IE).. Thnks in advance!!
Where did you get that vintage intercom, and did you build the enclosure yourself?
I got the intercom from a well known electronic/junk/misc store called Active Surplus in Toronto.
Did you buy it that way with the wood enclosure?
I added the LEDs, a switch and some power adapter jacks, other than that the intercom is as I purchased it. It’s not real wood, it’s a fake veneer over chipboard I believe.