Select your language

  • Deutsch
  • English
Stefan J. Truckers Homepage
  • Projects Displayable
  • 3D Printing 3D Printing FDM / FFF
      • Back
      • STL. Collection
      • Facts & Tips
      • FDM Design Guide
      • Filament Finder
      • 3D Printing Help
      • FDM Firmware
          • Back
          • Klipper
          • RepRap Firmware
      • Purchase Advice
          • Back
          • 3D Printer 3D Printer
          • Components
  • Media Photo Video Web
      • Back
      • Photo & Video
          • Back
          • Tipps
          • Equipment
      • Web
          • Back
          • Joomla CMS
          • Scripts & Coding
          • Optimization
          • Security
          • Social Media
      • Gallery
  • Programs Software
  • Craft Corner
      • Back
      • RC-Sport Funkgesteuert
      • CNC Fräsen
      • Laser Gravieren / Schneiden
  • Vita Alltägliches
      • Back
      • Haus & Wohnen
  • About About Stefan
      • Back
      • Career Path
      • Treat Me
  • Support Project & Me
  • 3D Printing
  • Buying Advice
  • FDM Firmware
  • Klipper
  • Firmware Setups
  • Aktivieren eines PWM Pinns am Raspbery Pi unter Klipper
  • STL. Collection
  • Facts & Tips
  • FDM Design Guide
  • Filament Finder
  • 3D Printing Help
  • FDM Firmware
      • Klipper
      • RepRap Firmware
  • Purchase Advice
      • 3D Printer 3D Printer
      • Components

Aktivieren eines PWM Pinns am Raspbery Pi unter Klipper

243 Aktivieren eines PWM Pinns am Raspbery Pi unter Klipper /en/3d-druck/kaufberatung/fdm-firmware/klipper/firmware-setups/aktivieren-eines-pwm-pinns-am-raspbery-pi-unter-klipper
  • 1
  • 2
  • 3
  • 4
  • 5
Created
Saturday, 01 June 2024
Created by
Stefan J. Trucker

Will man den Lüfter des Raspberry Pi über einen deiner GPIO Pinns steuern, so muss man auf dem Ausgang PWM aktivieren und richtig konfigurieren.

config:

[mcu host] serial: /tmp/klipper_host_mcu

Raspberry Pi's have two PWM channels (PWM0 and PWM1) which are exposed on the header or if not, can be routed to existing gpio pins. The Linux mcu daemon uses the pwmchip sysfs interface to control hardware pwm devices on Linux hosts. The pwm sysfs interface is not exposed by default on a Raspberry and can be activated by adding a line to /boot/config.txt:

(verbinde dich per SSH mit der Raspberry Pi und schreibe

sudo nano /boot/config.txt

# Enable pwmchip sysfs interface
dtoverlay=pwm,pin=12,func=4

This example enables only PWM0 and routes it to gpio12. If both PWM channels need to be enabled you can use pwm-2chan:

# Enable pwmchip sysfs interface
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4

This example additionally enables PWM1 and routes it to gpio13.

The overlay does not expose the pwm line on sysfs on boot and needs to be exported by echo'ing the number of the pwm channel to /sys/class/pwm/pwmchip0/export. This will create device /sys/class/pwm/pwmchip0/pwm0 in the filesystem. The easiest way to do this is by adding this to /etc/rc.local before the exit 0 line:

# Enable pwmchip sysfs interface
echo 0 > /sys/class/pwm/pwmchip0/export

When using both PWM channels, the number of the second channel needs to be echo'd as well:

# Enable pwmchip sysfs interface
echo 0 > /sys/class/pwm/pwmchip0/export
echo 1 > /sys/class/pwm/pwmchip0/export

With the sysfs in place, you can now use either the pwm channel(s) by adding the following piece of configuration to your printer.cfg:

[output_pin caselight]
pin: host:pwmchip0/pwm0
pwm: True
hardware_pwm: True
cycle_time: 0.000001

[output_pin beeper]
pin: host:pwmchip0/pwm1
pwm: True
hardware_pwm: True
value: 0
shutdown_value: 0
cycle_time: 0.0005

This will add hardware pwm control to gpio12 and gpio13 on the Pi (because the overlay was configured to route pwm0 to pin=12 and pwm1 to pin=13).

PWM0 can be routed to gpio12 and gpio18, PWM1 can be routed to gpio13 and gpio19:

PWM gpio PIN Func
0 12 4
0 18 2
1 13 4
1 19 2
Quellen
  1. Klipper 3D - Hardware PWM
FaLang translation system by Faboba
  • Projects Displayable
  • 3D Printing 3D Printing FDM / FFF
      • Back
      • STL. Collection
      • Facts & Tips
      • FDM Design Guide
      • Filament Finder
      • 3D Printing Help
      • FDM Firmware
          • Back
          • Klipper
          • RepRap Firmware
      • Purchase Advice
          • Back
          • 3D Printer 3D Printer
          • Components
  • Media Photo Video Web
      • Back
      • Photo & Video
          • Back
          • Tipps
          • Equipment
      • Web
          • Back
          • Joomla CMS
          • Scripts & Coding
          • Optimization
          • Security
          • Social Media
      • Gallery
  • Programs Software
  • Craft Corner
      • Back
      • RC-Sport Funkgesteuert
      • CNC Fräsen
      • Laser Gravieren / Schneiden
  • Vita Alltägliches
      • Back
      • Haus & Wohnen
  • About About Stefan
      • Back
      • Career Path
      • Treat Me
  • Support Project & Me
  • Search
  • Impressum
  • Privacy Policy
  • Registration
      • Back
      • Registration
  • Tags
      • Back
      • 3D Print
      • YouTube
  • Sitemap
© 2025 Stefan J. Trucker
 Design & Implementation by Stefan J. Trucker

3D Jake