Food Pellet Dispenser

The dispenser consists of four separate 3D printed components and uses a bipolar stepper motor to dispense individual 45mg food pellets. An infrared break-beam attached to one of the external interrupt pins is used to keep track of how many pellets have been dispensed. The dispenser is designed to be operated with an Arduino using an Adafruit motor driver shield and can be adapted to any other micro-controller and H-bridge.

Parts List

  • 4x - M3x0.5 hex nut (McMaster-Carr part number: 90695A033)
  • 2x - M3 35mm socket cap screw (McMaster-Carr part number: 92095A201)
  • 2x - M3 50mm socket cap screw (McMaster-Carr part number: 92095A475)
  • 1x - 3mm IR break-beam (Adafruit part number: 2167)
  • 1x - Adafruit Motor Shield v2 (Adafruit part number: 1438)
  • 1x - Nema 14 bipolar stepper motor (Pololu part number: 1208)
  • 1x - Arduino Uno R3 (Adafruit part number: 50)

Part Files

Part files can be found on the GitHub project page.

STL files are provided ready to print. The original SOLIDWORKS part files are also availalbe if you wish to make any changes for your application. An assembly file is included to show how the parts assemble, but this should not be used for printing. 

Code Examples

Break-beams are interrupt driven to keep track of the number of pellets dispensed. The Adafruit motor driver library was used to handle the motor control.


void beamBroken_isr(){
  noInterrupts();
  pells--;
  disp++;
  broken = true;
  Serial.println("Beam Broken");
  if(disp == 5){
    disp = 0;
    rot = !rot;
  }
  interrupts();
}

The dispenser is set to switch the direction of the rotor after every five steps. This was found to reduce jamming and crushed pellets. A delay of 100ms was added after each step to help the break-beams to detect individual pellets.


if (f == "disp" || f == "Disp") {
  pellsR = param;
  Serial.print("Dispensing ");
  Serial.print(param);
  Serial.println(" pellets");
  while(pells>0){
    if(rot == false){
      myMotor->step(25, FORWARD, SINGLE);
      delay(100);
    }
    else if(rot == true){
      myMotor->step(25, BACKWARD, SINGLE);
      delay(100);
    }
  }
}

Part Drawings


This food pellet dispenser was developed by Dylan Guenther and Jack Kennedy at Dr. Andrew Maurer's Lab in the McKnight Brain Institute at the University of Florida.


A module has been developed to interface this pellet dispenser directly with Open Ephys. The module can be found under the Third-party plugin repository or at the source: https://github.com/Claybarn/pelletDispenserOutput