**The programs that I used for the "Tomato Pi" and the "Scarecrow Pi" are embedded below at the end of this post.
Project #1: "Tomato Pi" soil sensor
capacitive sensor |
While shopping, I discovered that there are two types of moisture sensors you might use with your Raspberry Pi or Arduino-- a double-pronged resistive sensor that outputs both digital and analog data, or the capacitive sensor that outputs only analog data. I'd read numerous blog posts stating that the resistive sensor was prone to corrosion when left in soil over time, so I purchased a couple of capacitive sensors, which sounded as if they would hold up better if left in the soil for an extended period of time.
However, if using a capacitive sensor you will also need to use some type of analog to digital converter, as the Raspberry Pi does not include an analog pin. You can purchase an MCP3008 analog to digital converter pretty cheaply for the project (great instructions on how to do this on Maker.Pro website), which I did, before also realizing that my Explorer HAT Pro also has an analog to digital converter pin. Using the Explorer HAT Pro and accompanying python module made it SO easy to set up the moisture sensor!
email notification from Tomato Pi |
While I still have to up my "packaging game" (I know this set up isn't the fanciest or prettiest) we were pretty happy with the results and reliability of the sensor.
Project #2: "Scarecrow Pi" motion-activated wildlife camera & scarecrow
One of the major annoyances of having an urban garden is discovering that the local birds and squirrels are getting into our vegetables before we are! So I decided to play with some automated solutions to our garden pest problem.Building off the idea of wildlife cameras, I first put together a motion-activated camera to capture the culprits in action. (Really I wanted to use a distance sensor so that the camera would only go off if an animal got within a certain distance of our planter box, but I haven't yet got one to work so...)
I also wanted to incorporate some type of scare tactic to keep animals out of our plants (without hurting them!), so I decided on the servo motor. And while the scarecrow itself doesn't yet look like a scarecrow (I'm thinking I'll hire a student to build me a better looking scarer), shiny materials are said to keep birds away so as far as we can tell, having the motor shake shiny paper in front of the birds when they set off the sensor seems to be working just as well.
In order to run our "scarecrow" headless I also programmed the Pi to autostart the program on boot, and I programmed a "shut down" button so that I can shut down properly when I need to. As for power, I'm currently running the Pi on a solar powered battery pack-- although I'm thinking about just running an extension cord to the garden box as the battery, even though solar powered, doesn't tend to last more than a day. I still need to track down some of these batteries that I've seen others use more successfully for multiple days.
I still need to adjust the sensitivity of the motion sensor, and my next steps will be to update the camera to take video and stream online, but in the meantime, this is definitely doing the trick!
Tomato Pi code:
Scarecrow Pi code:
Learning resources:
Soil moisture sensor
https://maker.pro/raspberry-pi/tutorial/interfacing-soil-moisture-sensor-with-raspberry-pihttps://www.element14.com/community/community/raspberry-pi/raspberrypi_projects/blog/2017/08/23/iot-garden
https://gpiozero.readthedocs.io/en/stable/api_spi.html#spi-keyword-args
https://cdn-learn.adafruit.com/downloads/pdf/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi.pdf
https://learn.sparkfun.com/tutorials/soil-moisture-sensor-hookup-guide/all
With ExplorerHAT Pro
https://github.com/pimoroni/explorer-hat/blob/master/tutorial/welcome-analog.pyShutdown button
https://core-electronics.com.au/tutorials/how-to-make-a-safe-shutdown-button-for-raspberry-pi.htmlServo motor (for moving scarecrow)
https://gpiozero.readthedocs.io/en/stable/api_output.htmlhttps://projects.raspberrypi.org/en/projects/grandpa-scarer/3
No comments:
Post a Comment