Feeding Experimentation Device (FED) 2.0

FED measures food intake in mice. It is battery powered and designed to be used in rodent colony caging.

Similar projects worth following
FED is a Feeding Experimentation Device for measuring food intake in mice. It is a 3D printed pellet dispensing device that operates with the following logic:
1) Dispense a 20mg food pellet and monitor its presence with a photo interrupter
2) Log the date and time when the pellet is taken by the mouse
3) Repeat

The data is stored to an SD card and can be analyzed after an experiment to understand feeding patterns over multiple days. FED is battery powered and small enough to be used in many experimental conditions, including rodent home cages.

FED2.0 improves on FED1.0 in the following ways:

  1. Smaller, cheaper, and easier to build
  2. More reliable pellet dispensing
  3. Longer battery life - FED2 lasts about 10 days on a charge.  This can be increased quite a bit with some hardware and code changes (message me if you want details) but we prioritized ease of build and use over battery life.
  4. FED2 has a screen!  

FED 2 is a redesign of the original FED device developed by Katrina Nguyen and her colleagues in 2016, and published in the Journal of Neuroscience Methods. FED2.0 runs on an Adafruit Feather Adalogger M0, and uses boards and code from Adafruit, Paul Stoffregen's Time library, and Arturo Guadalupi's ZeroRTC library.  

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:

Improved pellet dispensing

x-zip-compressed - 8.81 kB - 01/21/2019 at 22:25



Code for setting the clock on the Feather RTC

ino - 5.09 kB - 05/26/2019 at 17:32


Python analysis script and example FED data

x-zip-compressed - 37.50 kB - 02/06/2019 at 17:50



Libraries to run FED - unzip to your Arduino/libraries directory

Zip Archive - 3.84 MB - 08/21/2018 at 00:43


Variant that outputs 1s of 20Hz from the BNC connector when pellet is taken

x-zip-compressed - 9.10 kB - 01/14/2019 at 21:03


View all 11 files

