FED4 (Feeding Experimentation Device) is an open-source device for training mice. The device provides comprehensive control over feeding experiments, environmental monitoring, and data collection.
- 🔄 Automated pellet dispensing system
- 📊 Real-time data logging
- 🌡️ Environmental monitoring
- 🔋 Power management
- 📱 Interactive display
- 🎵 Audio feedback
- đź’ľ SD card storage
- 🕹️ Touch and button controls
- Sharp Memory Display
- NeoPixel and LED strips
- DS3231 RTC (Real-Time Clock)
- LIS3DH Accelerometer
- Temperature/Humidity Sensor
- Battery Monitor
- Stepper Motor
- Touch Sensors
- Motion Sensor
- Speaker System
bool begin(const char* programName)
- Main initialization function
- Sets up all hardware components
- Returns success/failure status
void run()
- Updates time and display
- Prints status
- Manages sleep cycles
void sleep()
- Timer-based wake-up (6 seconds)
- Sensor polling on wake
- Touch/button handling
bool initializeLDOs()
void LDO2_ON()
void LDO2_OFF()
void LDO3_ON()
void LD
8000
O3_OFF()
- Power rail management
- Component power states
void feed()
void initFeeding()
void dispense()
void finishFeeding()
- Pellet dispensing control
- Status monitoring
- Error handling
bool initializeMotor()
void releaseMotor()
void minorJamClear()
void majorJamClear()
void vibrateJamClear()
- Stepper motor management
- Jam detection and clearing
- Error recovery
bool initializeTouch()
void handleTouch()
void calibrateTouchSensors()
- Capacitive input handling
- Auto-calibration
- Event processing
bool initializeMotionSensor()
void configureMotionSensor()
bool isMotionDataReady()
- Presence detection
- Configurable sensitivity
- Status monitoring
bool initializeAccel()
void setAccelRange()
void setAccelPerformanceMode()
- 3-axis measurement
- Multiple range options
- Power/performance modes
bool initializeDisplay()
void updateDisplay()
void displayTask()
void displayEnvironmental()
- Status visualization
- Menu system
- Environmental data display
bool initializePixel()
bool initializeStrip()
void setPixColor()
- Visual feedback
- Status indication
- Custom patterns
bool initializeSpeaker()
void playTone()
void soundSweep()
- Event feedback
- Custom sound patterns
- Multiple frequencies
bool initializeSD()
bool createMetaJson()
void logData()
- Configuration storage
- Data logging
- File management
bool initializeRTC()
void updateRTC()
DateTime now()
- Time management
- Event timestamping
- Synchronization
bool initializeVitals()
float getBatteryVoltage()
float getTemperature()
float getHumidity()
- System vitals
- Environmental conditions
- Battery monitoring
#include "FED4.h"
FED4 fed;
void setup() {
// Initialize FED4 with program name
fed.begin("MyExperiment");
// Configure settings
fed.setMouseId("M001");
fed.setSex("M");
fed.setStrain("C57BL/6");
}
void loop() {
// Main operation loop
fed.run();
}
Contributions are welcome! Please feel free to submit a Pull Request.
The FED4 library relies on code from Adafruit and Sparkfun, who invest significant time and money developing open-source hardware and software. Please support them!
- Lex Kravitz (Concept and 3D design)
- Paul Price (Electronics design)
- Lex Kravitz
- Matt Gaidica
For support, please open an issue in the GitHub repository or contact the authors directly.
The SD card should include a meta.json file containing metadata for the device. We use bblanchon/ArduinoJson to parse the JSON file. This format is compatible with https://hublink.cloud. Here is the base schema:
{
"subject": {
"id": "mouse001",
"strain": "C57BL/6",
"sex": "male"
},
"fed": {
"program": "Classic"
},
"hublink": {
"advertise": "FED4",
"advertise_every": 300,
"advertise_for": 30,
"disable": false
}
}
Here is an example meta.json for download
These meta data will be parsed in Arduino and other languages as well for post-analysis. Other JSON resources:
Here are some common uses with FED4:
String subjectId = getMetaValue("subject", "id"); // within library
String subjectId = fed.getMetaValue("subject", "id"); // within sketch
You can create a meta.json file in most terminals using:
cd /path/to/your/SD
echo '{"subject":{"id":"mouse001","strain":"C57BL/6","sex":"male"},"fed":{"program":"Classic"}}' > meta.json
This library requires several Arduino libraries for hardware interfacing. See FED4.h for a complete list of dependencies.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
For more information about the FED project, visit https://github.com/KravitzLab