Project Info
Inspiration
We believe for AI to truly enable human flourishing, it needs to go beyond software and consumer products. Accelerated science could compress a century’s worth of discoveries and quality of life gains into a decade. Our team is composed of EE, physics, and materials majors interested in next-generation compute, energy storage, therapeutics—and how AI can help get us there. Graphene is an incredibly important material both for use in advanced nanoelectronics and quantum materials research (2D electron system). We knew we wanted to build an autonomous lab for Treehacks, and we realized we could achieve state-of-the-art synthesis methods of graphene flakes with simple hardware since the state-of-the-art is using scotch tape to peel apart the layers. Prof. Mannix and Goldhaber-Gordon in the materials/physics departments pointed us towards Raman spectroscopy and gave us graphite chips to exfoliate.
What it does
AutoLab is an autonomous end-to-end 2D materials discovery solution — from exfoliation to characterization, no human in the loop. Our system exfoliates graphene, identifies candidate flakes, applies controlled strain, and characterizes the resulting material properties using Raman spectroscopy. This is powered by an agentic ecosystem where research agents access SoTA analysis tools and real-world hardware to run end-to-end experiments. The platform connects three layers: Custom hardware -- A graphene stamping/straining jig with stepper motors controlled by a Raspberry Pi running a local VLM. The researcher talks to the jig through natural language prompts. Intelligent vision -- A two-stage CV + Claude Vision hybrid pipeline for real-time flake detection. Local computer vision optimizes contrast and finds candidates in ~30ms, then Claude Sonnet 4 verifies and classifies each one in ~3 seconds. Autonomous orchestration -- Rather than simply automating steps, AutoLab reasons about experiments. Agents can trigger measurements, analyze spectra, detect anomalies, and iterate on experimental parameters—transforming a traditional lab workflow into a closed-loop intelligent system.
How we built it
1. Experiment Design (Frontend) The researcher types an experiment description in plain English: "Prepare 5 graphene samples at 0-4% strain and characterize each with Raman spectroscopy." The orchestrator agent parses this, generates a step-by-step plan, and presents it for approval. 2. Multi-Agent Execution (Backend) Once approved, the orchestrator dispatches tasks to specialized sub-agents: Orchestrator plans experiments, coordinates sub-agents, tracks progress. All sub-agent dispatch. Synthesis controls hardware for sample preparation (exfoliation, stamping). Motor control, hardware interface. Characterization runs and analyzes Raman spectroscopy. Spectrum fitting, peak detection, material ID. Theory Searches literature, builds theoretical models. Semantic Scholar API, calculations. All agents use Claude Sonnet 4 with tool use and stream their thinking in real-time to the frontend via WebSocket. 3. Flake Detection (CV + VLM Pipeline) The microscope feed runs through a two-stage detection pipeline: Stage 1 -- Local CV (~30ms): Automatic contrast optimization (alpha/beta sweep to maximize flake-substrate separation) CLAHE enhancement + Otsu thresholding Contour analysis with area and edge-density filtering Generates candidate bounding boxes Stage 2 -- Claude Vision (~2-3s): Sends contrast-optimized image (512px, 70% JPEG) to Claude Sonnet 4 Claude independently detects flakes using its own vision CV candidates are provided as optional hints, not hard constraints Returns verified detections with confidence scores, bounding boxes, and reasoning 4. Hardware Control (Raspberry Pi + Stepper Motors) A custom graphene stamping/straining jig with: ThorLabs KDC101 motor controller + MTS25-Z8 linear translation stage Direct USB communication via pyftdi using the APT binary protocol (bypasses macOS FTDI VCP driver issues) Precision: 0.001mm (34,304 encoder counts/mm) Raspberry Pi runs a local VLM that accepts natural language commands ("exfoliate at position 3", "apply 2% strain") The RPi agent reports completion back to the web platform, triggering the next pipeline step automatically 5. Raman Spectroscopy Analysis Automated spectral analysis pipeline: Asymmetric Least Squares (ALS) baseline correction scipy.signal.find_peaks for peak detection Multi-Gaussian fitting with scipy.optimize.curve_fit Material-specific labeling (Graphene D/G/2D bands, MoS2 E2g/A1g) LLM-powered interpretation and comparison to literature values
Challenges we ran into
-Strain control: Applying repeatable strain without tearing ultrathin flakes required precise mechanical design. -Signal-to-noise in Raman: Distinguishing meaningful peak shifts (G and 2D bands) from noise required calibration and careful preprocessing. -Detecting outliers (e.g., “Sample 3 looks wrong”) and triggering resynthesis required building a feedback loop rather than a linear pipeline. -Deciding when to stop iterating vs. gather more samples was a core scientific design challenge.
Accomplishments we're proud of
Built a fully closed-loop autonomous materials discovery system. Achieved reliable graphene flake detection in real time. Implemented automated Raman peak fitting and strain quantification. Created an agent architecture capable of iterative experimental reasoning. Successfully integrated real-world hardware with AI orchestration.
What we learned
Autonomy is primarily a systems engineering challenge, not just an AI problem. Scientific workflows are loops, not pipelines. Structured data exchange between agents dramatically improves reliability. Grounding AI reasoning in physics and experimental constraints is essential.
What's next
for AutoLab: Closed-loop optimization of strain parameters using adaptive experimental design. Expansion to additional 2D materials (e.g., MoS2, WS2, heterostructures). Real-time experiment visualization dashboard. Higher-throughput parallel exfoliation modules. Moving toward a fully autonomous self-driving materials lab.
Autolab Labs
Autonomous end-to-end 2D materials discovery -- from exfoliation to characterization, no human in the loop.
Built at TreeHacks 2026.
What It Does
AI Materials Researcher is a multi-agent platform that autonomously executes the entire 2D materials research pipeline. Describe an experiment in plain English -- the system plans it, controls the hardware, detects flakes, runs spectroscopy, searches literature, and generates a full report.
The platform connects three layers:
- Custom hardware -- A graphene stamping/straining jig with stepper motors controlled by a Raspberry Pi running a local VLM. The researcher talks to the jig through natural language prompts.
- Intelligent vision -- A two-stage CV + Claude Vision hybrid pipeline for real-time flake detection. Local computer vision optimizes contrast and finds candidates in ~30ms, then Claude Sonnet 4 verifies and classifies each one in ~3 seconds.
- Autonomous agents -- An orchestrator agent coordinates synthesis, characterization, and theory sub-agents. When the jig finishes exfoliating, it signals the platform to begin the next step automatically. Raman spectra are analyzed, peaks are fitted, and results are compared to literature -- all without human intervention.
Project Structure
TreeHacks_26/
├── backend/ # FastAPI backend -- agents, CV pipeline, WebSocket server
│ ├── main.py # FastAPI app + WebSocket endpoint + session management
│ ├── video_feed.py # Video/image feed worker with CV + VLM flake detection
│ ├── agents/
│ │ ├── base.py # Base agent class (Claude API, tool use, streaming)
│ │ ├── orchestrator.py # Master agent -- plans experiments, dispatches sub-agents
│ │ ├── synthesis.py # Controls hardware for sample preparation
│ │ ├── characterization.py # Runs Raman spectroscopy analysis
│ │ └── theory.py # Theoretical models + academic paper search
│ ├── tools/
│ │ ├── flake_finder.py # Core CV + VLM flake detection logic
│ │ ├── hardware.py # Raspberry Pi motor control interface
│ │ ├── microscope.py # Microscope image capture
│ │ ├── raman.py # Raman spectroscopy data tools
│ │ └── research.py # Academic paper search (Semantic Scholar)
│ ├── sources/ # Input images/video for the microscope feed
│ └── requirements.txt
│
├── frontend/ # React + TypeScript + Vite frontend
│ └── src/
│ ├── App.tsx # Main app -- WebSocket state, layout
│ ├── components/
│ │ ├── ExperimentInput.tsx # Natural language experiment input
│ │ ├── PlanView.tsx # Orchestrator plan with approval workflow
│ │ ├── AgentBox.tsx # Live agent thinking + feedback
│ │ ├── VideoFeed.tsx # Microscope feed with detection overlays
│ │ ├── SampleWorkbench.tsx # Sample management
│ │ └── FinalReport.tsx # Generated research report
│ └── hooks/
│ └── useWebSocket.ts # WebSocket connection management
│
├── flake_finder/ # Standalone desktop flake detection tool
│ ├── main.py # Screen-capture + VLM flake finder (keyboard-driven)
│ ├── main_qwen.py # Local VLM variant (Qwen on RPi)
│ ├── config.json # Detection parameters
│ └── Stepper Motor Stuff/
│ └── ThorLabs.py # ThorLabs KDC101 motor control via pyftdi (APT protocol)
│
├── raman-agent/ # Standalone Raman spectroscopy analysis tool
│ ├── backend/
│ │ ├── main.py # FastAPI endpoints for spectrum upload + analysis
│ │ ├── raman.py # Baseline correction, peak detection, Gaussian fitting
│ │ └── llm_parser.py # LLM-powered spectrum interpretation
│ └── frontend/ # Next.js UI for spectrum visualization
│
├── slides/ # Presentation deck (Next.js + Framer Motion)
├── Makefile # Build and run commands
└── camera.py # Live camera feed utility
How It Works
1. Experiment Design (Frontend)
The researcher types an experiment description in plain English:
"Prepare 5 graphene samples at 0-4% strain and characterize each with Raman spectroscopy."
The orchestrator agent parses this, generates a step-by-step plan, and presents it for approval.
2. Multi-Agent Execution (Backend)
Once approved, the orchestrator dispatches tasks to specialized sub-agents:
| Agent | Role | Tools |
|---|---|---|
| Orchestrator | Plans experiments, coordinates sub-agents, tracks progress | All sub-agent dispatch |
| Synthesis | Controls hardware for sample preparation (exfoliation, stamping) | Motor control, hardware interface |
| Characterization | Runs and analyzes Raman spectroscopy | Spectrum fitting, peak detection, material ID |
| Theory | Searches literature, builds theoretical models | Semantic Scholar API, calculations |
All agents use Claude Sonnet 4 with tool use and stream their thinking in real-time to the frontend via WebSocket.
3. Flake Detection (CV + VLM Pipeline)
The microscope feed runs through a two-stage detection pipeline:
Stage 1 -- Local CV (~30ms):
- Automatic contrast optimization (alpha/beta sweep to maximize flake-substrate separation)
- CLAHE enhancement + Otsu thresholding
- Contour analysis with area and edge-density filtering
- Generates candidate bounding boxes
Stage 2 -- Claude Vision (~2-3s):
- Sends contrast-optimized image (512px, 70% JPEG) to Claude Sonnet 4
- Claude independently detects flakes using its own vision
- CV candidates are provided as optional hints, not hard constraints
- Returns verified detections with confidence scores, bounding boxes, and reasoning
4. Hardware Control (Raspberry Pi + Stepper Motors)
A custom graphene stamping/straining jig with:
- ThorLabs KDC101 motor controller + MTS25-Z8 linear translation stage
- Direct USB communication via
pyftdiusing the APT binary protocol (bypasses macOS FTDI VCP driver issues) - Precision: 0.001mm (34,304 encoder counts/mm)
- Raspberry Pi runs a local VLM that accepts natural language commands ("exfoliate at position 3", "apply 2% strain")
- The RPi agent reports completion back to the web platform, triggering the next pipeline step automatically
5. Raman Spectroscopy Analysis
Automated spectral analysis pipeline:
- Asymmetric Least Squares (ALS) baseline correction
scipy.signal.find_peaksfor peak detection- Multi-Gaussian fitting with
scipy.optimize.curve_fit - Material-specific labeling (Graphene D/G/2D bands, MoS2 E2g/A1g)
- LLM-powered interpretation and comparison to literature values
Getting Started
Prerequisites
- Python 3.11+
- Node.js 18+
- An Anthropic API key
Installation
# Clone the repo
git clone https://github.com/your-org/TreeHacks_26.git
cd TreeHacks_26
# Install all dependencies
make install
Or manually:
# Backend
cd backend
pip install -r requirements.txt
# Frontend
cd ../frontend
npm install
Environment Variables
Create backend/.env:
ANTHROPIC_API_KEY=sk-ant-...
For the standalone flake finder, create flake_finder/.env:
ANTHROPIC_API_KEY=sk-ant-...
Running
Main application (requires two terminals):
# Terminal 1: Backend (FastAPI on port 8000)
make backend
# Terminal 2: Frontend (Vite on port 5173)
make frontend
Then open http://localhost:5173.
Standalone flake finder:
cd flake_finder
python main.py
Keyboard controls: v = scan, c = cycle contrast, e = edges, r = ROI, s = save, p = pause, q = quit.
Standalone Raman analysis tool:
cd raman-agent
./start_backend.sh # FastAPI on port 8000
./start_frontend.sh # Next.js on port 3000
ThorLabs motor control:
cd flake_finder/Stepper\ Motor\ Stuff
pip install pyftdi pyusb
brew install libusb # macOS only
python ThorLabs.py
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | React 19, TypeScript, Vite, Framer Motion, React Markdown, KaTeX |
| Backend | FastAPI, Uvicorn, WebSockets, asyncio |
| AI | Claude Sonnet 4 (Anthropic SDK) -- agents + vision |
| Computer Vision | OpenCV, NumPy, SciPy (contrast optimization, CLAHE, contour analysis) |
| Spectroscopy | SciPy (ALS baseline, peak detection, Gaussian fitting), Matplotlib |
| Hardware | pyftdi (ThorLabs APT protocol), pyserial (Raspberry Pi), stepper motors |
| Research | Semantic Scholar API |
Architecture
┌────────────────────────────────────────────────────────────────────┐
│ ORCHESTRATOR AGENT (Web Platform) │
│ "Prepare 5 graphene samples at 0-4% strain, characterize each" │
└─────────┬───────────────┬──────────────────┬───────────────┬───────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌──────────────┐ ┌───────────┐
│ STAMPING JIG│ │ FLAKE FINDER│ │CHARACTERIZE │ │ THEORY │
│ (RPi + VLM) │ │ (CV + VLM) │ │(Raman Agent) │ │ AGENT │
│ │ │ │ │ │ │ │
│ Exfoliate │ │ Detect │ │ Peak fit │ │ Search │
│ Strain │ │ Verify │ │ Material ID │ │ papers │
│ Position │ │ Locate │ │ Compare │ │ Compare │
└──────┬──────┘ └──────┬──────┘ └──────┬───────┘ └─────┬─────┘
│ │ │ │
▼ ▼ ▼ ▼
Stepper Motors Microscope Feed Raman Spectra Semantic Scholar
(ThorLabs KDC101) (OpenCV + Claude) (scipy fitting) (API)
The RPi jig agent and the web platform agents communicate bidirectionally. When the jig finishes exfoliating, it triggers flake detection. When good flakes are found, it triggers Raman. When strain is needed, the platform tells the jig to apply it. Then Raman again. Then compare. No human in the loop.
Real-Time Communication
All communication between frontend and backend uses a single WebSocket connection. Message types include:
experiment_design-- user submits experiment descriptionorchestrator_thought-- live agent thinking streamplan-- generated experiment plan for approvalagent_update-- sub-agent progress and resultsvideo_frame-- encoded microscope frame with detection overlaysvideo_command-- UI controls (scan, contrast, presets, edges)final_report-- completed research report with figures
Video Feed Controls
The microscope feed UI supports:
- Contrast presets -- Raw, Low, Med, High, V.Hi, Ext (toggle on/off)
- Manual contrast/brightness -- Real-time slider adjustment
- Edge overlay -- Canny edge detection toggle
- Scan -- Triggers VLM flake detection (freezes frame during analysis)
- Optimized view -- Auto-switches to contrast settings that maximize flake visibility (computed by the CV pipeline)
Works on both live video streams and static microscope images.
License
Built at TreeHacks 2026.
Analysis
View
Metric
- 16
- 11
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- CSSIn code
- FastAPIIn code
- HTMLIn code
- JavaScriptIn code
- Next.jsIn code
- OpenAIIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
11 of 11 appear in the indexed code.
AI coding agents
- Claude CodeConfig
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
412 KB
Source files
60
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
nlee1126/Autolab-Labs
98 files · 69.2 MB · @ 50bb2fb
Structure
Interface
10 files · 10%Screens, components and styles rendered to the user.
Application logic
32 files · 33%Domain rules, services and shared utilities.
+6 more
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python54%
- Markdown25%
- TypeScript16%
- CSS4%
- Shell1%
- JavaScript0%
- Other (1)0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
frontend/package.json
npm · 19- framer-motion
- katex
- react
- react-dom
- react-markdown
- rehype-katex
- remark-math
- +12 more
backend/requirements.txt
pypi · 11- anthropic
- fastapi
- httpx
- matplotlib
- mss
- numpy
- opencv-python
- python-multipart
- scipy
- uvicorn[standard]
- websockets
raman-agent/frontend/package.json
npm · 10- next
- react
- react-dom
- +7 more
raman-agent/backend/requirements.txt
pypi · 9- fastapi
- httpx
- matplotlib
- numpy
- pandas
- python-dotenv
- python-multipart
- scipy
- uvicorn[standard]
flake_finder/requirements.txt
pypi · 6- anthropic
- mss
- numpy
- openai
- opencv-python
- Pillow
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.