View all 17 components

  • New hopper STLs to improve dispensing

    Lex Kravitz07/21/2019 at 14:50 0 comments

    I recently updated the hopper and pellet disk for FED3 to improve dispensing.  Because the hoppers use the same threading these new parts will also fit on FED2!

    There’s a minor consideration with using the new parts - for FED3, the little “feet” click into the housing and ensure that the pellet foot is oriented towards the front of the device.  Photo of FED3:

    The FED2 housing doesn’t have anything for the feet to click into, so make sure it’s oriented with the pellet foot directly forward.  If it’s off center it might result in multiple pellets coming down the pellet shoot.   I could also see it loosening up over time, so keep an eye on that.  

    The motor also has to be more carefully “centered” than with the prior parts, to ensure the disk doesn’t rub on the walls.  It is larger in diameter now so this is more of a concern than with the old disk:

    Use a screw driver through the holes in the bottom to loosen the motor, make sure it's centered and can spin freely all the way around, and then tighten it up!

    Please leave comments if you try this!

  • FED Python analysis package!

    Lex Kravitz02/06/2019 at 18:10 0 comments

    We have recently finished an analysis package for analyzing FED data files in Python.  (Note: by "we", I mean programmer extraordinaire, Ilona Szczot!)  The goals of this analysis package are to provide visualizations and quantification of feeding rates and patterns of mice using FED.

    Background: FED spits out CSV files that update whenever a pellet is taken, resulting in a file of time-stamps:

    Often, we'd rather look at data in a "binned" format, to answer questions like "How many pellets did they eat in the last 2 hours?"  This requires some processing.  

    (Note: we didn't set up FED to bin the data as it is collected because we'd have to pre-specify the bin width to do this, and this may differ between different experiments.)

    Use: We wrote a GUI-based Python analysis package (also available in the Files area) that allows for a user to chose a folder where the FED output files are stored, set the circadian cycle times, choose which dates to analyse, and set the bin size in minutes.  To run:

    1) First dump all of your FED files into a directory.  These can include multiple files from the same FED.

    2) Open the script in Python 3.6 or greater.  I use Spyder to run it.  When you first run the script this window pops up:

    3) Set these variables and click OK.  A second window will pop up which allows you to filter based on mice.  It will default to choosing all of the mice that have data in the folder, but you can limit the analysis to specific mice.

    4) Click "OK" and the script will run, generating a new folder in your data directory, named with the unique name/time-stamp "ResultsMMDD_HHMM_SSs".  This new folder will contain several visualizations, as well as Excel files containing the data underlying these visualizations.  

    Output: The visualizations include individual histograms for each mouse:

    An average histogram of all mice:

    Individual figures for each mouse showing cumulative intake, motor turns, and an "inter-pellet-intervals" histogram.  This histogram tells you about meal patterning.  For instance, here we can see that the mouse consumed ~250 total pellets.  The "motor turns" variable reports how many times FED moved the motor to dispense a pellet - this shows you where jams happen.  <10 turns in OK, if it jams you might see a number >500 turns!  The right plot is the inter-pellet-interval, in minutes.  Here, the peak is at ~30seconds, meaning that this was the most common interval between pellets.  If a manipulation changed the eating rate within means, this peak may shift to the left or right.

    A zip file has been deposited in the files area that contains the Analysis Python script, a readme, and sample data that you can run to generate the above plots.  Feedback is always welcome!

  • Improved dispensing!

    Lex Kravitz01/21/2019 at 17:09 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! 

  • Around the world FEDs!

    Lex Kravitz07/02/2018 at 19:46 0 comments

    We have heard from people building FEDs in several countries, which is great!  These include Canada, France, Switzerland, Germany, S Korea, and several sites in the US!  This log is recognizing where FEDs are going. Please get in touch to put your photos up here!

    James Ousey sent his from Caltech in the USA:

    Lydia Hanna sent this photo from Exeter University in the UK!

    This is actually the FED1.0 design, from Zhenwei Su, Post-Doctoral fellow in Nick Betley's lab at University of Pennsylvania

    And a FED2 from Kristina Wirkowski in the same lab!

    From Sung-Yon Kim's lab at Seoul National University in S. Korea.

    From Stephanie Borgland's lab at the University of Calgary in Canada:

    From Diego Bohorquez's lab at Duke University in North Carolina, USA (this is one of the earliest versions of the original FED):

  • 3D printing tips

    Lex Kravitz06/09/2018 at 13:59 0 comments

    This log will include a few tips on 3D printing FEDs.  Please feel free to add your own tips in the comments!

    1. A note on suppports: The printer we use is cheap and does the job, the Sindoh 3DWox (This is not an endorsement of this printer over other printers BTW, just stating what we use). Because our printer doesn't print "support material", we have designed all of the parts to be printed with as few supports as possible.  When you slice your models to print, it is possible that your software will want to add support.  This may be OK for some parts, but you should remove any supports from inside the pellet "funnel".  Stray plastic in here can cause pellet jams.

    2. Inspect the pellet path for plastic strands.  While it doesn't matter if they are on the housing, the FED is a mechanical device and imperfections in the pellet dispensing area or the pellet funnel can cause jams.  Take care to look this over and make sure there aren't any stray pieces of plastic.  For instance, in yellow I've circled a little piece that can interfere with the movement of the pellet disc in this print:

    3. Different printers can produce parts with different tolerances and slightly different sizes.  In particular, this can be a problem with tight-fitting parts, such as the sliding back door to FED.  If your parts don't slide together nicely you may need to tweak the design a bit to get it dialed in for your printer.  STL files are available in the files area.

  • FED variant #2 - "Triggered on input"

    Lex Kravitz06/05/2018 at 01:06 0 comments

    A colleague asked for a small modification to FED, such that in addition to the output pulse on the BNC connector, it would have a 2nd BNC which it would use as an input.  This input would trigger FED to dispense, but we would still monitor the pellet well and only dispense if it was empty.  This allows FED to act like a "smart" pellet dispenser in operant tasks, such that it not only dispenses a pellet, but detects when it is removed.  

    Feeling a bit lazy, I just drilled a hole in a regular FED instead of reprinting a new base with 2 holes for BNC connectors.  I connected the new BNC to digital pin 5 on the Feather (remember when we put extra 90 degree headers there?), and wrote an updated code to allow for this behavior.  Updated code is available in the files area, to use simply connect the input BNC to pin 5 and ground, and flash the updated code.

  • How to change the timeout between pellets

    Lex Kravitz05/26/2018 at 14:00 0 comments

    We included a timeout between pellets to stop the mice from taking one pellet, dropping it, and immediately grabbing the next one.  We set this to 15 seconds by default but it can be easily changed.  In the "a_header" tab in the Arduino IDE, change the number "15" in this line to update it:

    int timeout = 15; //timeout between pellets in seconds

  • Motor considerations for FED

    Lex Kravitz05/26/2018 at 13:43 1 comment

    We have experimented with several stepper and servo motors to control FED, and we found one that works well for dispensing pellets.  This log will describe a bit of our experience and what to look for if you want to choose a different motor for a pellet dispenser.

    We needed to find a balance between having a motor that is strong enough to move the pellet disk, but also weak enough to not grind up pellets if it encounters resistance.  Grain pellets disintegrate very easily, and create dust that can gum up the works. While stepper motors are a bit more complicated to control than servos (they require a driver board), we found that they are a better choice as all of the servos we tried would grind up pellets and result in pellet jams.  They would typically work for a couple of hours, but after 1-2 days they would look like this

    Obviously this FED can no longer dispense until it is unclogged.  So if you want to experiment with different motors, or designing a different pellet dispenser altogether, we recommend choosing a geared stepper motor that will stall when it encounters resistance, rather than powering through and pulverizing the pellet.  While this can take a bit longer to dispense a pellet, we coded the motor to try dispensing 10 times, and then perform a big movement to dislodge any jammed pellets. 

    As one final point, if you use sucrose pellets they are much harder than the grain pellets and are therefore more resistant to crushing and jamming.

  • (sorta) Mass production!

    Lex Kravitz04/27/2018 at 18:20 0 comments

    We're currently building a group of 12 FEDs -  I'll post how they turn out when we have them all but here are some production pics!

    Update 06-04-18: Here we go, 14 FEDs!

  • Troubleshooting

    Lex Kravitz03/20/2018 at 22:38 0 comments

    This will be a log dedicated to troubleshooting.  I'll edit this post as more issues are identified and (hopefully!) resolved. 

    1. FED code won't compile in the Arduino IDE - errors about RTCZero come up. There is an incompatibility between the code for Pail Stoffregen's Timelib library that is used by FED and an older Time library in the Arduino IDE.  The issue is documented in comments here:  Long story short, to fix this, go to wherever your "Time-master" library is installed (mine was in User\Documents\Arduino\libraries\Time-master), and rename the file "Time.h" to "Time_h.h".  Restart the Arduino IDE and this should fix the issue.
    2. Motor won't turn after building hardware - Check that battery is plugged in and charged.  The motor requires the most current of anything in FED.  When it is low, or if FED is powered by USB without a battery connected, everything else can appear to work but the motor won't receive enough current to turn.
    3. FED keeps spitting out pellets and wont' stop! There are two main reasons why FED may not detect that a pellet has been dispensed:  1) If the photo-interrupter is not correctly in place the pellet may not be detected. Make sure the pellet lands in between the "arms" of the photo-interrupter. 2) The photo-interrupter works by detecting the IR LED in one arm with an IR detector in the other.  If there is a lot of ambient IR light (for instance, if FED is in direct sunlight! the photo-interrupter may not detect the pellet.  We've experienced this issue even indoors, when FED is placed in direct sunlight from a window.
    4. FED takes a while to dispense each pellet. FED will attempt to dispense a pellet and continue trying until it is successful.  If something is impeding the pellet disk from turning, this can take many attempts.  We have found that sometimes a small bit of plastic from the printing will get in the way (see yellow circle below for example).  Watch FED try to dispense with no pellets - if it seems to be getting caught make sure there is nothing impeding the turning of the disk
    5. FED dispenses 2 pellets. In our hands, this happens <1% of the time.  We have found it very hard to reduce this further.  If it is occuring at a higher frequency than this, make sure the photo-interrupter is positioned correctly as it may not be detecting the first pellet.

    Please message me more issues and I'll log solutions here!

