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!
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!
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...
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.
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!
@@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
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.
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 👍
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.
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?
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
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?
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?
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
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
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.
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?
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
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.
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.
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.
@@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
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
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 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..
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 :'(
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:)
@@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
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!
More content like this is really needed. VERY nice job!
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!
Wow. This really opened my eyes. Just converted my FL Sun SR to Klipper. Thank you!!!
Excellent presentation of the topic.
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...
valid good point
This is probably reason the Pi is not used to drive steppers directly, as well.
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.
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!
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
@@denis2381 it's a 12v LED Strip. Just white.
@@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
Thank you for this video. I’ve needed this information for weeks and this is amazing.
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.
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.
That's cool, you can run what ever you want with relays or mosfets for low voltage.
I have a spare fan and MOSFET laying around. Guess I know what I will be doing next weekend 😃
Really helpfull. More tutorials please.
Thanks a lot for all of the great videos man 👍
This is an awesome video! Thanks for sharing your knowledge.
this was extremely helpful!! Thank you so much for posting it. Great info.
@22:35 You can simply select some lines of text en (un)comment them using ctrl + / ☝😌
Super useful info. Thanks for your work!
Would be good to cover using GPIO pins with external momentary switches to run gcode, like a physical preheat button, etc.
Or a basic movement system
Like those from pc cases? They 100% can be used for this purpose
#mainsaillove
This is so revolutionary! Your video helped me a lot, and my system is day and night different! Thank you so much!
Thank you for this walk through is is Fantastic!
Amazing work! Really helpfull
damn, i was just looking for this yesterday
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 👍
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.
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?
I don't sorry. Never experimented with it
Amazing content ! can't thank you enough
Thank you sooooooo much for this video.
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
Do you think you Can Do this ? 😜
Thanks for the great video.
Have you been able to get a Neopixel led working from Klipper on the RPi gpio ports?
Thanks
very useful video! thanks
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?
wait im confused, can i control gpio pins from the same raspberry pi as I am running klipper on?
Yes thats the point. Control it from klipper
@@Vez3D oh ok sorry i was confused i thought you would have to have 2 raspberry pis and that would be very expensive
Very well done.
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?
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
is possible use RTk.GPIO Board?
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?
I think it should work yes
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
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
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.
Ok good to know. I'll stick to the ones in the video then
Though specs say 3v minimum..but I guess specs are sometimes bad on those
Thanks 😊
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.
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?
How do i put the name for te unnamed lines and how i know wich pin is ?
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?
I think its doable yes. never done it though
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
Thank you
Can you show how to add a Gyro for input shaper using the GPIO pins?
Already have a video about it. Look in my vid for input shaping
@@Vez3D will do. Thanks!
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?
I use the same as Klipper runs on.
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.
The one that runs klipper. No need for a second one
@@Vez3D Awesome, thanks!!
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.
yes you can use it to expand your board.
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.
@@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
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
Please make 1 video for adxl345 accelerometer
there is one on my channel but its a bit old
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
Sure you can. Just define a heater fan. See klipper config reference
@@Vez3D thank you
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?
It's a bed mosfet I got from Amazon. But any mosfet should work
@@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..
@@micromagic31 pi will send 3.3 I think..so your mosfet needs to trigger with that low voltage
is it possible to add retraction settings slider in miscellaneous?
Have you tried 0 acceleration and 1, the fastest acceleration and slowest
how to measure high temperature (400C) from raspberry pi directly ?
you could an ADC sensor with SPI .. like a PT100
I don't have a free pin "output" how to change pin to "output" ???
I cant get it to work, non of the gpio pins in gpioinfo show up, theyre all unnamed
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 :'(
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:)
👍
Why not using GPIO pins of main board instead of RPI? 1 less MCU to update :)
30 sec from the start is the answer
@@Vez3D sorry Simon, I missed that :( 👍🏼
It didn't work for me :(
So this is what I've lost by using tiny 2-in-1 boards.
i am going to make a flame sensor triggered camera so i can see when my printer burns
I'm not sure if this is sacarstic... Is it?
@@Vez3D it is
@@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
@@Vez3D i meant it just as a joke. I am very peculiar person.
@@TommiHonkonen ahhh haha ok sorry.