Skip to content

t0/cryogenic_hardware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Cryoswitch Controller

Terminal-accessible control system for two independent cryo/RF switches driven by a Teensy microcontroller. Designed for remote operation over SSH.

Architecture

┌──────────────┐   USB Serial    ┌──────────────┐   4-bit one-hot   ┌───────────┐
│  Host PC     │ ──────────────► │   Teensy     │ ────────────────► │ Switch 1  │
│  (Python CLI)│   115200 baud   │              │                   └───────────┘
│              │ ◄────────────── │              │ ────────────────► ┌───────────┐
│  SSH access  │                 │              │                   │ Switch 2  │
└──────────────┘                 └──────────────┘                   └───────────┘

Each switch is controlled by 4 GPIO pins in a one-hot encoding:

  • Channel 0: 0000 (all off)
  • Channel 1: 1000
  • Channel 2: 0100
  • Channel 3: 0010
  • Channel 4: 0001

Quick Start

1. Flash the Teensy

Open cryoswitch_control.ino in the Arduino IDE (or PlatformIO), select your Teensy board, and upload.

Pin mapping:

Switch Pin 0 (CH1) Pin 1 (CH2) Pin 2 (CH3) Pin 3 (CH4)
Switch 1 5 4 3 2
Switch 2 23 22 21 20

2. Set Up the Host

On the Linux machine connected to the Teensy:

cd host/
sudo bash install.sh

This will:

  • Install pyserial via pip
  • Add your user to the dialout group (for serial port access)
  • Create a udev rule so the Teensy appears as /dev/cryoswitch
  • Install a cryoswitch command you can run from anywhere

After first-time setup, log out and back in for the dialout group change to take effect.

3. Use It

# Interactive mode (auto-detects the Teensy)
cryoswitch

# Or specify port explicitly
python3 host/cryoswitch_cli.py --port /dev/ttyACM0

# One-shot commands (great for scripting)
cryoswitch --cmd "SET1 3"
cryoswitch --cmd "SET2 1"
cryoswitch --cmd GET

Interactive Commands

Command Description
s1 <0-4> Set switch 1 to channel (0 = off)
s2 <0-4> Set switch 2 to channel (0 = off)
off Turn both switches off
status Query current state from device
help Show command reference
quit Exit (turns switches off by default)

Safety feature: On exit, the CLI sends an OFF command to turn all switches off. Use --no-safe-off to disable this if you want switches to remain in their current state after you disconnect.

SSH Remote Access

The whole point of this tool is SSH access. On any machine that can SSH into the host:

ssh user@host-machine
cryoswitch

That's it. The CLI is pure terminal text — no GUI, no X forwarding, no port forwarding needed.

For scripted/automated control from a remote machine:

ssh user@host-machine "cryoswitch --cmd 'SET1 3'"
ssh user@host-machine "cryoswitch --cmd GET"

Serial Protocol Reference

All commands are newline-terminated ASCII at 115200 baud.

Host → Teensy

Command Description
SET1 <0-4> Set switch 1 channel
SET2 <0-4> Set switch 2 channel
OFF1 Turn off switch 1
OFF2 Turn off switch 2
OFF Turn off both switches
GET Query current state
ID Device identification
PING Heartbeat check

Teensy → Host

Response Meaning
OK <sw1> <sw2> Command succeeded
STATE <sw1> <sw2> Response to GET
ERR <reason> Error (e.g., ERR INVALID_CHANNEL, ERR UNKNOWN_CMD)
CRYOSWITCH V1 Response to ID
PONG Response to PING
READY Sent on boot

Troubleshooting

Problem Solution
Permission denied: /dev/ttyACM0 Add yourself to dialout: sudo usermod -aG dialout $USER, then log out/in
No Teensy found Check USB cable, try ls /dev/ttyACM*, or specify --port manually
No response from device Teensy may need a reset; unplug and replug USB
/dev/cryoswitch doesn't appear Re-run sudo udevadm control --reload-rules && sudo udevadm trigger
Box-drawing characters look wrong Ensure your SSH terminal supports UTF-8 (export LANG=en_US.UTF-8)

File Structure

cryoswitch_control/
├── cryoswitch_control.ino   # Teensy firmware
├── README.md                # This file
└── host/
    ├── cryoswitch_cli.py    # Python terminal UI
    ├── requirements.txt     # Python dependencies
    └── install.sh           # One-shot host setup script

About

This repo contains the firmware and control software for the cryogenic switch. In the future, any control software for peripheral components could be put here

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors