Skip to the content
PCBKitNew board
2 layers72.2 × 50.8 mmSerialValveController, the printed circuit board in 3D

SerialValveController

neurorishika/MultiBiOS

High-precision, hardware-clocked olfactometer control system for behavioral neuroscience

Size
72.2 × 50.8 mm
Copper layers
2
Thickness
1.6 mm
Parts
25
Nets
23
Pads
81
Tracks, vias
193, 3
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
21 Aug 2025
Updated
2 Jun 2026

Overview

SerialValveController is an open-source printed circuit board by neurorishika, from the neurorishika/MultiBiOS repository on GitHub, published under the MIT licence. It is a 2-layer board of 72.2 × 50.8 mm with 25 parts on 23 nets, routed with 193 tracks and 3 vias.

It is built around the TPIC6595N and 1N4757A. Its parts include 6 resistors, 5 connectors, 3 capacitors, 2 diodes and 1 IC. It belongs with the NXP (LPC, Kinetis, i.MX RT) boards of this library.

Main components

2

README

README.md

MultiBiOS: Precision Olfactometer Control System

MultiBiOS Logo

Python License Documentation GitHub issues GitHub stars

High-precision, hardware-clocked olfactometer control system for behavioral neuroscience

📚 Documentation • 🚀 Quick Start • 🔧 Installation • 📖 Examples • 🤝 Contributing


🧪 Overview

MultiBiOS (Multispecies Bilateral Odor delivery System) is a precision olfactometer control system designed for behavioral neuroscience experiments. It provides sub-millisecond timing control, complete experimental reproducibility, and comprehensive data logging.

✨ Key Features

  • 🎯 Sub-millisecond precision with hardware-clocked timing via NI-DAQ
  • 🔄 Bilateral valve control for complex comparative experiments
  • 📊 Complete data provenance with comprehensive logging and replay
  • 🛡️ Built-in safety guardrails prevent timing conflicts at compile-time
  • 🎲 Reproducible randomization via configurable random seeds
  • 📈 Interactive visualization with real-time and post-hoc analysis
  • ⏱️ Real-time progress monitoring shows expected protocol state during execution
  • 🔌 Teensy 4.1 firmware for microsecond-precise valve preloading
  • 📝 YAML protocols for human-readable experimental descriptions

🏗️ System Architecture

text
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   YAML Protocol │───▶│ Python Compiler │───▶│   NI-DAQ USB    │
│   Description   │    │   & Runner      │    │    6353         │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                                        │
                                                        ▼
                              ┌─────────────────────────────────────┐
                              │          Teensy 4.1 MCU             │
                              │    (Valve Pattern Preloading)      │
                              └─────────────────────────────────────┘
                                                │
                                                ▼
                              ┌─────────────────────────────────────┐
                              │       TPIC6B595 Shift Registers    │
                              │         (10MHz SPI Chain)          │
                              └─────────────────────────────────────┘
                                                │
                                                ▼
                              ┌─────────────────────────────────────┐
                              │      Olfactometer Valve Arrays     │
                              │    (8-valve bilateral control)     │
                              └─────────────────────────────────────┘

🚀 Quick Start

Prerequisites

  • Conda or Miniconda
  • NI-DAQmx drivers (for hardware execution)
  • Spinnaker SDK 4.3.0.189 installed on Windows before installing PySpin
  • If you want live Blackfly input in FicTrac on this rig, build a Spinnaker-enabled FicTrac binary and configure the fictrac block in config/hardware.yaml

Installation

bash
# Clone the repository
git clone https://github.com/neurorishika/MultiBiOS.git
cd MultiBiOS

# Create the shared NI-DAQ + Blackfly camera environment
conda env create -f environment.yml
conda activate multibios-blackfly

# Verify the combined stack
python -c "import multibios, nidaqmx, PySpin; print('multibios-blackfly ready')"

# Optional app smoke tests
multibios-explorer --help
multibios-flow-monitor --help

