Automatic fish feeder

Automatic fish feeder

$5.99
Sale price  $5.99 Regular price 
Skip to product information
Automatic fish feeder

Automatic fish feeder

$5.99
Sale price  $5.99 Regular price 
In Stock. Ready to order — printed when you buy.
Fast fulfillment. Ships after quality check. Trackable delivery.
Easy returns. Shop with confidence — see our return policy.
Secure checkout. Encrypted payment powered by Shopify.

Automatic fish feeder for aquarium tank Atman AR-380.

 

This automatic fish feeder feeds the fish once per day.

 

To make this work you need: 

 - Arduino (Nano)

 - Servo motor (TowerPro SG90)

 - Power supply

 - few cables

 

Below is the code used for this project:

 

#include <Servo.h>

Servo mojServo;

unsigned long vrijemeZadnjegPokretanja = 0;
const unsigned long danUMilisekundama = 86400000; // 24 h = 86,400,000 ms

void setup() {
 mojServo.attach(9);       // servo is connected to pin D9
 mojServo.write(0);        // starting position
 vrijemeZadnjegPokretanja = millis(); // set start time
}

void loop() {
 unsigned long trenutnoVrijeme = millis();

 // if 24 hours have passed
 if (trenutnoVrijeme - vrijemeZadnjegPokretanja >= danUMilisekundama) {

   // servo motor start from 0° to 180°
   for (int kut = 0; kut <= 180; kut++) {
     mojServo.write(kut);
     delay(15); // Polagano okretanje
   }

   // pause briefly if you want him to hold the position for a while
   delay(2000); // 2 second pause

   // rewind from 180° to 0°
   for (int kut = 180; kut >= 0; kut--) {
     mojServo.write(kut);
     delay(15); // slow return
   }

   // update last startup time
   vrijemeZadnjegPokretanja = trenutnoVrijeme;
 }
}

 

 

What this code do:

   - the servo is at rest at 0° 

   -every 24 hours: 

           -it goes from 0° to 180° 

           - pauses for 2 second (can be changed) 

           - it returns from 180° back to 0° 

   - he waits for the next 24 hours

 

Design by Matej123443 on MakerWorld (license: BY-SA).

Customers who viewed this item also viewed