Vegetable patches and flower beds are truly marvelous during the summer, but for the average dog owner, you can expect plenty of holes, devoured soil, damaged plants, and compost desecrations. After you’ve put so much time and effort into cultivating those plants, just one fell paw swoop from a furry friend can eliminate all of those hours spent trudging through the soil and digging out thorny weeds.
In this Gentleman Maker project, we will create the Dog Corrector, a device that will automatically tell off and sprinkle your dog when they get too close to your beloved crops! Watch out, canines. The garden is your playground no longer.
Dog Corrector BOM
- Raspberry Pi 3
- Arduino Uno or Yun
- Ultrasonic range module
- 2N3904 BJT
- G3MC-202P solid state relay
- 1K resistor
- USB B cable
- ½ inch water solenoid valve 12V 5W
- Solar panel
- Solar charger controller
- 12V lead-acid battery
- Waterproof box
- Wires and circuit construction materials
The hardware for this project is similar to the Life-Cam project. The Raspberry Pi is connected to the Arduino via a USB connection, which provides both a serial connection and 5V power. The Pi is also connected to a speaker and a solar/battery power unit, which provides power in remote locations.
The Arduino Uno is connected to both the ultrasonic module, which is used to detect nearby objects, and the relay circuit, which controls the water valve. The valve is a ½-inch solenoid, which is used with hose connectors with the inlet connecting to the water mains and the outlet connected to a sprinkler.
You can check out the full Scheme-It schematic here.
Under normal conditions (no dog present), the Arduino constantly checks the ultrasonic module for the presence of an object (such as a passing dog).
If the distance reading from the module drops, then the Arduino sends a UART message to the Raspberry Pi via the USB connection to warn the dog that they should not be in the area (a Python program plays a sample such as “Get off my flower bed!”). If the distance measurement is still too low (i.e., the dog is being disobedient), the Arduino will automatically engage the solenoid to let water flow through the sprinkler and teach the dog a lesson about engineering.
The Raspberry Pi can also be made to run a timer program that constantly checks to see if the current time is 7am. Once 7am is reached, the Pi would then send a message to the Arduino to engage the sprinkler for a few minutes so that flowers and vegetables can be watered automatically in the morning.
You can download the full code for this project below.
Powering this project will be a challenge because of the remote location (no sockets nearby). In addition, normal batteries (such as AA and AAA) simply do not have the energy capacity to run such a project. Therefore, this system will take advantage of the solar system used in the Life-Cam project, whereby a 20W solar panel is connected to a solar charger and lead-acid battery to provide the system with plenty of power to run both day and night.
The solar charge also allows us to take advantage of the built-in USB ports, which can easily power the Raspberry Pi, Arduino, and various other devices.
With that, you should have everything you need to guard your tomatoes, wet your dogs, and save your garden from its own pending apocalypse. Best of luck in the battle and may your lettuce remain fresh!
Looking for more Gentleman Maker projects? We have you covered!
- Feeling Flashy? Tone It Down with the Gentleman Maker’s Raspberry Pi Colorboringizer
- Take a Gander at Wildlife with Your Raspberry Pi: The Gentleman Maker’s Life-Cam!
- Save for Your Own Royal Wedding (of Sorts) with the Gentleman Maker’s Savings Incentivizer
- The Gentleman Maker’s Sun Informer Lets Homebodies Safely Enjoy Intermittent Sunshine
- The Gentleman Maker’s Auto-Apologizer: A Clever, Polite Device for the Everyday Brit
- How to Make an IoT Teapot so You Can Put the Kettle on from Your Smartphone