This environment is intended to run both the MultiBiOS DAQ stack and the Blackfly camera scripts in one place. The rig camera model is Teledyne FLIR Blackfly S BFS-U3-13Y3M.

For live FicTrac on the Blackfly side camera, see docs/fictrac.md. MultiBiOS now prepares the Spinnaker runtime DLL path automatically before launching FicTrac, but you still need a FicTrac binary built with the upstream PGR_USB3 option.

If you are on this workstation and want the same validated build that was used for the Blackfly side camera, run:

powershell
cd C:\Rishika\MultiBiOS
.\tools\build_fictrac_spinnaker.ps1 -VcpkgRoot C:\Users\markd\vcpkg

The resulting binary is expected at assets/fictrac-spinnaker/fictrac-spinnaker.exe. The step-by-step build and usage guide lives in docs/fictrac.md.

FicTrac is treated as vendored source in this repo because MultiBiOS carries source-level patches in assets/third_party/FicTrac. The local build directory assets/third_party/FicTrac-build should remain untracked.

Your First Protocol

  1. Preview a protocol (no hardware required):

    bash
      python -m multibios.run_protocol \
       --yaml protocols/example_protocol.yaml \
        --hardware config/hardware.yaml \
        --dry-run --interactive
  2. Run on hardware (requires NI-DAQ setup):

    bash
      python -m multibios.run_protocol \
       --yaml protocols/example_protocol.yaml \
        --hardware config/hardware.yaml
  3. Run with real-time progress monitoring:

    bash
      python -m multibios.run_protocol \
       --yaml protocols/example_protocol.yaml \
        --hardware config/hardware.yaml \
        --verbose --progress

    This displays the expected protocol state during execution:

    text
    DO Legend: [0:RCK] [1:LOAD_REQ] [2:S0] [3:S1] [4:S2]
    AO Legend: [0:MFC1] [1:MFC2]
    [  5%] 250.0ms | DO:░█░░█ | AO:0:2.50,1:1.20
    [ 10%] 500.0ms | DO:█░█░░ | AO:0:3.00,1:1.50

    (█=HIGH, ░=LOW, shows all channels at once!)

  4. Analyze results:

    bash

python -m multibios.viz_protocol data/runs/latest

text
## 📖 Examples

### Simple Bilateral Odor Delivery

