firmware:klipper:bltouch-with-raspberry-pi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
firmware:klipper:bltouch-with-raspberry-pi [2022/03/15 02:43] – ↷ Page name changed from firmware:klipper:bltouch-wth-raspberry-pi to firmware:klipper:bltouch-with-raspberry-pi vidschofelixfirmware:klipper:bltouch-with-raspberry-pi [2022/03/16 20:05] – [Attaching the BLTouch] vidschofelix
Line 1: Line 1:
 ====== HowTo Run BLTouch connected to RPi microcontroller ====== ====== HowTo Run BLTouch connected to RPi microcontroller ======
 ==== Why? ==== ==== Why? ====
-  * some printer board dont support the control signal for the bltouch, or need to remove some components. in this case you have to fiddle a little with software, but +  * some printer board dont support the control signal for the bltouch, or need to remove some components. In this case you have to fiddle a little with software, but it's possible, so why not?
  
 ==== Needed ==== ==== Needed ====
Line 11: Line 11:
  
 ==== Attaching the BLTouch ==== ==== Attaching the BLTouch ====
-  * remove the red pin from the triple-connection cable and put it into a single dupont case+  * remove the red pin from the triple-connection cable and put it into a single dupont case (included in original BLTouch packaging)
   * connect the pins to the [[https://pinout.xyz/|gpio pins]]:   * connect the pins to the [[https://pinout.xyz/|gpio pins]]:
-    * white -> GPIO12 +    * white -> GPIO0 
-    * black -> GND next to GPIO12+    * black -> GND next to GPI0
     * yellow -> GPIO27     * yellow -> GPIO27
     * brown -> GND     * brown -> GND
     * red -> 3.3V     * red -> 3.3V
     * //Todo: Add a picture of the wires//     * //Todo: Add a picture of the wires//
-  * you can choose whatever pins you like, but it's easier to follow if you choose the same+  * you can choose whatever pins you like for control_pin, but it's easier to follow if you choose the same
  
 ==== printer.cfg adjustment ==== ==== printer.cfg adjustment ====
Line 28: Line 28:
  
 [bltouch] [bltouch]
-sensor_pin: ^rpi:gpio12+sensor_pin: ^rpi:gpio0
 #   Pin connected to the BLTouch sensor pin. Most BLTouch devices #   Pin connected to the BLTouch sensor pin. Most BLTouch devices
 #   require a pullup on the sensor pin (prefix the pin name with "^"). #   require a pullup on the sensor pin (prefix the pin name with "^").
Line 40: Line 40:
 </file> </file>
  
-==== working around the pullup pgio setting ==== +==== good choice for sensorpins ==== 
-  * thats not the best way to do it, but it works, so here is how and why +  * you can choose between gpio0 and gpio1 for the sensorpin because it has an inbuild pullup always active 
-  * klipper is [[https://github.com/Klipper3d/klipper/issues/4207|unable to set the pullup-resistor for GPIOs on a raspberry pi]] because thats not implemented in the raspi-kernel (and thats where Mcu runs). +  * klipper can't set pgios to pullup because of reasons 
-  * So, to fix that up, we will use a script that sets the gpio as pullup and monitors the mcu firmware. if the firmware changes (restart) it will set the pullup to the gpio again +  * before i found this outhere was a long description how to set pullup by a script and make sure that this script runs always.
-  * <code>sudo apt install inotify-tools</code> +
-  * <code>cd /home/pi</code> +
-  * <code>nano pgio.sh</code> and paste the following +
-  * <file bash pgio.sh> +
- #!/bin/sh +
-set_gpio () { +
-  raspi-gpio set 12 ip pu +
-+
-set_gpio +
-while true; do +
-  while inotifywait -e create /tmp/klipper_host_mcu; do +
-    set_gpio +
-  done +
-done +
-</file> +
-  * make the script executable <code>chmod +x gpio.sh</code> +
-  * next we will add our script to cron, so it will run after reboot +
-  * <code>sudo nano /etc/cron.d/gpio</code> +
-  * and paste this inside (make sure there is a newline at the end) +
-  * <code>@reboot pi /home/pi/gpio.sh& > /dev/null</code> +
-  * thats it, reboot your pi and check if you script is running <code> +
-pi@mainsail:~ $ ps aux | grep gpio.sh | grep -v grep +
-pi         457  0.0  0.0   1940   376 ?        S    02:28   0:00 /bin/sh /home/pi/gpio.sh +
-</code> +
 ==== Testing the Probe ==== ==== Testing the Probe ====
   * follow the [[https://www.klipper3d.org/BLTouch.html#initial-tests|official guide for testing the bltouch]]   * follow the [[https://www.klipper3d.org/BLTouch.html#initial-tests|official guide for testing the bltouch]]
-  * also make sure, that the bltouch works after firmware restart, klipper restart and restart of the raspberry. If not check your scripts! 
- 
  
 ==== Wrapping it up ==== ==== Wrapping it up ====
  • firmware/klipper/bltouch-with-raspberry-pi.txt
  • Last modified: 2022/03/16 20:06
  • by vidschofelix