Many were faced with a situation where, when leaving for the summer on a well-deserved vacation, they had to leave their pet with no news with those unfortunate for 14 days, thereby limiting themselves and others with obligations and cares, disrupting the already 2 hours of enjoying the sea and the sun Nights from a childhood friend: “Seryoga, I'm sorry, the food you gave is over, but your Martin doesn’t eat Kitek, which I give to my Murzu,” “Emergency: you need to leave your city for 3 days, with Baba Galya "and so on and so forth like these are.
As a student of the University of Informatics and Radioelectronics, I decided to solve this situation in the most logical way for me - to create a device with which I no longer have to shift cares about caring for pets to my friends and relatives in my absence. Fortunately, the work on the course project with the same name (“Coincidence? I don’t think ...”) gave a stimulus and motivation to creativity. As you know, in the everyday life of the average student there is rarely a place for extra money, especially when it comes to particularly expensive gadgets and household items. Therefore, it was decided to do only with what was available at home, as well as donations from friends and relatives.
Where to begin
Since I decided to do the work absolutely from scratch, without resorting to using ready-made cases, I decided to think about how to organize the device management and operation, the choice (unfortunately, small) fell on the Arduino Uno R3, bought just for the implementation of the very course project.
Determined with the control device, the case for the case. For the case, two rather capacious buckets were chosen - from ice cream and cabbage, the microcontroller's case ideally fit into the case of the 2003 Genius Easy Mouse Pro PS2 ball mouse. ')
The dosage system will consist of a drive and a regulator. The drive for the supply is made using an electric motor from an AirWick automatic air freshener. Alternatively, you can use any 3.5 volt motor.
In the end, it was decided to make the regulator out of a photoresistor and a blue LED, borrowed from the set of a young electrician of a group mate.
The organization of a kind of “timetable” was decided to be made with the help of a motion sensor; such ones are installed in the automatic lighting control systems in the rooms.
Initially, it was decided to make the issuance schedule with a period of 8 hours, without using any sensors. However, the idea had to be abandoned, due to the unreliability of the system.
Assembly of the device
To begin with, we will make the necessary holes in the bucket from the cabbage, read the lower part of the body.
Holes we need to install the regulator and the tank under the feed.
At the bottom of the bucket from the ice cream (top), we need a hole for signaling the LED to the photoresistor (see above), as well as a larger hole for feeding. On the side of the bucket will place a hole for mounting the regulator. In the center of the bottom we place holes for the shaft and its attachment to the circle of the dispenser itself, the circle will be lower. On the top lid we secure the case from the mouse with a microcontroller, simultaneously making holes for the connecting wires.
The drive for feeding is made of an electric motor on the shaft of which the dispenser. The batcher, in turn, is made in the form of a plastic circle with a cut-out hole. Actually, through the hole and feed is fed into the tank by rotating the circle by an electric motor. The motor itself with the connected wires is placed on the bottom of the upper part.
Let's go to the regulator. To do this, you need a U-shaped bracket for mounting the photoresistor exactly above the LED. In this case, an aluminum bracket for fixing drywall was used, it was chosen because of its flexibility, as well as convenient holes for mounting the LED and the resistor.
Before assembling the individual elements, connecting the elements themselves, make sure to connect all the wires and smaller elements, the basic wiring diagram:
In the diagram:
PIR - pyroelectric motion sensor:
M1 is an electric motor, R2 is a 10 kOhm lowering resistor, for which you need to look here , R1 is a 220 Ohm resistor, VD1 is a LED, PR1 is a photoresistor. A1 - Analog input Arduino, D7, D4 and D13 - Arduino digital inputs.
After connecting and assembling, we place a protective screen on the periphery; in our case, the top part of the bottle from soda pops out so that the feed does not fall on the movable parts, it is recommended to use dry food to prevent the dispenser opening from clogging up.
The simplest sketch:
int pirMSPin = 7; int pirEMPin = 4; int pirDaPPin = 13; int portion; int delayflag; int sensorValue; voidsetup(){ pinMode(pirMSPin, INPUT);//motion sensor pinMode(pirEMPin, OUTPUT);//electrical motor pinMode(pirDaPPin, OUTPUT);//diode and photoresistor digitalWrite(pirDaPPin, HIGH);//turn on diode and photoresistor Serial.begin(9600);//set baud rate } void checkPhoto() { if(sensorValue>600) potion++; } void turnOffEM() { digitalWrite(pirEMPin, LOW); } void makeDelay() { delay(600); delayflag=1; } void turnOnEM() { digitalWrite(pirEMPin, HIGH); } void loop() { portion=0; delayflag=0; //digitalWrite(pirEMPin, LOW); int pirValMS = digitalRead(pirMSPin); if (pirValMS == HIGH) { Serial.println("MOVEMENT"); do{ sensorValue = analogRead(A0); Serial.println(sensorValue); checkPhoto(); Serial.println(flag); if(portion==1){ turnOnEM(); if(delayflag==0) makeDelay(); } if(portion==2) turnOffEM(); }while(portion<2); //delay for a portion extraction, AKA timetable for 3 portions a day delay(28800000); } else { Serial.println("no movement"); } }
Comments to the sketch, as well as the operation of the device
After receiving data on the registered movement, a signal is received to start the dosing process. The batching process begins by reading the value of the photoresistor, if the value of the photoresistor signal is high enough, then this means that the photoresistor registers the signal from the LED and the feed delivery mechanism is in the closed position. Then the motor starts and the dosing process begins. The dosing process ends when the high signal is re-recorded from the photoresistor, which is an indicator of the complete dosing cycle. After the batch is discharged, the system goes into standby mode, the duration of which can be set by reprogramming the microcontroller using the delay string (28,800,000). The number of dosage cycles (portions) can also be set by changing the variable with the telling name portion, delayflag is used to adjust the position of the dispenser.
Issue price
Given that the Arduino controller was available a priori, the components in the final version had to be paid only for the sensor, which costs about three conventional units.
Eventually
For two evenings of work we get an affordable system, in which our beloved pet will not go hungry, and the wallet will not empty.