```yaml
protocol:
name: "Bilateral Odor Comparison"
timing:
 sample_rate: 1000  # 1 kHz sampling
 seed: 42          # Reproducible randomization

sequence:
- phase: "Baseline"
 duration: 30000   # 30 seconds
 times: 1
 actions:
   - device: "olfactometer.left"
     state: "AIR"
     timing: 0
   - device: "olfactometer.right"
     state: "AIR"
     timing: 0

- phase: "Odor Presentation" 

Advanced Multi-Device Coordination

yaml
sequence:
  - phase: "Complex Trial"
    duration: 45000
    times: 10
    actions:
      # MFC setpoints
      - device: "mfc.air_left_setpoint"
        value: 2.1  # Volts
        timing: 0
      
      # Synchronized valve switching  
      - device: "olfactometer.left"
        state: "ODOR1"
        timing: 5000
      - device: "switch_valve.left"
        state: "ODOR" 
        timing: 5100  # 100ms later
        
      # Continuous camera triggers
      - device: "triggers.camera_continuous"
        state: true
        timing: 1000
      - device: "triggers.camera_continuous" 
        state: false
        timing: 40000

🔧 Hardware Setup

Required Components

ComponentDescriptionQuantity
NI USB-6353Hardware-clocked DAQ1
Teensy 4.1Microcontroller for valve control1
TPIC6B595High-power shift registers4
Olfactometer valvesPneumatic valves (12V)8-16
Mass flow controllersPrecision flow control2-4

Wiring Overview

text
NI-DAQ ────┐
           ├─── LOAD_REQ (Hardware clock)
           ├─── S-bits (Device selection) 
           ├─── Analog I/O (MFC control)
           └─── Triggers (Microscope/Camera)

Teensy ────┐
           ├─── SPI Chain (10MHz)
           ├─── Interrupt handling
           └─── Safety interlocks

TPIC6B595 ─┼─── Valve Array Left
           ├─── Valve Array Right  
           ├─── Switch Valve Left
           └─── Switch Valve Right

📋 Complete wiring diagrams and setup instructions →

📊 Data Output

MultiBiOS provides comprehensive data logging:

Generated Files

text
data/runs/2025-08-21_14-07-33/
├── protocol_original.yaml      # Original protocol
├── protocol_compiled.yaml      # Compiled with timing  
├── hardware_config.yaml        # Hardware configuration
├── digital_output.npy          # DO timing arrays
├── analog_output.npy           # AO setpoints
├── analog_input.csv            # MFC feedback (if recorded)
├── timing_log.csv              # Execution timestamps
└── visualization.html          # Interactive plot

Interactive Visualization

The system generates rich interactive plots showing:

  • 📈 Commanded vs actual valve states
  • 🎛️ Analog input/output traces
  • ⏱️ Timing precision analysis
  • 🔍 Zoom and pan capabilities

🧪 Use Cases

MultiBiOS is designed for:

  • Behavioral choice experiments with precise odor timing
  • Optogenetics with synchronized light/odor delivery
  • Calcium imaging with triggered acquisition
  • Electrophysiology with sub-millisecond precision
  • Multi-animal comparative studies
  • Reproducible protocols across labs and sessions

🛡️ Safety & Reliability

Built-in Safeguards

  • ✅ Compile-time validation prevents hardware conflicts
  • ✅ Timing guardrails ensure safe valve switching
  • ✅ State verification with sticky S-bit monitoring
  • ✅ Hardware interlocks prevent damage
  • ✅ Complete logging for audit trails

Experimental Reproducibility

  • 🎯 Deterministic randomization with configurable seeds
  • 📝 Complete parameter logging
  • 🔄 Protocol replay capability
  • 📊 Timing validation and verification
  • 🏷️ Version tracking of all components

📚 Documentation

Comprehensive documentation is available at neurorishika.github.io/MultiBiOS

Quick Links

🤝 Contributing

We welcome contributions! MultiBiOS is built for the neuroscience community.

Ways to Contribute

  • 🐛 Report bugs and request features
  • 💡 Submit improvements to code or documentation
  • 🧪 Share protocols and use cases
  • 🔧 Hardware modifications and extensions
  • 📚 Documentation improvements

Getting Started

bash
# Fork the repository on GitHub
git clone https://github.com/yourusername/MultiBiOS.git
cd MultiBiOS

# Install development dependencies
poetry install --with dev

# Run tests
poetry run pytest

# Format code
poetry run black multibios/
poetry run ruff check multibios/

Test And Tool Layout

  • tests/ is reserved for automated pytest coverage.
  • tools/manual_checks/ is for operator-facing hardware checks, probes, and bench scripts that are meant to be run directly.
  • When adding new validation code, put reusable automated assertions under tests/ and keep live camera, DAQ, MFC, or FicTrac helpers under tools/manual_checks/.

For a quick automated smoke pass from the repo root, run:

bash
pytest tests/

📖 Full contributing guide →

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

MultiBiOS was developed for the neuroscience research community. Special thanks to:

  • The Ruta and Kronauer Labs for requirements and testing
  • National Instruments for DAQ hardware support
  • The Arduino/Teensy community for firmware foundations
  • Open source contributors who make science better

📞 Contact


🧠 Built for Neuroscience • 🔬 Made with Science • 🚀 Open Source

⭐ Star this repo • 📖 Read the docs • 🤝 Contribute

Parts

25
QtyValueFootprintReferences
533ΩResistor_SMD:R_0603_1608MetricR3, R4, R5, R6, R7
4TestPointTestPoint:TestPoint_Pad_2.0x2.0mmTP1, TP2, TP3, TP4
210ufCapacitor_SMD:C_0603_1608MetricC3, C4
21N4005Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD1, D2
21N4757A1N4757:DIODE_AFL-W2Y1.8D_MOTCR1, CR2
2MountingHoleMountingHole:MountingHole_3.2mm_M3_DIN965_PadH1, H2
2Screw_Terminal_01x021935310:PHOENIX_1935310J1, J2
2TST-105-01-X-DTST-105-01-G-D:SAMTEC_TST-105-01-X-DJ18, J19
10.1uCapacitor_SMD:C_0603_1608MetricC2
110kResistor_SMD:R_0603_1608MetricR1
1Conn_01x05_SocketConnector_PinSocket_2.54mm:PinSocket_1x05_P2.54mm_VerticalJ17
1TPIC6595TPIC6B595N:DIP254P762X508-20U1

Questions

How big is the SerialValveController PCB?

It measures 72.2 × 50.8 mm and has 2 copper layers, 1.6 mm thick.

What parts does the SerialValveController use?

25 parts, built around the TPIC6595N and 1N4757A. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the SerialValveController KiCad files?

From the neurorishika/MultiBiOS repository on GitHub, at the commit this page was made from: the board is rig/electrical/SerialValveController/SerialValveController.kicad_pcb and its schematic rig/electrical/SerialIndicationTerminator/SerialIndicationTerminator.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the SerialValveController design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

More from neurorishika/MultiBiOS

3
  • 2 layersSerialOlfactometerController, the printed circuit board in 3D

    SerialOlfactometerController

    neurorishika/MultiBiOS

    High-precision, hardware-clocked olfactometer control system for behavioral neuroscience

    42 partsMIT
  • 2 layers118.4 × 28.7 mmSerialIndicationTerminator, the printed circuit board in 3D

    SerialIndicationTerminator

    neurorishika/MultiBiOS

    High-precision, hardware-clocked olfactometer control system for behavioral neuroscience

    32 partsMIT
  • 2 layers111.1 × 86 mmTeensyOpenLoop, the printed circuit board in 3D

    TeensyOpenLoop

    neurorishika/MultiBiOS

    High-precision, hardware-clocked olfactometer control system for behavioral neuroscience

    25 partsMIT

Similar boards

  • 2 layers281.9 × 90.4 mmSevenSegmentClockV2, the printed circuit board in 3D

    SevenSegmentClockV2

    atomic14/supersise-seven-segment

    The code, schematics and PCB layout are offered here without any support. It's fun project but it's also a learning experience.

    100 parts5Unlicense
  • 2 layers100 × 99.9 mmPanelized, the printed circuit board in 3D

    Panelized

    SamWarmuth/SWSplitFlap

    3D printable split flap display (software/pcb/STLs), for a more detailed split flap project see https://github.com/scottbez1/splitflap

    144 parts4
  • 2 layers220 × 160 mmK Aries, the printed circuit board in 3D

    K Aries

    F6ITU/K_Aries

    Aries, an OpenHPSDR ATU (kicad version)

    275 parts2
  • 2 layers73.7 × 52.1 mmShiftysolenoiddriver, the printed circuit board in 3D

    Shiftysolenoiddriver

    pascalscheffers/signalex

    Code and PCB for driving Signalex 7 Segment Displays.

    14 partsBSD-3-Clause
  • 2 layersBraillekeyboard, the printed circuit board in 3D

    Braillekeyboard

    petengenhariabiomedica/Teclado-de-leitura-em-braile

    Projeto de tecnologia assistiva voltado para pessoas cegas, consiste em um teclado que reproduzirá palavras da tela de um computador em letras em braile.

    231 parts
  • 2 layers97.8 × 38.1 mmNumitron clock, the printed circuit board in 3D

    Numitron clock

    pierreca/numitron-clock

    Simple clock using numitron iv-9 tubes

    19 parts