📜 ⬆️ ⬇️

Create a fully automatic farm.

We continue to review the activities of our Hackspace Club .

The idea was born to make a very practical thing, an automatic farm. The fact is that we live in Siberia and often go to rest in the Crimea. We have a mini-hotel on the seashore and that, so that it would not stand idle for most of the year, we decided to make a farm near it, there will not be any excess chicken to guests at the table. And since we live 4500 kilometers from the Crimea, we need to make the farm fully automated with remote control and video surveillance.



To begin with, I think we will have chickens, at least my parents kept chickens, I know how to look after them.
The brains decided to do on the Raspberry Pi, there was no time to bother with the controller, (after a week off, going to the Crimea) you need to fasten the Internet to control it. And on the Raspberry Pi on board everything is already there.
Immediately set up a watchdog timer, the so-called WatchDog (watchdog), so that when the system hangs, the Raspberry Pi is overloaded automatically. The configuration process will not be described in detail about this can be read, for example, here .
')
As an engine driver and water supply valves, an assembly on the l298n microcircuit was used. DC motors with gear. The valve for water supply is used from a washing machine at 220 volts. Now ordered at 12 volts, still safer, you never know what chickens will climb.

It turned out as in the photo:



There is not any wisdom, Each driver accepts 4 signals from the CPIO Raspberry Pi and issues an amplified logical 0 or 1 for the engine or valve.

We used three engine driver assemblies; we got 12 outputs for connecting engines and water valves. Feedback at the initial stage of the design of the farm is not assumed. Control will be carried out on a video camera. In the future, it will be necessary to control the current of the engines so that the reverse can be automatically activated, or the engine can be stopped in case of sticking and the water level in the drinking trough is monitored.

The program was written in C, using the WiringPi library, it is easy to find on the Internet. The program reads the system time in an endless cycle and if it is 6:00 AM, 12:00 AM or 7:00 PM, it turns on the water supply valve - it fills the drinkers from the water pipe, the engine of one feed, the engine of the second feed and the third to diversify the diet. pets.

Listing of the program.

full code can be found here.
/* cc -o kura kura.c -L/usr/local/lib -lwiringPi * kura.c: * */ #include <wiringPi.h> #include <wiringSerial.h> #include <stdio.h> #include <time.h> int main (void) { for(;;) { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); printf ( "datetime %s\n", asctime (timeinfo) ); int tt_hour = timeinfo->tm_hour; int tt_min = timeinfo->tm_min; int tt_sec = timeinfo->tm_sec; printf ( "hour - %d\n", tt_hour); printf ( "min - %d\n", tt_min); if ((tt_hour == 06 & tt_min == 01 & tt_sec == 01) || (tt_hour == 12 & tt_min == 01 & tt_sec == 01) || (tt_hour == 19 & tt_min == 01 & tt_sec == 01)) { korm(25); printf ( "datetime %d\n", tt_hour); } } return 0; } int korm (int _p) { printf("korm0\n"); // 1 draiver motora int pin0 = 0; //11 noga int pin1 = 1; //12 int pin3 = 3; //15 int pin4 = 4; //16 // 2 draiver motora int pin7 = 7; //7 noga int pin5 = 5; //18 int pin6 = 6; //22 int pin10 = 10; //24 // 3 draiver motora int pin11 = 11; //26 noga int pin12 = 12; //19 int pin13 = 13; //21 int pin14 = 14; //23 int i; if (wiringPiSetup() == -1) return (1); pinMode(pin0, OUTPUT); pinMode(pin1, OUTPUT); pinMode(pin3, OUTPUT); pinMode(pin4, OUTPUT); pinMode(pin7, OUTPUT); pinMode(pin5, OUTPUT); pinMode(pin6, OUTPUT); pinMode(pin10, OUTPUT); pinMode(pin11, OUTPUT); pinMode(pin12, OUTPUT); pinMode(pin13, OUTPUT); pinMode(pin14, OUTPUT); printf("korm1\n"); for(i = 0; i <= _p; i++) { // digitalWrite(pin1, 0); // digitalWrite(pin2, 0); digitalWrite(pin0, 0); digitalWrite(pin1, 1); printf("Motor On\n"); delay(4500); // digitalWrite(pin1, 0); digitalWrite(pin0, 0); digitalWrite(pin1, 0); // digitalWrite(pin14, 0); printf("Motor Off\n"); delay(1500); } return (0); } 


Afterwards it is easy to change the program, just remotely go to Raspberky Pi to kill the process and launch a new program that will give, for example, one feed in the morning, another in the evening.

I saw on the Internet a lot of bunker trough designs without any type of electronics like this:



They have one big drawback, they have to feed the chickens with various feeds, and with such a feeding trough, they will eat the most delicious feed from the beginning, for example for a month, and then they will have the remaining 2 months to eat another feed. Again, tracking the feed when it stops flowing altogether and probably still has flaws ...

The design of the trough by general discussion decided to make on the basis of a vertical auger. If you simply do the flap opening or the horizontal auger under the bunker, then the feed can be compressed, and with a vertical auger there is a chance that the feed will be stirred.



In addition, on the spot I will think about what to put the engine to vibrate the bunker.
I will include it as a separate program, remotely, if necessary.
The engines decided to connect, so that you could turn on the reverse. Although it is wasteful for the Raspbery Pi to use two CPIO outputs for one DC motor, there is a reverse, which will allow you to do something when stuck.
Total of 12 CPIO - 8 for auger engines 2 for main and backup water supply and 2 for vibration motors. Maybe on the spot during the installation process we will change something.
Next time we will eat in Crimea in July, that is, for three months the farm should work automatically. Calculate the required amount of feed:
One chicken needs about 150 grams of feed per day, 3 months 13.5 kg, 10 chickens will eat 135 kg in 3 months. As a result, it is enough to make three feeders of 50 kg each. Well, I will do one more for the reserve, which we will include remotely if necessary.
Chickens are going to take a month or two months, up to 5 months, they do not carry eggs, so the robot does not need to do the collecting eggs.
I will make the floor of the chicken coop out of the net, under it an inclined professional sheet, along which all the waste will be drained into the waste.
Prepared solid brackets for the motor. Ordered and have already cooked:



I will look for containers for feed on the spot, maybe I'll order a huge funnel from the tinsmith.

Prepared several clutches and engines. Engines 12 volts, 20-35 RPM, torque 10 kg / cm. and others for 150 RPM torque 5 kg / cm.



Moreover, the imperfection of homemade couplings will benefit the feeder. Excessive heartbeat, long bolts will not allow feed to be compressed.

In laboratory conditions, everything is fine-tuned, it works. How in practice this will all work, some chickens know. But in any case, starvation does not threaten them, if I see something wrong in the cells, our relatives live 30 kilometers away from the mini-hotel. I will call, come and save our livestock.

Source: https://habr.com/ru/post/253079/


All Articles