View all 16 project logs

  • 1
    Print out the six 3D parts

    The print needs to be of decent quality.  It is a mechanical pellet dispenser, so if your print is poor it may jam or not work correctly.  I printed these in PLA on a Sindoh 3DWox printer.  STL files located in the files area.  

  • 2
    (optional) Spray the 3D parts with clear acrylic

    This is to protect them from mouse gross-ness.  Don't spray the pellet disk.  Also no need to coat the insides of the parts.  Let them dry for a couple days before putting them with mice. 

  • 3
    Add headers to the Adalogger M0 board and the Memory Display

    Solder straight male headers to the Adalogger board, instructions here: 

    Solder six 90 degree headers from Vin to CS pins on the Memory Display. You can plug the 6-wire harness in while soldering to keep the spacing correct.

View all 16 instructions

Enjoy this project?



yuql18 wrote 03/21/2019 at 21:45 point

I got the following error messages when I was uploading, 

Arduino:1.8.9 (Windows Store (Windows 10),...."Adafruit Feather M0"

In file included from E:\Dropbox\S\fiber photometry\FED 2\FED2_012119\FED2_012119\FED2_012119.ino:38:0:

sketch\a_Header.h:5:34: fatal error: Adafruit_MotorShield.h: No such file or directory

compilation terminated.

exit status 1

I am new to FED, can anyone help out?

Many Thanks.

  Are you sure? yes | no

yuql18 wrote 03/27/2019 at 19:23 point

Never mind I figured that a certain library need to be added. Now it works.

  Are you sure? yes | no

Sophi Kravitz wrote 07/16/2018 at 18:15 point

Looks like you updated a lot of these instructions. How'd it go?

  Are you sure? yes | no

Lex Kravitz wrote 07/16/2018 at 19:28 point

So far so good! were any changes made to how images were handled?

  Are you sure? yes | no

Lex Kravitz wrote 05/25/2018 at 13:43 point

Thanks for the comment!  

Degu sound like fun.  I lived with a roommate that had lizards once and the crickets really bothered me too.. not the crickets themselves, but the whole process of buying a clear plastic bag of them from the petstore, listening to them chip all night in their bag, and then putting them in the lizard cage to be eaten a couple at a time... 

If you get more Degu it should be much easier to log the running data with the kinds of things you can buy on Adafruit or Sparkfun these days.  We also made a logging wheel that does just this and will put it on Hackaday soon.  We 3D print the wheel itself and used a hall effect sensor and a magnet to count rotations.

  Are you sure? yes | no

Morning.Star wrote 05/26/2018 at 06:02 point

They are smart and social and very vocal, like guinea pigs. I gather they are related, even though they look like chinchilla and gerbils. Between them yelling all day, and the crickets at night it was a zoo lol.

They are also very destructive, a plastic wheel lasts a matter of a few days before it gets chewed up, and I had to bolt a metal wheel to a metal plate with a bearing somehow. The aluminium drive motor proved inedible ;-)

