Feeding Experimentation Device 3 (FED3)

Version 3 of our home-cage feeding device, FED.
FED3 includes nosepokes and stimuli for behavioral training.

Public Chat
Similar projects worth following
FED3 is a wireless, battery-powered device designed for home-cage training of mice in operant tasks. Mice interact with FED3 through two nose-pokes, and FED3 responds to the mice with visual stimuli, auditory stimuli, and pellets. FED3 has an analog output that allows it to synchronize with and control external equipment. A screen provides feedback to the user, and all behavioral events are logged to an on-board microSD card. The default code includes 12 built-in programs, but FED3 is open-source and hackable, and can be easily modified to perform other tasks.

This is a battery powered FED device for training rodents in home cages.  FED was developed to free researchers from expensive and rigid behavioral testing equipment, and allow them to do their experiments wherever they'd like - in dedicated boxed, in the home cage, or even inside other scientific equipment.  Importantly, FED3 is open source and new sensors or code can be easily added to change its function.    

The device runs on an Adafruit Adalogger M0 Feather board, which also includes a microSD card slot for recording behavioral data.  The hardware include two "nosepoke" beambreak sensors, a beeper, a multi-color LED strip, a pellet dispenser, a BNC output jack for synchronizing with other equipment, and a screen for providing feedback to the user.   See logs for info on the build, costs, etc.  And as always, feedback is welcome! 

Please join our Google group for troubleshooting and questions.

Funding and license:  This project was funded by the NIH Intramural Research Program (NIDDK).  This project is released under the terms of the Creative Commons - Attribution - ShareAlike 3.0 license:

human readable:

legal wording:

New STL files from May 2020, several tweaks to make things more reliable

x-zip-compressed - 988.52 kB - 05/27/2020 at 02:48


Newest version of code, updated for 1/64 geared 5V stepper

x-zip-compressed - 17.77 kB - 02/03/2020 at 23:05


FED3 quickstart instructions.pdf

A simple instruction guide to FED3!

Adobe Portable Document Format - 410.51 kB - 12/10/2019 at 14:23



Set RTC on FED3 (see instructions for how to use this code)

ino - 6.15 kB - 06/30/2019 at 14:32


Libraries required for FED3, using known working versions: Adafruit_GFX Adafruit_NeoPixel Adafruit_Sharp_Memory_Display RTClib RTCZero SDFat

x-zip-compressed - 4.03 MB - 11/30/2019 at 20:50


View all 14 files

