bbox_controller
Collection of behavioral stimuli and paradigms for use with mouse behavior boxes.
https://github.com/brain-development-and-disorders-lab/bbox_controller
Science Score: 52.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
✓Institutional organization owner
Organization brain-development-and-disorders-lab has institutional domain (sites.wustl.edu) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.8%) to scientific vocabulary
Repository
Collection of behavioral stimuli and paradigms for use with mouse behavior boxes.
Basic Info
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 4
Metadata Files
README.md
Behavior Box Controller
This repository contains the code to control a behavior box utilizing IO and displays.
Control Panel
The control panel facilitates wireless monitoring and control via Websockets. To launch the control panel, run ./start.sh, located in the control_panel directory.
Use the Connection frame to connect to the device using an IP address and port number. The Console frame shows the live console output from the device. The Input Status frame shows the current state of the device IO with low latency. The Test Status frame allows the IO to be tested, specifically the water delivery, levers, and the IR beam.
Experiment Management
Basic Experiments: To run a basic experiment, enter the animal ID in the Experiment Management frame and click the Start button.
Timeline Experiments: For advanced experiment protocols, use the timeline management system:
- Click Edit Timeline to open the timeline editor
- Create custom experiment protocols with multiple trial types
- Save and manage timelines
Device
Simulation
You can run the device in simulation mode for development and testing without physical hardware. Simulation mode is activated automatically if hardware libraries (e.g., gpiozero) are unavailable.
Controls in Simulation Mode
- 1: Left Lever (hold to press)
- 2: Right Lever (hold to press)
- 3: Nose Poke (hold to activate)
- Space: Nose Poke (alternative)
- J: Left Lever Light
- K: Nose Poke Light
- L: Left Lever Light
- ESC: Exit
Hardware Usage
The device controller runs only on the device and the device controller must be on the same network as the control panel software in order to communicate. This is accomplished by setting the Raspberry Pi to act as a wireless access point (AP) and connecting to it directly.
Starting the Device and Access Point
The startup script is located in the src/device directory. To start both the WiFi Access Point and the device controller, run:
bash
sudo ./start.sh
For testing to avoid SSID conflicts, use the --test flag:
bash
sudo ./start.sh --test
This is the only script you need to run. It will automatically set up the AP, launch the device controller, and handle all dependencies and logging. All logs are saved in the logs/ directory.
Log Files
The startup script generates three log files in the src/device/logs/ directory:
startup.log- Main startup script execution and WiFi AP setupap.log- WiFi access point configuration and statusrun.log- Device controller runtime output and experiment data
Default WiFi Access Point Settings
- SSID:
BehaviorBox_0 - Password:
behaviorbox0 - Device IP Address:
192.168.4.1
These are the default credentials for connecting to the device's WiFi network.
Data Files
Data files are stored under the src/device/data directory in individual JSON files named [Animal ID]_[Date]_[Time].json. A data file is generated for each experiment run. Currently, data files are only stored locally and must be copied via USB or uploaded online to platforms such as Box or RIS. All timestamps use ISO 8601 format (YYYY-MM-DDTHH:MM:SS.microseconds). The major headings within a data file are listed below, and an example is also shown.
experiment_metadata
Contains metadata about the experiment session including animal identification, timing, configuration parameters, and the experiment definition with trial specifications.
experiment_trials
Records all trials during the experiment, including behavioral events, trial outcomes, and timings. Each trial contains a chronological sequence of events with timestamps.
experiment_statistics
Provides summary statistics for the entire experiment session, including counts of lever presses, nose pokes, and water deliveries.
Example Output:
json
{
"experiment_metadata": {
"animal_id": "test_00",
"experiment_start": "2025-08-29T11:12:18.836449",
"experiment_end": "2025-08-29T11:12:35.709546",
"config": {
"iti_minimum": 100,
"iti_maximum": 1000,
"response_limit": 1000,
"cue_minimum": 5000,
"cue_maximum": 10000,
"hold_minimum": 100,
"hold_maximum": 1000,
"valve_open": 100,
"punish_time": 1000
},
"experiment_file": {
"name": "Test Experiment",
"trials": [
{
"type": "Stage3",
"id": "Stage3_0",
"parameters": {
"cue_duration": 5000,
"response_limit": 1000,
"water_delivery_duration": 2000
}
}
],
"version": "1.0",
"loop": true
}
},
"experiment_trials": [
{
"trial_outcome": "success",
"events": [
{
"type": "left_lever_press",
"timestamp": "2025-08-29T11:12:26.558849"
},
{
"type": "nose_port_entry",
"timestamp": "2025-08-29T11:12:28.607925"
},
{
"type": "reward_triggered",
"timestamp": "2025-08-29T11:12:30.101765"
}
],
"trial_start": "2025-08-29T11:12:31.892916",
"trial_end": "2025-08-29T11:12:31.892917",
"trial_type": "trial_stage_3"
}
],
"experiment_statistics": {
"nose_pokes": 3,
"left_lever_presses": 2,
"right_lever_presses": 2,
"trial_count": 4,
"water_deliveries": 1
}
}
Version Tracking
The device code includes version tracking to help identify which version is running on the device. The version is stored in the shared module and is displayed on the device screen and logged in the control panel.
Issues and Feedback
Please contact Henry Burgess henry.burgess@wustl.edu for all code-related issues and feedback.
License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Owner
- Name: Brain Development and Disorders Lab
- Login: Brain-Development-and-Disorders-Lab
- Kind: organization
- Email: corpuscallosumresearch@wustl.edu
- Location: United States of America
- Website: https://sites.wustl.edu/richardslab
- Twitter: ccd_research
- Repositories: 3
- Profile: https://github.com/Brain-Development-and-Disorders-Lab
Brain Development and Disorders Lab at Washington University School of Medicine, Department of Neuroscience, St. Louis MO
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you use this software, please cite it as below." authors: - family-names: "Burgess" given-names: "Henry" orcid: "https://orcid.org/0000-0002-3481-952X" title: "BBox Controller" version: 0.0.1 date-released: 2025-02-25 url: "https://github.com/Brain-Development-and-Disorders-Lab/bbox_controller"
GitHub Events
Total
- Delete event: 16
- Push event: 144
- Pull request event: 27
- Create event: 21
Last Year
- Delete event: 16
- Push event: 144
- Pull request event: 27
- Create event: 21
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 16
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 16
- Average time to close issues: N/A
- Average time to close pull requests: less than a minute
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- henryjburg (16)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- Pillow *
- adafruit-blinka *
- adafruit-circuitpython-ssd1306 *
- gpiozero *
- tk *