They also run, and I mean run, a few kilometres every day throughout their lives at speeds up to 5kmh so for a degu it needs to be 10" dia minimum, have decent bearings and a solid mount. Oiling The Degu with olive oil to keep the squeaking down got on my nerves after a fashion... ;-p

I looked into a 'flying saucer' wheel, which apparently had great success with degu because of all that. It's a slightly dished plate on a hub that the degu runs on, not inside, and takes up less room. The pups took to running in teams though, which was hysterical watching them learn to synchronise step.

Definitely worth it :-D

  Are you sure? yes | no

Morning.Star wrote 04/27/2018 at 23:14 point

I used to have a colony of Degu, lovely little things. I bought my daughter a pair of supposedly females after she researched them and bugged me about them relentlessly. This was a lesson well learned, the previous year she asked for a pet and was told small and furry, me expecting a rodent. At the shop she chose a Rose Tarantula, which I grimly paid for as promised. It wasnt so much the pink and furry but its food that bothered me, crickets are nasty. Worse being munched by a million-year-old monster. Yuk...

Then when one of the degu swelled up like a tennis ball with legs and presented us with a litter of pups on New Years Eve, I gave up and put up with a lizard, a snake, several rats, fish, a mantis, and a truly evil gerbil called Goebbels who never learned not to bite. What I called him is unrepeatable ;-)

Those were happier days, I wont go on, but to say your nosepoke device made me laugh and remind me of them. I had plans, I even had an old disk-drive motor as the spindle of a wheel so I could record the miles they run each day as they can live for a decade or more. One did, and lived with my daughter and her partner until a year or two ago but I never got my data.

I wish you luck. If it works out, and is scalable, perhaps it might work on children never mind the pets XD

  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