How hacker-fab/2d_crystal_stacking works
This is a web-based microscope control system for crystal alignment and stacking. The principal workflow runs from the dashboard through FastAPI endpoints to device abstractions and, where available, camera or stage hardware. Separate control branches cover camera imaging and calibration, nanopositioning, rotation, carousel feeding, thermal control, and vacuum. The README and sampled source support the main camera and nanopositioner paths; wiring details for several other branches are documented but their device implementations were not sampled.
Main entry points: web.py FastAPI application · base_device.py Device base · camera_service.py Camera service · nanopositioner.py Nanopositioner
Components 22
User Interface
- Control dashboard
templates/index.html - Dashboard API client
static/app.js
Web API
- Server entry
main.py - FastAPI application
app/web.py - Camera service
app/camera_service.py - Stage API
nanopositioner/router.py - Rotation API
rotation_plate/router.py - Carousel API
carousel/router.py - Thermal API
thermal_plate/router.py - Vacuum API
vacuum/router.py
Device Control
- Device base
devices/base_device.py - Camera state
devices/camera.py - Nanopositioner
devices/nanopositioner.py - Rotation plate
devices/rotation.py - Carousel feeder
devices/carousel.py - Thermal plate
devices/thermal.py - Vacuum pump
devices/vacuum.py
Hardware Integration
- OMS channel
devices/oms_channel.py - Camera backends
camera
Other components
- Microscope operator
- Stage controller
- Camera hardware
Connections 26
- Microscope operator → Control dashboard: operates
- Control dashboard → Dashboard API client: loads
- Dashboard API client → FastAPI application: calls API
- Server entry → FastAPI application: runs
- FastAPI application → Camera service: serves camera
- FastAPI application → Stage API: mounts routes
- FastAPI application → Rotation API: mounts routes
- FastAPI application → Carousel API: mounts routes
- FastAPI application → Thermal API: mounts routes
- FastAPI application → Vacuum API: mounts routes
- Camera service → Camera state: extends
- Camera service → Camera backends: controls
- Camera backends → Camera hardware: captures frames
- Stage API → Nanopositioner: dispatches commands
- Nanopositioner → OMS channel: calls interface
- OMS channel → Stage controller: communicates
- Rotation API → Rotation plate: dispatches commands
- Carousel API → Carousel feeder: dispatches feed
- Thermal API → Thermal plate: dispatches controls
- Vacuum API → Vacuum pump: dispatches controls
- Camera state → Device base: inherits
- Nanopositioner → Device base: inherits
- Rotation plate → Device base: inherits
- Carousel feeder → Device base: inherits
- Thermal plate → Device base: inherits
- Vacuum pump → Device base: inherits