Project

Protect Your Summer Harvest with the Gentleman Maker’s Raspberry Pi and Arduino Dog Corrector

August 09, 2018 by Robin Mitchell

In this episode of the Gentleman Maker, we're using a Raspberry Pi and an Arduino Uno to stave off the onslaught of dogs trying to eat every single plant in our garden.

In this episode of the Gentleman Maker, we're using a Raspberry Pi and an Arduino Uno to stave off the onslaught of dogs trying to eat every single plant in our garden.

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

The Hardware

 

 

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.

The Software

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.

The Power

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!

Dog_Corrector_Code.zip

3 Comments
  • A
    alphaOmega August 17, 2018

    Very good, but what’s the Pi for? Or, if you are a pi fan, what’s the Arduino for?
    I’m all for extra power, but, (especially since you are using solar power) you want to keep the power drain low. The Arduino should be able to do the whole thing with ease.

    Kind regards
    A

    Like. Reply
  • tank circuit September 20, 2018

    How do you get to the garden without having wet legs?

    Like. Reply
  • SharonJFay October 09, 2018

    And for what it generally is necessary? I not absolutely understand.

    Like. Reply