farmMinder was inspired by a need to keep my urban farm watered and free of squirrels. The Blynk platform allows the user to monitor soil moisture levels remotely and will email alerts if moisture levels fall below a user-defined threshold. A motion detector and vibrating snake automatically scare away squirrels as needed. Temperature and humidity levels can also be monitored.DemoStep 1
The soil moisture sensor was built from 8-32 sized hardware. I cut the bolts to about 8 inches in length, attaching them to the waterproof enclosure with nuts and washers. I attached two wires with crimp terminals between the nut and washer on the inside of the enclosure. Finally, I attached two 1-inch washers between nuts to make a stop for the soil probes. This holds the enclosure off the ground and ensures consistent probe depth.
The motion sensor I used came from Adafruit, although Sparkfun sells one similar. These sensors are designed for 5V operation. I desoldered the on-board 3.3V regulator and the reverse-voltage protection diode, bridging the pads for each with a small piece of wire. This allowed me to power it with the 3.3V supply on the Blynk Board. (Before making the modification, the sensor was prone to making periodic false triggers, one about every 10-15 seconds.)
Motion detector modification detail
I drilled a hole for the motion sensor lens in the face of the enclosure and glued it into place. If you find that the WiFi signal from the Blynk Board is triggering your PIR motion sensor, a known problem, try using a piece of aluminum foil between the two to shield the sensor. Mounting the two as far away from the other as possible in your enclosure will also help. All remaining components (except for the vibration motor) were soldered to protoboard and mounted along with the Blynk Board and battery inside the waterproof enclosure using Velcro tape.
The final piece is the vibrating snake. I found a 3V vibration motor with a heavy weight at a surplus store. I placed the motor inside of a second enclosure and ran two-conductor wire to it. Mounting hobby motors is difficult, but with some aluminum stock, wood, and pieces of the 8-32 bolt I was able to secure it to the box. I attached the snake to the top of the enclosure and glued up all the holes to weatherproof it.
The attached code was uploaded to the Blynk Board, and then an interface was built in Blynk. Virtual pins assignments are listed below, but are also visible in the image of the interface. You can set the displays to update as often as you wish, or set them to 'push' for updates every minute. Note that you must add the email widget in order to receive email alerts.
- V9: Temperature in Fahrenheit (float)
- V11: Soil conductivity (int, 0-1023)
- V12: Soil conductivity lower limit, for email notification (int, 0-1023)
- V13: Test snake rattle immediately (push, high/low)
- V14: Arm snake so it rattles on motion (switch, high/low)
There are improvements I would make for version 2.0 of this project. I would use soil capacitance to measure moisture levels instead of soil conductivity. Solar power for recharging the battery seems appropriate. Finally, it would be nice to have a solenoid connected to a hose to water the plants automatically or remotely.