Search models, users, collections, and posts

Automatic fish feeder

IP Report

Print Profile(1)

All
P1S
H2S
H2C
H2D Pro
X1 Carbon
A1
X1E
X1
H2D
A1 mini
P2S
P1P
X2D
A2L

0.2mm layer, 2 walls, 10% infill
0.2mm layer, 2 walls, 10% infill
2 h
1 plate

Open in Bambu Studio
Boost
46
105
6
6
100
45
Released 

Description

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

 

Comment & Rating (6)

(0/1000)