A three-compartment food dispenser was created for three meals a day, with a time interval between each equal for the opening activation of each food compartment except for the third behavior, since it lasts for 3 seconds activated, sufficient time for Dispense the food and return to an initial position, in which the compartments can be filled again.
The idea arises since in my home I have an adult cat which I have to feed daily and I usually do not stay in the home for the day and part of the night, moments when I can not serve food, therefore, with this Project can serve all three meals and the dispenser will be responsible for serving each meal at their specific times.
We use a Servo motor with which by means of a "PWM" we can configure the appropriate positions of the servo so that each compartment opens, and we use a "Timmer Counter" to obtain the intervals of Time between each compartment.
We use a "timer" with a clock of 2Hz and with an interruption with which we count the time between each position for the opening, knowing that 2Hz Equivalent to 0.5 Seconds we know that if we put in the section "compare" 2000 is Equivalent to a 1000 seconds, of course this value that we put in the "compare" is to show the correct operation of the program, since it would be better to put it in intervals between 6 hours (Compare 43200) and 8 hours (Compare 57600). When the "timmer counter" ends counting it enters an interrupt in which it activates the PWM that is configured to a frequency of 50HZ and a useful cycle that varies between 1 and 2 milli seconds what is the useful cycle and the frequency in which the Servo motor. Depending on the compartment required to open the duty cycle has a fixed pwm so that the compartment can be opened precisely. Each compartment has a sequential order that never changes and when it reaches the third compartment this lasts 3 seconds open and goes to a position the servo motor in which it closes all the compartments so that they can be filled again.
With wood is designed the whole prototype and three compartments that are in half wheel also made with wood, with three holes in the top to fill them and three in the bottom to serve the food.