100% newbie, literally learnt about Arduino 2 weeks ago when I decided I need to make a feeder for my two dogs. So please tell me where to go if there is a better place for this.
I’m a mechanical engineer with not much programming/electronic experience, but wanting to learn.
So I have 2 dogs that need to be feed dry nuts 2/day. Since they are total muts, they’ll eat what ever is available so I want a system that tells the feeder to deliver to there define bowls at certain times.
Basic operation:
-Timer to set feeding times, say between 7 – 7.30 am & 7 -7.30pm
-Buzzer or sound to signal its feeding between these time windows
-Collar sensor on each dog, so when they approach their bowel between these times – feed comes out to their bowl (they already have a petsafe collar each – wonder does this emits a certain signal that could be used)
-The sensor will drive a motor 90 degrees one direction for one dog, the other direction for the other dog. Thereby dispensing feed to respective bowls
So what controller, sensor shield, buzzer shield (if I need one) would be recommended?
I have this code to run a simple clock from an Arduino
unsigned long currentMicros;
unsigned long previousMicros;
unsigned long elapsedTime;
// Initial time to start, adjust as needed.
byte hundredths;
byte tenths;
byte oldTenths;
byte secondsOnes = 0;
byte oldSecondsOnes;
byte secondsTens = 0;
byte minutesOnes = 2;
byte minutesTens = 3;
byte hoursOnes = 4;
byte hoursTens = 0;
void setup() {
Serial.begin(115200); // make serial monitor match
Serial.println ("Setup Done");
}
void loop() {
currentMicros = micros();
// how long's it been?
elapsedTime = currentMicros - previousMicros;
if ( elapsedTime >= 10000UL) { // 0.01 second passed? Update the timers
previousMicros = previousMicros + 10000UL;
hundredths = hundredths + 1; // increment
if (hundredths >= 10) {
hundredths = 0; // else rollover and increment next digit
tenths = tenths + 1;
if (tenths >= 10) {
tenths = 0;
secondsOnes = secondsOnes + 1;
if (secondsOnes >= 10) {
secondsOnes = 0;
secondsTens = secondsTens + 1;
if (secondsTens >= 6) {
secondsTens = 0;
minutesOnes = minutesOnes + 1;
if (minutesOnes >= 10) {
minutesOnes = 0;
minutesTens = minutesTens + 1;
if (minutesTens >= 6 ) {
minutesTens = 0;
hoursOnes = hoursOnes + 1;
if ((hoursTens == 2) && (hoursOnes == 4)) {
hoursOnes = 0;
hoursTens = 0;
}// hours total rollover check
if (hoursOnes >= 10) {
hoursOnes = 0;
hoursTens = hoursTens + 1;
} // hoursOnes rollover check
} // minutesTens rollover check
} // minutesOnes rollover check
} // secondsTens rollover check
} // secondsOnes rollover check
} // tenths rollover check
} // hundredths rollover check
}// hundredths passing check
if (oldTenths != tenths) { // show the elapsed time
oldTenths = tenths;
Serial.print(hoursTens);
Serial.print(hoursOnes);
Serial.print(":");
Serial.print(minutesTens);
Serial.print(minutesOnes);
Serial.print(":");
Serial.print(secondsTens);
Serial.print(secondsOnes);
Serial.print(".");
Serial.println (tenths);
} // end one second check
} // end loop
You could add a test in the display section to set an farm one direction or the other and turn on the food driver motor for some amount of time:
if ( ((hoursOnes == 0) && (hoursTens == 7)) || ((hoursOnes ==1) && hoursTens == 9)) ) { // test for 07:00 or 19:00
// arm points one direction or the other, deliver some food
// turn on food driver motor, or however food is delivered
// turn off food driver motor
// change food diverter arm to the other bowl
// turn on food driver motor, or however food is delivered
// turn off food driver motor
}
Turning on the food driver motor could be a simple N-channel MOSFET such AOD514 that turns on a motor. And food diverter arm could be the same transistor energizing a solenoid that moves flap back and forth.
It will take some time to do all that, so you could advance the time when all done by however long it took to do the food dispensing. Or go more advanced and use a battery backed Real Time Clock module to keep the time, then if the Arduino gets reset for whatever reason the time keeping is not lost. There are SPI interface modules and I2C modules, and libraries to use either. The code above will let you get started while you work out the motor & food arm control.
So i've done some designs and have narrowed down to this one - refer to attachment.
I need advice if i need a servo or stepper motor.
I need the rotating hopper resting at 0° at rest, and being able to rotate 70° both directions from 0, pause at 70 or 290° so that the food falls out and the returns back to the 0°. Im not sure can i get a servo will allow this?
Each dog will have a tag on their collar, during the feeding window (~30mins) if the dog approaches their bowl, the RFID tag will trigger the arduino to activate the servo/stepper to the required angle to discharge their portion.
the concept looks good.
if your dogs are mutts, then they are smart, very smart.
I assume you will have an RFID tag on each, so that if one goes to their bowl, they will get the nuts
if they go to the other bowl, the RFID will show the wrong match and not dispense food.
if you have not figured it out already, add arduino to your search terms.
You can use a stepper or a servo - in each case my concern would be getting enough torque to be able to close the chamber while food can fall into it. I expect it to jam with nuts before it's all the way in the 'feed dog' position.
As long as not too much surplus food drops, maybe that doesn't matter.
I'm guessing you'll need a high torque servo with metal gears - Amazon carries them. I'd be inclined to start with a (cheaper) hobby servo though while you figure out your code.
Thinking about it more, establishing torque requirements is going to be key. Maybe a stepper with built in gearing is better, plus you can always add additional gears if it turns out to be too feeble.
Maybe even simpler? just a chute with a pivitol base/door?
like a hopper on top.. that fills with some food
rotation bottom that moves xx degrees (180? if servo... xx steps if stepper) to pint to the target dog bowl..
bottom door/chute opens to dispense said dry food into bowl..
door/chute closes... and the top hopper is fed another 'batch' of food to dispense when ready.
this way.. you dont have to wory about 'closing' anything that might get food caught in it.. the 'amount' is already ready and is just dumped into the bowl.. (its empty at that point, so closing anything is not an issue)..
You can use your 'mechanical feed screw' to load more into the top hopper is you need some precise control over how much is in there (ie: xx turns = xx amount of food)
Okay, so I've made some progress. Re-designed to use an auger system - seems to be mechanically working okay. The auger pulls the feed from a hopper to an outlet. Then a flap directly under the outlet & use a servo on it to direct the feed to either side (bowl). Have also gotten an RTC DS1307 incase power goes.
So I've tried to wright some of the code but am stuck (as i dont really understand it) - will leave the clock piece until i get the mechanical sequence correct.
Aim is.
Feeding time:
Flap servo will be a 0 deg
Auger motor rotates for 5 seconds then stops
Flap servo rotates to 90 deg
Auger motor starts again for 5 seconds then stops
Flap servo resets back to 0 deg
Both feeds have now been dispensed
Wait 12 hours to restart the whole sequence
//Setup Channel A
pinMode(12, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
Servo1.attach(servoPin); //servo
}
void loop(){
//Auger forward @ full speed
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(3, 255); //Spins the motor on Channel A at full speed
delay(5000); //Duration of auger rotation
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(1000); // Duration of auger pause - to change flap
// Make servo go to 0 degrees
Servo1.write(0);
delay(1000);
// Make servo go to 90 degrees
Servo1.write(90);
delay(1000);
// Make servo go to 0 degrees //Servo1.write(0);
//delay(1000);
}
#include <Servo.h>
int servoPin = 10;
Servo Servo1;
void setup() {
//Setup Channel A
pinMode(12, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
Servo1.attach(servoPin); //servo
}
void loop(){
//Auger forward @ full speed
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(3, 255); //Spins the motor on Channel A at full speed
delay(5000); //Duration of auger rotation
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(1000); // Duration of auger pause - to change flap
// Make servo go to 0 degrees
Servo1.write(0);
delay(1000);
// Make servo go to 90 degrees
Servo1.write(90);
delay(1000);
// Make servo go to 0 degrees
//Servo1.write(0);
//delay(1000);
}