Interfacing FED3 with Bonsai

A project log for Feeding Experimentation Device 3 (FED3)

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

Andrew HardawayAndrew Hardaway 04/18/2019 at 20:470 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.