LED Warning Light Configuration
The LED warning light (three-color signal light) is used to visually display the printer's operating status. This article describes its wiring method and Klipper configuration.
LED warning lights come in various input voltage specifications. This article uses the 24V version as an example. Please verify voltage compatibility based on the actual model used.
Wiring Instructions
Cable Color Definition
| Color | Function | Wiring Location |
|---|---|---|
| Gray | Common Positive | Connect to 24V power positive (e.g., 24V fan power supply) |
| Red | Red Light Control | Connect to motherboard fan control signal pin |
| Green | Green Light Control | Connect to motherboard fan control signal pin |
| Yellow | Yellow Light Control | Connect to motherboard fan control signal pin |
Control Polarity
FLY printer motherboards default to negative control:
- The positive (gray wire) of the LED warning light connects to 24V power
- The control wires (red/green/yellow) of the LED warning light connect to motherboard GPIO pins
- When the motherboard outputs a low level, the corresponding color lights up
Klipper Configuration
[output_pin led_red]
pin: PD12 # Red light control pin
pwm: False
value: 0 # Default off
shutdown_value: 1 # Automatically turns on red light when Klipper errors
[output_pin led_green]
pin: PD13 # Green light control pin
pwm: False
value: 0
[output_pin led_yellow]
pin: PD14 # Yellow light control pin
pwm: False
value: 0
The example above uses PD12, PD13, and PD14 as example pins. Modify these according to the available GPIO pins on your actual motherboard.
The red light implements a failsafe via shutdown_value: 1:
- Normal Operation: The red light is controlled by macros and remains off under normal conditions.
- Error/Disconnection: When Klipper enters a Shutdown state, the red light is automatically turned on without needing any macro intervention.
- This is a hardware-level safety mechanism. Even if macro logic fails, the red light correctly indicates a fault.
Status Macro
[gcode_macro LED_STATUS]
description: Set LED warning light status
gcode:
{% set STATUS = params.STATUS|default("idle")|lower %}
# First, turn off all lights
SET_PIN PIN=led_red VALUE=0
SET_PIN PIN=led_green VALUE=0
SET_PIN PIN=led_yellow VALUE=0
# Set lights based on status (active low: VALUE=1 means pin outputs low level, light on)
{% if STATUS == "printing" %}
SET_PIN PIN=led_green VALUE=1
SET_PIN PIN=led_yellow VALUE=1
{% elif STATUS == "ready" %}
SET_PIN PIN=led_green VALUE=1
{% elif STATUS == "warning" %}
SET_PIN PIN=led_yellow VALUE=1
{% elif STATUS == "error" %}
SET_PIN PIN=led_red VALUE=1
{% endif %}
Status Description
| Status Parameter | Lighting Effect | Usage Scenario |
|---|---|---|
printing | Green + Yellow on | Currently printing |
ready | Green on | Klipper connected, printer ready |
warning | Yellow on | Warning status (e.g., temperature anomaly but no error) |
error | Red on | Error occurred, requires attention |
idle | All off | Idle status (default) |
Call example: LED_STATUS STATUS=printing
Print Macro Integration
Add LED control within print start and end macros for automatic status switching.
Print Start Macro
[gcode_macro PRINT_START]
description: Print start macro
gcode:
# ... other start logic ...
# Set LED to printing status
LED_STATUS STATUS=printing
# ... heating, homing, etc. ...
Print End Macro
[gcode_macro PRINT_END]
description: Print end macro
gcode:
# ... other end logic ...
# Set LED to idle status
LED_STATUS STATUS=idle
Automatic Status Detection (Optional)
To automatically detect Klipper status without modifying print macros, use the following configuration.
# Status variable macro (for recording the last status to avoid flickering from repeated updates)
[gcode_macro _LED_STATE]
variable_last_status: "unknown"
gcode:
# This macro only stores variables, no action needed
# Automatic status detection
[delayed_gcode LED_AUTO_UPDATE]
initial_duration: 1
gcode:
{% set idle = printer.idle_timeout.state|string|upper %}
{% set printing = printer.print_stats.state|string|upper %}
{% set current = "unknown" %}
# Determine current status
{% if printing == "PRINTING" or printing == "PAUSED" %}
{% set current = "printing" %}
{% elif idle == "READY" or idle == "IDLE" %}
{% set current = "ready" %}
{% endif %}
# Only update LED when status changes to avoid flickering
{% set last = printer["gcode_macro _LED_STATE"].last_status %}
{% if current != last %}
SET_GCODE_VARIABLE MACRO=_LED_STATE VARIABLE=last_status VALUE='"{current}"'
LED_STATUS STATUS={current}
{% endif %}
# Continue polling
UPDATE_DELAYED_GCODE ID=LED_AUTO_UPDATE DURATION=1
Status Determination Logic
| Klipper State | Condition | LED Effect |
|---|---|---|
| Printing | print_stats.state = printing/paused | Green + Yellow on |
| Connected | idle_timeout.state = ready/idle | Green on |
| Error | Klipper enters Shutdown | Red on (handled automatically by shutdown_value) |
| Other | Status not detected above | All off |
Working Principle
- The
_LED_STATEmacro stores the last status for comparison. LED_AUTO_UPDATEchecks Klipper status every second.- It calls
LED_STATUSto update lights only when the status changes, preventing flicker. - When Klipper errors and enters Shutdown,
shutdown_valueautomatically takes over the red light.