Skip to content

bula87/chamber_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klipper x Panda Breath: Intelligent Chamber Control Bridge

The Missing Link for Snapmaker U1 & Panda Breath Integration

While the Panda Breath is physically compatible with the Snapmaker U1, the "out-of-the-box" firmware integration is effectively non-existent, limited primarily to basic manual toggles. Furthermore, the official manual references 4x M3x14mm self-tapping screws for installation that are notably absent from the retail packaging. his creates the distinct impression that Snapmaker U1 "compatibility" was a last-minute addition intended to capitalize on the machine's launch hype rather than a meaningful integration.

Because the Snapmaker U1's Klipper implementation is locked down (unless you root the machine), direct integration is a challenge. This script solves that by acting as an external API Bridge. It leverages the undocumented Panda Breath API to sync the heater with Moonraker metadata.

Deployment: Designed to run on any "always-on" device (NAS, Raspberry Pi, or local PC) connected to the same network as the printer and Panda Breath.


🚀 Key Features

  • Filament-Aware Heating: Automatically detects the filament type from Moonraker metadata and sets the chamber temperature based on a configurable map.
  • Real-Time Monitoring: Dual-syncs with Klipper (via HTTP) and Panda Breath (via WebSockets) to display a live status dashboard.
  • Intelligent Overshoot Protection: Pauses heating if the chamber exceeds the target and resumes once it cools down to a specific threshold.
  • Hard Safety Cutoff: Immediately shuts down the heater if the chamber reaches a critical temperature limit (default 75°C).
  • Graceful Shutdown: Upon script termination (Ctrl+C), it sends a 3-attempt safety handshake to ensure the Panda Breath is turned off and returned to Auto mode.

🛠 Configuration Parameters

All settings are located at the top of the script for easy modification:

🌐 Connection Settings

Parameter Description Default
PRINTER_IP IP address of your Snapmaker U1/Klipper instance 192.168.1.1
PANDA_IP IP address of your Panda Breath unit 192.168.1.2
DEBUG Enables verbose raw JSON logs for troubleshooting False
LOG_INFO Enables the formatted dashboard and status updates True

🌡 Temperature Control

Parameter Description Default
FILAMENT_TEMP_MAP Map of filament strings to target chamber °C (can be extended with additional filament types) PLA: 0, PETG: 40, REST: 60
TEMP_OVERSHOOT_BUFFER Degrees above target before heater is forced OFF 2
TEMP_OVERSHOOT_RESUME Degrees below target before heating resumes 2
ABSOLUTE_SAFETY_LIMIT The "Panic" temperature to kill all heat 75.0

📋 How it Works

1. Metadata Parsing

The script queries the Moonraker API for the current G-code file's metadata. It specifically looks for the filament_type attribute (e.g., PETG;PLA). If multiple extruders are used, it identifies the first active tool (target > 0) to determine the target chamber temperature.

2. The Dashboard

While running, the script provides a clean console interface showing:

  • Snapmaker U1 Status: Active file name, tool temperatures, and bed temperature.
  • Panda Breath Status: Power state, internal sensor readings, and manual target temperature.
  • Logic Status: Indicates if "Overshoot" protection is active or if the "Safety Cutoff" has been triggered.

3. Safety Handshakes

The script is designed to fail-safe. If you terminate the script:

  1. It attempts to set the target temperature to 0°C.
  2. It attempts to switch the Panda Breath back to Auto Mode.
  3. It attempts to Power Off the heating unit.

Important

Each shutdown step is retried 3 times with a confirmation check to ensure the hardware received the command.


📦 Requirements

  • Python 3.8+
  • websockets
  • requests

Install dependencies via pip:

pip install websockets requests

🏃 Usage

Simply run the script on a device in the same network as your printer and Panda Breath:

python chamber_control.py

Example script output:

=================================================================
[00:47:50] INITIALIZING CHAMBER CONTROL
Settings:
Snapmaker U1 IP:    192.168.1.1
Panda Breath IP:    192.168.1.2
Overshoot Limits:   [-2°C,+2°C]
Safety Cutoff:      75.0°C
=================================================================
[00:47:50] Controller Active. Monitoring Klipper [K] and Panda [P].

[00:47:50] [INFO] Current Panda Breath Status:
=======================================================
 Power status: OFF
 Mode:         Auto
 Target temp.: 0°C
=======================================================

[00:47:51] [INFO] Current Printer Status:
=======================================================
 SNAPMAKER U1 - Active print...
 File: Random_Print_PETG_1h3m.gcode
=======================================================
 [ACTIVE] Tool 0: 230.0°C / 230°C | Filament: PETG
          Tool 1:  32.0°C /   0°C | Filament: TPU
          Tool 2:  33.0°C /   0°C | Filament: PLA
          Tool 3:  34.0°C /   0°C | Filament: PLA
-------------------------------------------------------
   Bed: 80.0°C | Chamber: 38.0°C
-------------------------------------------------------

[00:47:51] [EVENT] Detected Active Job (Random_Print_PETG_1h3m.gcode) | Primary Filament: PETG -> Panda Target: 40°C
[00:47:51] Temp. Status | Chamber Current: [K]38.0°C/[P]32.0°C | Chamber Target: [P]0°C | Bed Current/Target: [K]80.0°C/80°C | Overshoot: false | Safety Cutoff: false
[00:48:01] Temp. Status | Chamber Current: [K]38.0°C/[P]32.0°C | Chamber Target: [P]0°C | Bed Current/Target: [K]80.0°C/80°C | Overshoot: false | Safety Cutoff: false
[00:48:02] [INFO] Current Panda Breath Status:
=======================================================
 Power status: ON
 Mode:         Manual
 Target temp.: 40°C
=======================================================

[00:48:04] Temp. Status | Chamber Current: [K]38.0°C/[P]32.0°C | Chamber Target: [P]40°C | Bed Current/Target: [K]80.0°C/80°C | Overshoot: false | Safety Cutoff: false
[00:48:20] Temp. Status | Chamber Current: [K]38.0°C/[P]33.0°C | Chamber Target: [P]40°C | Bed Current/Target: [K]80.0°C/80°C | Overshoot: false | Safety Cutoff: false

Disclaimer: Always monitor your printer. Incorrect temperature settings for your specific enclosure or filament can cause hardware damage or fire hazards. Use at your own risk.

About

Klipper x Panda Breath: Intelligent Chamber Control Bridge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages