Automatic Arduino Food Dispenser - Fish Feeding Solution

by Alex-08 in Circuits > Arduino

70 Views, 0 Favorites, 0 Comments

Automatic Arduino Food Dispenser - Fish Feeding Solution

Sin título.jpg

🐠🏝️ Have you ever wondered how to make sure your fish get their meals while you're away on work or vacation? I found myself in that exact situation, wanting to keep my aquatic buddies well-fed and happy. 💭🐟

🛠️ DIY Innovation: That's when I had a lightbulb moment—why not create an automated fish feeder using Arduino? After doing some research, I came across various DIY feeder ideas. But I wanted something with precise control over feeding times. So, armed with Autodesk Fusion, I set out to make a feeder tailored to my fishy friends' needs. 🤖🌊

🤔 Interested in joining the adventure?

Supplies

WhatsApp Image 2024-06-24 at 23.06.08.jpeg
WhatsApp Image 2024-06-24 at 23.06.09 (1).jpeg
WhatsApp Image 2024-06-24 at 23.06.09.jpeg
WhatsApp Image 2024-06-24 at 23.06.10 (1).jpeg
WhatsApp Image 2024-06-24 at 23.06.10.jpeg
  •    Arduino UNO
  •    Arduino power adapter
  •    Motor driver and stepper motor (28BYJ-48)
  •    Hot glue gun
  •    Fish tank
  •    Fish pellets

3D-printed parts:

  • Dispenser wheel
  • Dispenser plate and lid

Designing the Rotating Feeding Mechanism

fish2.png
fish1.png

I used Autodesk Fusion to design two 3D-printed parts essential for the feeding mechanism: the “Dispenser-wheel” and the “Dispenser-plate”. Here's a detailed explanation of each part and their functionality:

  1. Dispenser-Wheel:
  • Design Features: It is a circular disc with 14 evenly spaced wells or compartments around its perimeter. Each well is designed to hold a specific amount of fish pellets.
  • Capacity and Schedule: With 14 wells, the design allows for feeding the fish twice a day for a total of 7 days (one week). Each well corresponds to one feeding session.
  • Material Considerations: It is designed to be sturdy yet lightweight, ensuring that it can be easily rotated by the motor without requiring excessive torque.
  1. Dispenser-Plate:
  • Design Features: The “Dispenser-Plate” is a stationary component that sits underneath the "Dispenser-Wheel". It has a single hole positioned strategically to align with the wells. This is important to ensure that only one well’s worth of pellets is dispensed at a time.
  • Functionality: As wheel rotates, each well moves over the hole in the plate. When a well reaches the hole, the pellets fall through the hole and are dispensed into the fish tank.
  1. Dispenser-Lid: I have designed it for ensuring that no dust enters into the compartments with the pellets.

The operation is similar that of a classic carousel or Ferris wheel toy, where a central rotation mechanism spins a circular structure housing individual compartments or seats.

Much like how a Ferris wheel delivers a passenger to a designated exit point, this mechanism ensures the precise, controlled dispensing of one well of pellets per feeding session.


Here you can download the files:

Connect the Motor Driver and Stepper Motor to the Arduino

WhatsApp Image 2024-06-24 at 23.06.09 (2).jpeg
WhatsApp Image 2024-06-24 at 23.06.12.jpeg
WhatsApp Image 2024-06-24 at 23.06.11.jpeg
WhatsApp Image 2024-06-24 at 23.06.12 (1).jpeg
WhatsApp Image 2024-06-24 at 23.06.09 (3).jpeg
WhatsApp Image 2024-06-24 at 23.06.11 (2).jpeg
WhatsApp Image 2024-06-24 at 23.06.10 (3).jpeg
WhatsApp Image 2024-06-24 at 23.06.11 (3).jpeg
WhatsApp Image 2024-06-24 at 23.06.10 (2).jpeg
WhatsApp Image 2024-06-24 at 23.06.11 (1).jpeg
WhatsApp Image 2024-06-24 at 23.02.20(1).jpeg
WhatsApp Image 2024-06-24 at 23.02.20.jpeg
WhatsApp Image 2024-06-24 at 23.02.20(2).jpeg

To operate a stepper motor with an Arduino, it is essential to use a motor driver. The primary reason is that the Arduino's output pins cannot supply enough current (amps) to engage the stepper motor's coils effectively. I chose this specific stepper motor and driver because they can operate on 5V, which the Arduino can supply.

Connect the Stepper Motor to the Motor Driver:

  • Use the white connector to plug the stepper motor into the motor driver. Ensure the connection is secure and matches the pin configuration.

Connect Arduino Output Pins to Motor Driver:

  • Connect Arduino pin 8 to motor driver input pin 1N1.
  • Connect Arduino pin 9 to motor driver input pin 1N2.
  • Connect Arduino pin 10 to motor driver input pin 1N3.
  • Connect Arduino pin 11 to motor driver input pin 1N4.
  • This configuration ensures the Arduino can control the stepper motor's movement by sending signals to these pins.

Power the Motor Driver:

  • Connect the Arduino’s GND pin to the motor driver’s power ground pin (usually labeled as "-").
  • Connect the Arduino’s 5V pin to the motor driver’s power positive pin (usually labeled as "+").
  • Make sure these connections are correct to prevent any damage to the components.

Connect the Arduino to Your Computer:

  • Plug the Arduino’s USB port into your computer using a USB cable.
  • Start the Arduino IDE on your computer.
  • Ensure that the Arduino is correctly recognized by the IDE by selecting the appropriate board and port under the "Tools" menu.

Program the Arduino Feeding System

fish3.jpg

The purpose of this simple code is to control the stepper motor using the Arduino stepper.h library to rotate the turn table by one well, thereby dispensing the next set of food into the fish tank.

Stepper Motor Control:

  • The code utilizes the Stepper library to control the stepper motor connected to the turn table.
  • With the Stepper object initialized as myStepper, the code specifies the number of steps per revolution of the stepper motor (stepsPerRevolution) and the pins to which the stepper motor coils are connected (pins 8 through 11).

Setup Function:

  • In the setup() function, the code sets the speed of the stepper motor using the setSpeed() method of the myStepper object. The speed value (60 in this case) can be adjusted based on the specific requirements of the application.

Loop Function:

  • The main functionality of rotating the turn table is implemented within the loop() function.
  • The myStepper.step(stepsPerRevolution) command is used to rotate the stepper motor by one step, effectively moving the turn table by one well.
  • After each rotation, a delay of 1 second (delay(1000)) is included. This delay serves as a troubleshooting measure to observe the stepper motor's movement. It allows you to ensure that the stepper motor is functioning correctly and moving smoothly.
// Include the preexisting stepper library to enable commands like "myStepper.setSpeed()" and "myStepper.step()"
#include <Stepper.h>

// Define the number of steps in one revolution of the motor.
// For the 28BYJ-48 motor, it has 2048 steps per revolution.
// Make sure to adjust this value according to your motor specifications.
const int stepsPerRevolution = 2048;

// Initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  // Set the speed of the stepper motor to 10 RPM (adjust as needed):
  myStepper.setSpeed(10);
}

void loop() {
  // Rotate the stepper motor by 146 steps, which is 1/14th of a full rotation.
  // Since there are 14 wells, this indexes the feeder by one space.
  myStepper.step(146);

  // Turn off the power to the stepper motor coils to conserve energy and prevent overheating.
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);

  // Pause for 8 hours before the next feeding cycle.
  delay(28800000); // 8 hours delay
 
  // Rotate the stepper motor again by 146 steps to index the feeder for the next feeding cycle.
  myStepper.step(146);

  // Turn off the power to the stepper motor coils again for energy conservation.
  digitalWrite(8, LOW);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);

  // Pause for 16 hours until the next feeding cycle (assuming twice-daily feeding).
  delay(57600000); // 16 hours delay
}



  • I have included some comments advising you to check the wiring connections if the stepper motor is only twitching instead of rotating smoothly. Specifically, verifying that the wires connected to pins 8 through 11 are correctly placed and securely connected to the stepper motor coils.
  • Additionally, I reccomend troubleshooting with a delay of 1 second to observe the stepper motor's movement. This can help identify any issues with the wiring connections or stepper motor control.

This code provides a simple yet effective solution for controlling a stepper motor to rotate the "dispenser-wheel", facilitating the dispensing of fish food into the tank.

Assembly Instructions

WhatsApp Image 2024-06-25 at 01.31.22 (1).jpeg
WhatsApp Image 2024-06-25 at 01.31.22 (2).jpeg
WhatsApp Image 2024-06-25 at 01.31.22 (3).jpeg

Prepare the Surfaces:

  • Sand down the two faces that will slide against each other to ensure smooth movement. This step is crucial for preventing friction and ensuring the components move seamlessly.

Attach the Plate:

  • Use a small amount of hot glue to securely attach the "Dispenser-Plate" to the face of the stepper motor. Ensure proper alignment to facilitate smooth rotation.

Mount the Turn Table:

  • Press the "Dispenser-Wheel" onto the shaft of the stepper motor. Ensure it is firmly seated and properly aligned with the Plate.

Check for Smooth Movement:

  • Perform a full rotation to ensure that the components move smoothly. Adjust the height of the wheel if necessary to prevent excessive friction against the plate while rotating.

Test the Feeding Mechanism:

  • Load the feeder with fish food pellets.
  • Execute a test feed to ensure the mechanism dispenses the food properly into the tank.

Mounting Components

WhatsApp Image 2024-06-25 at 01.31.22.jpeg

Positioning Components:

  • Use hot glue to attach the Arduino, motor driver board, and feeder to the outside of the tank.

Power Connection:

  • Power the board using a USB cord connected to an outlet. Use a standard Arduino power supply for consistent power delivery.

Final Testing and Setup

  • Observe the system's performance over a period, ensuring that it consistently dispenses food at the programmed intervals.
  • If any issues arise during testing, troubleshoot and make adjustments as needed. This may include fine-tuning the stepper motor's rotation, checking wiring connections, or recalibrating the feeding schedule.


Congratulations on reaching the finish line with your fish feeder project! 🎉 With these final tests and setup, your aquatic buddies are in for a treat with their new automated feeding solution. 🐠💦

Through careful assembly and testing, we've crafted a reliable system that ensures fish are well-fed even when you're away. It's a wonderful feeling knowing you can provide for your underwater friends with just the push of a button. 🌟💧

Now sit back, relax, and enjoy the peace of mind that comes with knowing your fish are taken care of, no matter where you are. Bye! 🐠✨