View all 19 components

  • New parts for May 2020

    Lex Kravitz2 days ago 0 comments

    Over the quarantine I've been working on tweaking a few things on the FED3 parts.  This log will go over the new tweaks, which are available in the Files area.

    1.  The back cover latching mechanism has always been a bit hard to use.  I've now put notches in the part to make it easier to take on and off:

    2. The motor mount used a clip, combined with small self-tapping screws.  The screws could cause problems by either stripping the 3D plastic, or tapping in with the motor misaligned.  Either one could run the print.  Now I use two 8mm M4 0.7 threaded bolts with nuts to secure the motor. This is much more reliable and does not risk destroying the print if the screws go in misaligned. Because the bolts work so well I also removed the clip, which makes this part much easier to print.

    Editable TinkerCAD parts are here.

  • Cage insert to protect FED3

    Lex Kravitz03/29/2020 at 15:40 0 comments

    In June of 2019 Zane Andrews and Nino Benci from Monash University posted a cool idea to the FED3 forum.  They used a simple laser-cut piece of acrylic in the cage to block the mice from climbing on the top of FED3, keeping the FED3 cleaner.  Here is a photo of their design, they also provide PDF files for laser cutting in their post linked above:

    I recently re-made this idea to fit in our cages (AllenTown NexGen caging), and put editable 3D print files available here (you can edit them to fit your own caging). I also included small cut-outs for 3x8mm round magnets (the same ones on the front-plate of FED3) to hold it in place. The extra cut-out on the right side is a customization in case you need any wiring to pass from the BNC output jack on FED into the cage (for controlling an LED for instance).

    While 3D printing works fine, these can also be laser cut - I just received these parts from Ponoko for ~$3-5 each for acrylic (black was the cheapest).  I even got it cut in Delrin (bottom piece), which is autoclavable for $9.50.

    The best looking laser cut version I made was to use the 0.5mm thick "Silver on Black Adhesive-Backed Plastic" ($8.77 each) for the front and 3.0mm thick "Black Matte Acrylic" ($5.24 each) for the back.
    The adhesive backed "front" can be carefully aligned and stuck to the back, and 8mm x 3mm round magnets can then be glued into the holes in the back part.  These mate with identical magnets on the FED3.
    Here's a photo in a cage (note that plants are not normally found in our mouse facility... I'm doing all of this testing at home due to the pandemic).

  • Aligning the motor to reduce pellet jams

    Lex Kravitz09/21/2019 at 22:09 0 comments

    The biggest issue with FED is jams, and this video will show one source of them and how to fix it to improve dispensing.  

    The most important thing is to make sure the pellet disk is completely stable inside the hopper.  If you can wiggle it back and forth it's likely the motor is misaligned and the device may jam.  In this case, either take it apart and try to align things better, or you may even need to re-print the FED front.  See video for more info:

    When everything is aligned well FED can dispense reliably.  Here is a timelapse of 1200 pellets being dispensed in a row.  Under normal conditions this would be ~1 week of continuous feeding.  I still recommend checking the FEDs and cleaning crumbs out daily if you run it over multiple days.

  • Quantitative error testing, July 2019

    Lex Kravitz07/11/2019 at 12:34 1 comment

    We have built 6 FEDs using the new STL files and done some quantitative error testing on them.  Specifically, we dispensed 200 pellets from each manually and recorded 4 types of errors.  These included:

    - Pellet "jumps", where the dispensed pellet jumped out of the pellet well, leading to a 2nd pellet dispensed.  n=28/1200 dispenses, 2.3%

    - Double pellets, where the dispensed pellet was not detected, resulting in a 2nd pellet dispensed, n=23/1200 dispenses, 1.9%

    -Jams (self-cleared), where the FED took longer than 10 tries to dispense, activating its self-clearing motor movements, n=9, 0.8%

    -Jams (not cleared), where the FED required experimenter intervention to clear, this did not occur in these tests, n=0!  

    Our next tests will involve mice in cages, stay tuned!  

  • Updated FED3 3D design files for July 2019!

    Lex Kravitz07/09/2019 at 00:01 2 comments

    The last release of STL files was in October of 2018, and I have made many tweaks since then to improve the function of FED.  I have just uploaded a new set of STL files.  These parts result in better dispensing, better aesthetics, and they solve some unexpected problems (like mice stealing SD cards!) 

    These include tweaks to all of the parts, which I'll quickly review here:

    1. Wall Mounts. The front now includes corner insets to hold 8mm magnets for wall mounting. This allows FED3 to be mounted externally on a cage or wall, or be placed inside of it:

    Here are 8 FEDs mounted on plastic boxes in my lab.  Wall mounting keeps the FEDs cleaner but it requires dedicated space to run them.

    2. Option for a metal pellet well.  I included 2 variants of the front file, one (above) that is printed in one piece, as before, and another (in the STL pack) that has the "nose" removed.  This is so the nose can be printed as a separate part in metal to stop mice from chewing on it (I've been doing this commercially through Shapeways at $15 each for the metal part). Here it is in brass (nose-piece STL is in the files area too):

    3. SD card door. The housing now has a sliding door for covering the SD card and USB port (take that, curious mice!)

    It has a nice "click" to it too, see here.

    4. Larger diameter pellet disk.  The diameter of the pellet disk was increased by 2mm to reduce the chance of pellets getting in between the disk and the wall of the pellet hopper, creating a jam.  During assembly, it is important to "center" the disk so it rotates freely.

    5. More reliable hopper. Four significant changes were made to the hopper itself.  First, the pellet "foot" was decreased in size to just cover the dispensing hole.  I found this reduced pellet "grinding".  (Fun fact, this was like this in the FED1 design!)

    Second, I removed the inner "ring" inside the pellet disk.  This was designed to stop pellets from becoming jammed between the pellet disk and the wall of the pellet hopper, but it ended up creating a new place where pellets could become jammed if the hopper was not seated perfectly.  With the wider diameter pellet disk this is no longer necessary.  New (left) vs. old (right):

    Third, I added "feet" to secure the orientation of the hopper correctly. When screwing the hopper on, the feet should align like this:

    Fourth, I reduced the height of the hopper by ~1cm, which will allow FED to fit in even more caging (we had some caging that the old design was just barely too tall to fit in with the lid comfortably closed.  In terms of capacity, the hopper previously fit ~2000 pellets, and now holds ~1500.  This is an estimated drop from ~13 to ~10 days of dispensing, which I think is worth it for the decrease in height. FED3 needs to be checked more often than that anyway so it's sort of a moot point.

    Old (left) vs new (right):

    6. Tessellated lid text! (Update 11-16-19 - while awesome looking, I found that this tessellated text design wasn't ideal as it got dirty really easily and was hard to clean inside the text, I've removed the text in the most recent version in the files area).

    7. Tweaked back cover. Very minor tweaks to improve how it slides, and update the label to FED3 version 1.1!

    If you made it this far here are photos of completed FED3 with the new parts:

  • New programs

    Lex Kravitz05/20/2019 at 16:22 0 comments

    Based on feedback, I've updated the number of programs to 10!  Here are the modes present in the newest version of the code.  Use the left and right pokes at startup to scroll though:

      0 Free feeding
      1 FR1
      2 FR3
      3 FR5
      4 Progressive Ratio
      5 Extinction
      6 Light tracking FR1 task
      7 FR1 (reversed)
      8 PR (reversed)
      9 Optogenetic stimulation
      10 Optogenetic stimulation (reversed)

  • Interfacing FED3 with Bonsai

    Andrew Hardaway04/18/2019 at 20:47 0 comments


    Many of you may be using the FED3 in satellite mode, logging the data locally and extracting it for later analysis. Lex and I wanted to codify a platform where the outputs from the FED3 could be read in real-time and paired with other neural circuit manipulations like fiber photometry that use open source platforms like Bonsai. Briefly, Bonsai is an open source program with near limitless potential to read out and drive multiple pieces of hardware, software and provide you with behavioral or physiological data in real time. All for the low low price of $0. It uses a visual programming language to control different functions which means zero front end coding - the flow of commands appear as nodes that move left to right. Check out and install Bonsai here at

    My goal was to use the FED3 as an operant feeding device reading out the sensors in real time to generate time stamps that I could then extract from fiber photometry data sets. I'm using the Neurophotometrics (NPM) System with 3 LEDs 415, 470, and 560 and a BlackFly Camera. Sage Aronson of NPM provided us with some starting bonsai files to control his system and I've adapted it and combined it with the FED3 bonsai layout. You can access the Bonsai layouts in the Files section above. Ultimately it does 3 things: 1) Talk to the FED3 and generate a timestamp file of the different sensor outputs 2) Talk to another camera to capture video of the chamber and 3) Talk to the NPM and generate fiber photometry signal data in csv format. A simple schematic of the hardware is below. Notably, you will need a separate Arduino to function as an I/O Box for the FED3. 

  • FED3 wall mounting system (take 2!)

    Lex Kravitz03/02/2019 at 20:31 0 comments

    We've recently been re-evaluating the utility of mounting FED externally to a cage or behavioral chamber, rather than placing FED3 in the cage itself.  To faciliate this, we modified the front plate to include 4 magnet holes/mounts, and created a drill guide pattern for modifying the wall of a chamber to mount FED3 to it.  We also used the "mini-hopper", which is available in the files area.  

    For mounting on a chamber or cage, it only requires drilling four 5/16" holes (for magnets) and two 2" holes (with a hole-saw) for the pokes and feeder.  I was able to drill these and insert magnets in about 10 minutes.  Video below, please contact me for modified FED3 front plate design and drill guide.

  • Improved dispensing

    Lex Kravitz02/09/2019 at 18:27 0 comments

    The Achilles heel of any pellet dispenser is pellet jamming.  There are several reasons for a jam, but one of them is that the pellets inside the hopper align in a way that impedes the movement of the dispensing disc.  To combat this issue, I've modified the stepper code to make the stepper "vibrate" while dispensing.  This can help shake up the pellets in the hopper and reduce jams.  

    Please leave feedback in comments if you try this update! 

    This log is also posted here:

  • FED3 for high throughput mouse operant behavior

    bridget.matikainen-ankney01/25/2019 at 23:30 0 comments

    Our lab is interested in how exposure to obesogenic diets might influence the willingness to work for palatable food, or to learn how to acquire such rewards. One way to test aspects of this is to perform an experiment in which a mouse learns to associate a specific task with the delivery of a reward. Since the amount of the reward and the work it takes the mouse to earn it are static in this experiment, it is called a "fixed ratio", or FR. We can then look at how quickly mice who are obese formed these associations compared to lean mice.  Here are the weight curves showing how the "obese" group quickly gained weight on a high fat diet.

    To test whether the obese and lean mice learned to acquire rewards (in this case a sugar pellet) differently, we used FED3 to launch a large-scale FR experiment between lean and obese mice. As  you can see, the FED3 easily sits inside the home cages which are then housed in a rack in the vivarium. 

    (If you look closely you can see some of the cages with green tape on them labelled, "HFD," for high fat diet.)

    We let the FED3s (running the Fixed Ratio program) run overnight, since that is when mice are most active. The next day, we pulled that data from the SD cards in each device, and used python to organize and plot our data. 

    As you can see, the lean mice learned to acquire more sugar pellets than the obese mice. This kind of straightforward experiment would have been very time consuming without FED3, which let us collect this data overnight!

