Sunday, September 17, 2017

Arduino controlled 3D Printed Automatic Fish Feeder

Recently I designed & put together a really simple small aquarium automatic fish feeder. The design files & simple build instructions are located on Thingiverse here.




And, since I didn't immediately see an easy way to park code on Thingiverse, the code is below:

/***********************************************************************************
Small fish feeder

code is set to have the feeder run 1x per day. It runs once immediatley upon startup,
then waits 24 hours for next run. For testing comment out the DAY (24*HOUR) line
and uncomment Day (2*SECOND) line
*****************************************************************************************/

#define SECOND 1000L
#define MINUTE (60*SECOND)
#define HOUR (60*MINUTE)
#define DAY (24*HOUR) //uncomment for actual run
//#define DAY (2*SECOND) //test setup

const int SERVO_PIN = 3; //pin number for the led pin - this is 'const' since it will not change during code, and saves Arduino memory
const int FILL_DEGREE=5; //starting hole location, fill slider with fish food
const int DISPENSE_DEGREE=45; //dispensing hole location

Servo servo1;

//setup runs once when the Arduino is turned on
void setup()
{
servo1.attach(SERVO_PIN); //attach the servo on pin SERVO_PIN

} //setup() is done, go to loop()

//loop runs forever once setup is complete
void loop()
{
//******************************************************************************
//NOTE: YOU WILL HAVE TO CHANGE THESE VALUES based on your servo horn alignment.
//******************************************************************************

servo1.write(FILL_DEGREE); // tell servo to go to fill position
delay(1000); // delay for 1 second
servo1.write(DISPENSE_DEGREE); // tell servo to go to dispense location
delay(1000);
servo1.write(FILL_DEGREE); // tell servo to go back to fill position

delay(DAY); // delay for 1 day
}

4 comments:

  1. Code is incomplete! what to '#include'

    ReplyDelete
    Replies
    1. nice spot, it looks like I forgot to delete that line out. At one point I had the serial library included for trouble shooting but isn't needed for this version. Somehow this still works. I'll delete it out of the example above. thanks!

      Delete
    2. Buildin' Projects: Arduino Controlled 3D Printed Automatic Fish Feeder >>>>> Download Now

      >>>>> Download Full

      Buildin' Projects: Arduino Controlled 3D Printed Automatic Fish Feeder >>>>> Download LINK

      >>>>> Download Now

      Buildin' Projects: Arduino Controlled 3D Printed Automatic Fish Feeder >>>>> Download Full

      >>>>> Download LINK hm

      Delete
  2. A Nice way you can add code to places is, Hastebin/Pastebin! Thanks for this amazing project keep it up! I may do some tweaks to feed my 50g

    ReplyDelete