What do you need for this project?
Affiliate links are included on this website. Please support my future projects! Another way to support my work, and help yourself to free stuff at the same time, is to check out DigitalOcean with their promotional 2 months free hosting. If you haven’t yet heard of them, they are the best and cheapest virtual server on the market right now, the link is in the banner at the top of my site.
I was hoping to power the whole thing from 12 volts but the voltage regulator was getting a bit hot, and my main directive for this whole project is to use what I’ve got (otherwise I would have a relay shield like this one instead of the bare 5v relay which I had to trigger with a transistor).
- Breadboard http://s.click.aliexpress.com/e/KdMqDwrA
- D1 Mini: http://s.click.aliexpress.com/e/4Tb1vTn6
- D1 mini relay: https://s.click.aliexpress.com/e/_s05zgs OR:
- Relay: https://s.click.aliexpress.com/e/_sbpC45 OR:
- you can buy the relays in bulk really cheaply here: https://s.click.aliexpress.com/e/_sBPnJB
- More relays but 3v ones (if you use these just take out the transistor in my circuit): https://s.click.aliexpress.com/e/_shriep
- Solenoid valve like this: https://s.click.aliexpress.com/e/_s5P3Hj
Test out the breadboard:
Instructions for editing and uploading D1 mini code are on the first part of this series: https://www.circusscientist.com/monkey-detector-part-1:-detect-a-stuffed-toy-and-switch-on-an-led. The code is the same, it’s just a WiFi switch after all. This time we are switching a relay instead of an LED.
Now visit the IP address of the D1 Mini in your browser:
You should hear a click from the Relay when you select ON (Socket #1) – and if you have connected the Solenoid Valve to 12v you will hear a louder click from that. The circuit works!
Trigger from the Android App:
Edit the Monkey Detector Android App, changing IP address to the one of your D1 Mini, like we did in the Teddy Bear Detector, but this time we will not change the detected object. We want to detect monkeys. While you are waiting for this to compile, check out the version on the Google Play Store.
Point the phone camera at a monkey (monkey pics work fine) and you will hear an alert sound, as well as the relay and Solenoid Valve clicking open. Now all that’s left to do is to solder everything together inside a nice box with wires coming out and attach this to the sprinkler tap. No more monkey problem.
Coming soon: video evidence that this thing really works <YouTube Link >