View all 30 project logs

  • 1
    Download Arduino IDE

    Before starting with building anything you should make sure your computer can communicate with the Adalogger M0 board and that you can flash the operant FED sketch.  Start by installing the Arduino IDE.

  • 2
    Install relevant Arduino boards to run the Adalogger M0

    The Adafruit M0 Adalogger board is not natively supported by the Arduino IDE.  To enable the Arduino IDE to flash sketches to this board, follow instructions here.  

    Note: There is an incompatibility between the FED code and Adafruit SAMD board packages >1.5.5.  We don't know why, but while we try to figure it out, just install version 1.5.5 of the Adafruit SAM Board package.

    After completing these steps make sure you can flash the example sketch "Blink" to the Adalogger board before continuing.  Open Blink in File>Examples>Basic>Blink.  "Double-click" the button on the Adalogger to put it in bootloader mode and make sure Board is set to "Adafruit Feather M0" and port is set to the same before clicking upload (the right arrow at the top of the Arduino IDE).

    You should see "Upload complete" in the bottom feedback window and the red LED on the board should blink once per second.  

    Congratulations, you have configured your Arduino IDE and uploaded a sketch to the Adalogger!

  • 3
    Install relevant libraries

     FED3 requires the following libraries:

    #include <Wire.h>

    #include <SPI.h> #include <Stepper.h> #include <RTCZero.h> #include "RTClib.h" #include <SdFat.h> #include <Adafruit_GFX.h> #include <Adafruit_SharpMem.h> #include <Fonts/FreeSans9pt7b.h> #include <Adafruit_NeoPixel.h>

    You can install them in multiple ways, but the simplest will be to download the prepared zip file ( from the files area).  Extract these libraries to your Arduino libraries directory (for most it will be: /Documents/Arduino/libraries

    When you're done they should all be in your libraries directory, see example:

    NOTE: copy these libraries right into the Arduino/libraries folder, not inside another sub directory or the Arduino IDE won't find them.  If this doesn't work, or you'd prefer a different way go through instructions here for how to manually add libraries.

View all 17 instructions

Enjoy this project?



Jay Phansalkar wrote 04/08/2019 at 13:22 point

Really great design, and fun to put  together!

I am having trouble fitting the electronics into the the 3D housing. 

- The holes for the photointerrupters are too small

- The front plate won't click in with the body

- The pellet disk won't fit with the motor

What do you think is the best way to remedy this? Scale up the parts and reprint, or try to make modifications to my existing prints?

Also have you ever encountered the RTC error in which the date uploads as 165/165/2165?

  Are you sure? yes | no

Lex Kravitz wrote 04/08/2019 at 23:05 point

Hi Jay!

Thanks!  The short answer is that this will depend on your 3D printer and the quality of the prints that you are getting with it.  If you are experiencing multiple issues you may want to try using a different printer and see if you get better results.  Or try changing the settings on your printer to try to get better quality prints.  If the parts are only slightly off you can heat them gently with a heat gun and see if it helps them snap together.

I have seen this RTC error, it suggests either the RTC board is disconnected, doesn't have a battery, or isn't set.  Did you follow the instructions on these parts?

Lastly, can post these issues on the FED Google group?  There are other people there who may benefit from these questions.  Please request access here:!forum/fedforum


  Are you sure? yes | no

zane.andrews wrote 04/08/2019 at 01:13 point

Great job on the FED3 system Lex. And massive thanks for all your efforts to help us put these together.

One question - It would be really useful to have a way to change the active poke port. Even a protocol that has FR1-reversed would be super helpful and useful.

  Are you sure? yes | no

Lex Kravitz wrote 04/08/2019 at 23:11 point

Thanks Zane!  I'm exited to see what you do with it!

That's a great suggestion, and I will look into a simple way to implement this.  Adding a reversed FR1 protocol is very simple, I can whip that up for you.

As a more elegant solution for all programs, what do you think about leaving all programs as is, but swapping which poke is active if a user holds both pokes for ~3 seconds or something?  (BTW, that move is currently programmed to reset the FED but I rarely use it so I could re-purpose it...).

Also, could you post this question on the FED Google group?  There are other people there who may benefit from this or have ideas. Thanks!!forum/fedforum

  Are you sure? yes | no

nino.benci wrote 03/11/2019 at 01:38 point

Components list update.

The excel file lists the following LiPo battery;

Adafruit product 354

The component list on this website lists;

Adafruit product 353

The 353 (3.7V 6600mAH) is too big to fit the housing, the 354 (3.7V 4400mAH) is the correct size.

Order the component off the excel list.

  Are you sure? yes | no

Lex Kravitz wrote 04/08/2019 at 02:05 point

Thanks again for catching this Nino - I'm really sorry/embarrassed for all of the errors 8(  It's updated now.

  Are you sure? yes | no

nino.benci wrote 03/03/2019 at 23:13 point

Quick note of advice, the following items are incorrect... "2mm pitch headers" do not fit the 2.5mm pitch of the pin headers...

2mm Pitch Female Headers

I ordered the kit components and have just found out ( did not do a check, thought the parts numbers were correct )

The following are actually 2.5 mm ( 0.1 inch )

2 mm Pitch Short Male Headers


  Are you sure? yes | no

Lex Kravitz wrote 03/04/2019 at 01:21 point

Shoot I'm sorry about that, I'll update the part number right away.  Please let me know if you detect any other errors, thanks in advance!

  Are you sure? yes | no

Lex Kravitz wrote 10/07/2018 at 23:26 point

Thanks Sophi!  Yeah I need to do a few more videos and finish the instructions, hopefully I'll find time for that this week!

  Are you sure? yes | no

Sophi Kravitz wrote 10/06/2018 at 22:43 point

FED 3! Hooray! Two mouse pokes in one package is impressive and so is the build. Very clean. Awesome job on the video too! Next time do the video with a mouse :D

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates