Automatic feeder for the birds

Even in 2010, Leonid Kaganov (as it is known - great entertainer) shared with readers of his blog idea bird feeders with webcam and dosypaniem grain by sending paid SMS. I liked the idea. And so, it took 4 years, came the New Year holidays in 2014, I took from the table stray arduino uno, router tp-link 3020 and together with bitl (aka admin urban site) launched a project.




Under the cut a lot of photos.


Feeder h5>
The heart of the trough appears Tp-Link router 3020 firmware OpenWrt, which is connected by ethernet camera D-Link DCS-2310L and arduino on usb. He goes to the Internet via wifi. Every minute cron runs a script that every 4 seconds determines whether and how many times to open the valve on the feed hopper.
Script
 & lt; code class = & quot; bash & quot; & gt; #! / Bin / sh COUNT = 10 if [-f /tmp/lock.ceed]; then LOCK = `cat / tmp / lock.ceed` if [& quot; $ LOCK & quot; -lt & ​​quot; 1 & quot; ]; then echo '1' & gt; /tmp/lock.ceed while [& quot; $ COUNT & quot; -gt & quot; 0 & quot; ]; do rm /tmp/status.php wget http://labinsk.ru/feeder/status.php -P / tmp / -t 5 if [-f /tmp/status.php]; then CEED = `cat / tmp / status.php` if [& quot; $ CEED & quot; -gt & quot; 0 & quot; ]; then until [$ CEED -lt 1]; do echo 1 & gt; / Dev / ttyACM0 let CEED = $ CEED-1 let COUNT = $ COUNT-1 sleep 4 done fi fi let COUNT = $ COUNT-1 sleep 4 done echo '0' & gt; /tmp/lock.ceed fi else echo '0' & gt; /tmp/lock.ceed fi & lt; / code & gt;  pre> 
Arduino listens com port and if so edinichki (0x31) opens the valve for 120 ms.
Sketch Arduino
 & lt; code class = & quot; cpp & quot; & gt; int incomingByte = 0; int relay0 = 8; int relay1 = 12; void setup () {Serial.begin (9600); pinMode (8, OUTPUT); pinMode (12, OUTPUT); digitalWrite (relay0, LOW); digitalWrite (relay1, HIGH); delay (200); digitalWrite (relay0, HIGH); } Void loop () {if (Serial.available () & gt; 0) {incomingByte = Serial.read (); if (incomingByte == 49) {digitalWrite (relay1, LOW); delay (120); digitalWrite (relay1, HIGH); digitalWrite (relay0, LOW); delay (200); digitalWrite (relay0, HIGH); }}} & Lt; / code & gt;  pre> 
The mechanism is made of 50mm tee for sewage and motor solenoid. In tee glued cork from 5 liter PET bottle (bottle acts as a feed hopper). Valve is also made from a piece of sewer pipe.







For Arduino Shield connected homemade Two relay to which the solenoid is connected and the standard scheme changes polarity. It eats everything from the power supply to the deceased USB-SATA adapter.



It is a house with a back box for electronics, swiveling holder under the hopper bottom and recline:


So much more convenient to add the feed:


Initially, we wanted to set the feeder in a city park, but due to problems with electricity and wifi, it was decided to install it at home. Actually setting:










Website h5>
Feeder is available at http://www.labinsk.ru/index.php?p=feeder&stream=mjpeg

A few words about the implementation on the server side of the site.
From the initial idea to pour food SMS-kami was decided to abandon. The project was not originally meant to be a commercial. In fact, some of the benefit can there be? And, of course, willing to send SMS-messages in order to see how the food is poured - it would not be so many, and the birds would not appreciate such "care". So pour forage can simply pressing a button on a page with a video broadcast. To users have devastated entire bunker for a few hours - introduced a timeout. At this point the button "Feed" is available only 15 minutes after the previous dumping feed.
Well, it works all trivial. The user presses a button, php-script adds a SQL-table entry with the status "not processed" feeder periodically polls the server, referring to one more php-skriptik, which tells the manger, that asks for dumping, and then changes in SQL-table status of the record. Thus, no site sends a manger, and the manger periodically asks the site - whether it is necessary to pour? Not the optimal realization, but simple. Also in this case we do not need a static ip-address (or some kind of DynDNS) for internet connection trough.

Birds h5>












P.S.
Feeder works for 2 months, during which time the birds ate about 10 liters of feed (2 bunkers). Forage - Sunflower Seeds.

UPD Video test mechanism.



Source: habrahabr.ru/post/217985/

Tags

See also

New and interesting