How to use GPIO pins with Klipper

Поділитися
Вставка
  • Опубліковано 10 січ 2025

КОМЕНТАРІ • 112

  • @ApexNick
    @ApexNick 2 роки тому +10

    My whole life I worked in I.T. I've also tinkered a LOT with electronics (entire workbench with oscilliscope, sweep function generator, I have my extra class radio license, etc.). I never learned to control physical items because learning firmware/microcontroller coding was a MAJOR time and cost issue - Plus, every single video I've ever looked at there is crap (parts and equipment) strewn everywhere. This is SO easy! Thank you so much for this video and for making one of my techie/geek dreams come true!

  • @johnbeima6413
    @johnbeima6413 3 роки тому +23

    More content like this is really needed. VERY nice job!

  • @winandd8649
    @winandd8649 Рік тому +2

    @22:35 You can simply select some lines of text en (un)comment them using ctrl + / ☝😌

  • @JoelRehra
    @JoelRehra 3 роки тому +10

    The hardware pwm has one very important advantage: It does not vary when the cpu is overloaded... So if a process freezes the cpu for a few ms (which hopefully wont happen) the software-pwm will freeze as well...
    And as some others said the hardware-pwm gives a much cleaner signal...

    • @Vez3D
      @Vez3D  3 роки тому +1

      valid good point

    • @GnuReligion
      @GnuReligion 2 роки тому

      This is probably reason the Pi is not used to drive steppers directly, as well.

    • @charmio
      @charmio Рік тому +1

      Spot on!
      As the name suggests, hardware PWM is literally controlled by a separate hardware circuit in the processor that is dedicated to nothing other than generating a PWM signal.
      It's very useful! If you need a PWM signal that'll be stable regardless of what the rest of the processor is doing, these are what you want to use.
      Generally speaking it's a good idea to use them even if you don't strictly need the stability as software PWM often involves the processor actively managing the pulse's high and low timings. This usually requires continuously polling or checking a timer, which can consume significant processor time, especially at higher PWM frequencies.

  • @2iinfinite
    @2iinfinite 3 роки тому +2

    I recently updated to klipper firmware on my ender3 reading the documentation seeing the part about sensors like thermometers, when I realized I had one of those pi starter kits with a bunch of sensors and even an accelerometer(mpu6050 no SPI interface unfortunately). This video came at a perfect time!

  • @jackparlee6748
    @jackparlee6748 3 роки тому +2

    Thank you for this video. I’ve needed this information for weeks and this is amazing.

  • @jim5148
    @jim5148 5 місяців тому +1

    Excellent presentation of the topic.

  • @willl84
    @willl84 Рік тому

    26:40 - THANK YOU! I added a 2CH relay board to control LED lights (and something else in the future) and couldn't for the life of me figure out how to default them to off at startup. Simply adding the "value: 1" and "shutdown_value: 1" was what I needed!

    • @denis2381
      @denis2381 7 місяців тому

      Why relay? I have usb powered led and I Plan to use just 5v and gnd to turn off and on and maybe Set brightnesss. Don't care about color

    • @willl84
      @willl84 7 місяців тому

      @@denis2381 it's a 12v LED Strip. Just white.

    • @denis2381
      @denis2381 7 місяців тому

      @@willl84 oh okay makes sense. I was already a bit scared to not connect it. Already glued it in the ikea lack enclosure and prepared pi (as mcu in klipper) and cable

  • @95LegendGS
    @95LegendGS 2 роки тому +17

    Would be good to cover using GPIO pins with external momentary switches to run gcode, like a physical preheat button, etc.

    • @leonnundel2443
      @leonnundel2443 9 місяців тому

      Or a basic movement system

    • @denis2381
      @denis2381 7 місяців тому

      Like those from pc cases? They 100% can be used for this purpose

  • @martintischer6217
    @martintischer6217 3 роки тому +1

    Thank for this video. Thats what i looking for, now i have more options to control fans, without using stock board of my mega zero.

  • @DavidCook42
    @DavidCook42 3 роки тому

    Wow. This really opened my eyes. Just converted my FL Sun SR to Klipper. Thank you!!!

  • @grzegorzboduszek8687
    @grzegorzboduszek8687 3 роки тому +3

    Really helpfull. More tutorials please.

  • @mariusj8542
    @mariusj8542 Рік тому

    thanks a lot, had an old creality 4.2.2 board, but needed to add some extra fans and some lights ( neopixles) but the 4.2.2 is very limited, but this video solved that.

  • @Drew_pew_pew_pew
    @Drew_pew_pew_pew 3 роки тому +1

    I have a spare fan and MOSFET laying around. Guess I know what I will be doing next weekend 😃

  • @Sixpack0000473
    @Sixpack0000473 Рік тому

    this was extremely helpful!! Thank you so much for posting it. Great info.

  • @krafterHD
    @krafterHD 11 місяців тому

    This is an awesome video! Thanks for sharing your knowledge.

  • @Mainsail-Crew
    @Mainsail-Crew 3 роки тому +3

    #mainsaillove

  • @VladOnEarth
    @VladOnEarth 3 роки тому +2

    Super useful info. Thanks for your work!

  • @jay1st1st
    @jay1st1st 2 роки тому

    That's cool, you can run what ever you want with relays or mosfets for low voltage.

  • @vmx200
    @vmx200 3 роки тому +1

    Thank you for this walk through is is Fantastic!

  • @Tinker_Box
    @Tinker_Box 3 роки тому

    This is so revolutionary! Your video helped me a lot, and my system is day and night different! Thank you so much!

  • @MrW3iss
    @MrW3iss 11 місяців тому

    Thanks a lot for all of the great videos man 👍

  • @viktorcoopman5479
    @viktorcoopman5479 10 місяців тому

    Amazing work! Really helpfull

  • @bogdyy13
    @bogdyy13 3 роки тому +1

    damn, i was just looking for this yesterday

  • @Accessgp
    @Accessgp Рік тому

    Very very nice video and concepts very clearly explained. Thank you 😊. I am very new to klipper but funny enough I find it much more easier to configure than marlin which I was never able to get my head around. I see a good opportunity here with your relay control part, all of know the fan noise we get sitting alongside a idle printer especially with the controller and hot end fans running all the time, what if we could configure the hot end fan to only switch on when the hot end temperature goes above say 50* and the controller fan to switch on when the board controller goes above say 60*. That way fans will only kick in when the printer starts a print job and switch off when done and all the temperatures are back to normal. You could also switch on or off the enclosure lights only when printing. That way we can avoid unnecessary power being consumed and also have a much more quieter printer. So please help with some examples as to how to configure this condition. Thanks again 👍

  • @the_guy_next_door_31
    @the_guy_next_door_31 Рік тому

    Amazing content ! can't thank you enough

  • @kingofnfsfan
    @kingofnfsfan 3 роки тому +5

    If i remember correctly the software pwm is ok for fans but crappy for servos because the pwm isnt perfectly timed. You dont notice it on fans but servos can stutter a bit.

    • @lightningfpv9012
      @lightningfpv9012 3 роки тому

      I tried servo with sofware pwm and it's jittering alot, tried hardware pwm but I can not get It working, do you have any step by step tutorial on active hardware pwm?

    • @Vez3D
      @Vez3D  3 роки тому

      I don't sorry. Never experimented with it

  • @infocusaerialmedia8041
    @infocusaerialmedia8041 Рік тому

    Thanks for the great video.
    Have you been able to get a Neopixel led working from Klipper on the RPi gpio ports?
    Thanks

  • @michaelswinney9154
    @michaelswinney9154 Рік тому

    Thank you sooooooo much for this video.

  • @heisenturd5683
    @heisenturd5683 2 місяці тому

    The mosfet you have linked, I have an identical version part code hw-700, this does not work with the pwm as it will only accept voltage from the the heater output, the version you use, the hw-300 has a pwm specific input and a seperate input for heater output, I had one laying around to test so luckily didn't buy it

  • @fab65400
    @fab65400 3 роки тому +1

    Hi, thank you for your great videos !!!!! Really helpull and amasing.
    Really appreciated if you could make a video to add an arduino uno as aditionnal "secondary/third" mcu to add more gpio pins . Thanks

    • @fab65400
      @fab65400 3 роки тому

      Do you think you Can Do this ? 😜

  • @rokkweiler9166
    @rokkweiler9166 Рік тому

    Good video thanks, any way to control neopixels using the rpi gpio? Cant seem to get it working using this method of having the pi as a second mcu

  • @solders2004
    @solders2004 3 роки тому

    very useful video! thanks

  • @MrKiar1611
    @MrKiar1611 10 місяців тому

    if I understand correctly, is it mean I can plug the g-code into the one generated by slicer and make the external fan on&off at some speciific position during the print automatically?
    I recently bought an ender 3 s1 pro to make a UV glue dispenser but it's kinda tricky. Because i couldn't really find an unused pin to trigger a mode switching function from glue dispensing to turn on UV led from my customised toolhead.
    And turning it on all the time is not an option as I need the glue to set still before curing it with UV.

  • @valerioranalli
    @valerioranalli Рік тому +1

    Is it possibile to connect a fan that controls the temperature of an emclousore that read the data from a dh11 or dht22 and power on the fan when is needed to keep the enclousore temperature at the right value? Can someone help me?

  • @RogerGarrett
    @RogerGarrett 8 місяців тому

    So, these things are controlled by macros within the g code file? Does this mean you also need to modify the slicer program to call those macros at the appropriate times?

  • @j.g545
    @j.g545 3 роки тому

    fyi that black panel mosfet on
    your picture (2:30) doesnt work from 3.3 volts. just tried it and it needs 12v even for control.

    • @Vez3D
      @Vez3D  3 роки тому

      Ok good to know. I'll stick to the ones in the video then

    • @Vez3D
      @Vez3D  3 роки тому

      Though specs say 3v minimum..but I guess specs are sometimes bad on those

  • @MitchCrane
    @MitchCrane 8 місяців тому

    Very well done.

  • @Tensopiseth
    @Tensopiseth 2 роки тому

    hi. i got one stupid question. can i use (assigned) gpio pin as switch? if could it would be great.. so i can use it as light switch control manual or via web interface. also i maybe useful for assigned as pause, stop, ... since i have no scree to use

  • @elitesennabubble
    @elitesennabubble 2 роки тому +2

    wait im confused, can i control gpio pins from the same raspberry pi as I am running klipper on?

    • @Vez3D
      @Vez3D  2 роки тому +1

      Yes thats the point. Control it from klipper

    • @elitesennabubble
      @elitesennabubble 2 роки тому

      @@Vez3D oh ok sorry i was confused i thought you would have to have 2 raspberry pis and that would be very expensive

  • @jbrande
    @jbrande 3 роки тому

    Hi thanks for the video, do you know if its possible to use rpi pins as uart pins for the drivers by setting it up this way?

    • @Vez3D
      @Vez3D  3 роки тому

      I think its doable yes. never done it though

  • @SysdefWonder
    @SysdefWonder 3 роки тому +1

    I can add a Z-Probe to the RPi and setup a GPIO as Z-Endstop and tell Klipper to use the Z-Endstop as Probe?

    • @Vez3D
      @Vez3D  3 роки тому +1

      I think it should work yes

  • @shangtsung2450
    @shangtsung2450 3 роки тому

    Thank you for sharing this information. I wonder, which boards did you refer, when you mentioned that there are ones that have a lot of outputs and inputs? Are those still RPi? Some STM32 ones? Do you have specific series names / references?

  • @DyminoCzyliLolek
    @DyminoCzyliLolek 3 роки тому +2

    Software PWM use some code to turn on and off pin quickly. It use some cpu computation power and its not realy quick. Also timing of switching is a bit off due to OS processes.
    In hardware PWM special timers is utilized to do switching. It can be REALY fast, timing is perfect and do not use CPU computation power.
    In case of regulating fans software PWM is good enought but for eg. servo it can be a problem

  • @EduardoSousa-fk6oy
    @EduardoSousa-fk6oy 3 роки тому

    Hi thanks for the very God vídeo, i have a question, can i use the rasp to Control my hotend fan ? So it stop at 30° , or the fan and thermister have to be on same MCU? i AM out off pwm pins on my skr 1.4 , i can not use 2 hotend MOSFET to do that . thanks

    • @Vez3D
      @Vez3D  3 роки тому +1

      Sure you can. Just define a heater fan. See klipper config reference

    • @EduardoSousa-fk6oy
      @EduardoSousa-fk6oy 3 роки тому

      @@Vez3D thank you

  • @sebastiangonzalez1690
    @sebastiangonzalez1690 3 роки тому

    How do i put the name for te unnamed lines and how i know wich pin is ?

  • @Dark_Phoinix
    @Dark_Phoinix Рік тому

    is possible use RTk.GPIO Board?

  • @livewiya
    @livewiya 2 роки тому

    I want to make sure I understand: if you're already using an rPi for klipper, do you need another Pi to use it as a secondary MCU? Or would I be able to do this on the one Pi that's already being used for klipper.

    • @Vez3D
      @Vez3D  2 роки тому +1

      The one that runs klipper. No need for a second one

    • @livewiya
      @livewiya 2 роки тому

      @@Vez3D Awesome, thanks!!

  • @markusn1365
    @markusn1365 3 роки тому

    Do I understand correctly, do you use the RPI with which the printer runs under klipper or do you have to install a second RPI?

    • @Vez3D
      @Vez3D  3 роки тому

      I use the same as Klipper runs on.

  • @micromagic31
    @micromagic31 3 роки тому

    My rpi 3b+ can swith a 12v led strip with irf520 mosfet, but I can't get it to work with a 24v fan. Without fan attached the output of the mosfet is reacting to the slider in mainsail as expected. As soon as I attach the fan the voltage drops below 1v and the fan won't start. Any ideas? What mosfet are you using in your example?

    • @Vez3D
      @Vez3D  3 роки тому +1

      It's a bed mosfet I got from Amazon. But any mosfet should work

    • @micromagic31
      @micromagic31 3 роки тому

      @@Vez3D The mosfet I'm using is a irf520N. This one is working with a gpio pin on the mainboard of my printer, but not with the Pi. It might have something to do with the control voltage of the Pi, but can't find proof for it..

    • @Vez3D
      @Vez3D  3 роки тому +2

      @@micromagic31 pi will send 3.3 I think..so your mosfet needs to trigger with that low voltage

  • @bogdyy13
    @bogdyy13 3 роки тому

    Can you show how to add a Gyro for input shaper using the GPIO pins?

    • @Vez3D
      @Vez3D  3 роки тому

      Already have a video about it. Look in my vid for input shaping

    • @bogdyy13
      @bogdyy13 3 роки тому

      @@Vez3D will do. Thanks!

  • @stevehanwright481
    @stevehanwright481 Рік тому

    Thanks 😊

  • @jpbnto
    @jpbnto 3 роки тому

    is it possible to add retraction settings slider in miscellaneous?

  • @orange_robot
    @orange_robot Рік тому

    Please make 1 video for adxl345 accelerometer

    • @Vez3D
      @Vez3D  Рік тому

      there is one on my channel but its a bit old

  • @tigre3droyce771
    @tigre3droyce771 3 роки тому +1

    Thank you for the interesting video. I am planing to upgrade my 8bit board (I know it is shameful, pls don't judge me 😁) to a 32 bit board to fit Marlin 2.0. Now, my question is, can I just use the RasberryPi to extend my 8bit board? With RPi I can do a lot of cool stuff and there is no need to buy an 32bit board. Maybe I'll just make a complete switch to klipper instead. Thank you in advance! I am learning more stuff about the firmwares bit by bit.

    • @Vez3D
      @Vez3D  3 роки тому +1

      yes you can use it to expand your board.

    • @joshua43214
      @joshua43214 3 роки тому +2

      With Klipper, your printer board ends up being nothing more than a fancy relay board. All the heavy lifting is done by the RPi, and the commands are just streamed to the printer board.
      Essentially, a "better" printer board does nothing for you at all in terms of computation.
      The only reason to upgrade the board then is if you need to improve the hardware interface I.E. ability to swap out step sticks, add more step sticks, use a more reliable board, etc.
      Upgrading to 32bits does nothing for you.

    • @Vez3D
      @Vez3D  3 роки тому +1

      @@joshua43214 except I had issue running accelerometer on a old 8bit board. It failed because of not able to process the commands even with klipper on the pi

    • @g4egk
      @g4egk 3 роки тому

      Your machine maybe quieter with a board upgrade that has 2208/2209 stepper drivers too - any of the BTT SKR range or MKS have these

  • @Alexsshittyelectricals
    @Alexsshittyelectricals 3 роки тому

    Have you tried 0 acceleration and 1, the fastest acceleration and slowest

  • @AdamStranberg
    @AdamStranberg 2 роки тому

    RIP. Was following instructions/video when my rpi klipper would no longer load the printer. Hit reboot in the terminal, and now a rainbow screen of death....can't even ssh into the pi anymore. Think I lost all my klipper config files :'(

  • @jooilpark9304
    @jooilpark9304 2 роки тому

    Thank you

  • @pockwaski
    @pockwaski Рік тому

    I don't have a free pin "output" how to change pin to "output" ???

  • @liamels6282
    @liamels6282 8 місяців тому

    I cant get it to work, non of the gpio pins in gpioinfo show up, theyre all unnamed

  • @fishemrock
    @fishemrock 3 роки тому

    how to measure high temperature (400C) from raspberry pi directly ?

    • @Vez3D
      @Vez3D  3 роки тому

      you could an ADC sensor with SPI .. like a PT100

  • @korbak88
    @korbak88 2 роки тому

    Hi, great video, thanks!
    I'm looking to make timelapses with my canon eos1200D, but I'm stuck on how to, tell it to take the picture and store the picture on its SD card. if anyone has a solution I'm a taker:)

  • @ispalin4667
    @ispalin4667 3 роки тому

    👍

  • @JonathanAraujo-SenhorVip
    @JonathanAraujo-SenhorVip 7 місяців тому

    It didn't work for me :(

  • @davidmorgado3755
    @davidmorgado3755 3 роки тому

    Why not using GPIO pins of main board instead of RPI? 1 less MCU to update :)

    • @Vez3D
      @Vez3D  3 роки тому +2

      30 sec from the start is the answer

    • @davidmorgado3755
      @davidmorgado3755 3 роки тому +2

      @@Vez3D sorry Simon, I missed that :( 👍🏼

  • @youtubehandlesux
    @youtubehandlesux 4 місяці тому

    So this is what I've lost by using tiny 2-in-1 boards.

  • @TommiHonkonen
    @TommiHonkonen 3 роки тому

    i am going to make a flame sensor triggered camera so i can see when my printer burns

    • @Vez3D
      @Vez3D  3 роки тому +1

      I'm not sure if this is sacarstic... Is it?

    • @TommiHonkonen
      @TommiHonkonen 3 роки тому +1

      @@Vez3D it is

    • @Vez3D
      @Vez3D  3 роки тому

      @@TommiHonkonen mind explaining yourself? Have you seen anything fire hazard in my video? I'm always happy to learn if I did something wrong or stupid. Thanks

    • @TommiHonkonen
      @TommiHonkonen 3 роки тому +3

      @@Vez3D i meant it just as a joke. I am very peculiar person.

    • @Vez3D
      @Vez3D  3 роки тому

      @@TommiHonkonen ahhh haha ok sorry.