What is the problem?
There is a fan for cooling my octoprint system which has touch screen relay for controlling printer psu etc. but I am anoyed by its noise
I connected it to printers relay this way it is working when printer gets on since there is psu which is powered with 220v also 220v inlet and outlet while printer is working temp goes up but today I noticed passive cooling isnt enough box was hot
so I want to control one of my relays according to raspberries temp
like if temp >40 activate the relay
if temp < 35 deactivate the relay
I know its possible but I dont know how to code it
What did you already try to solve it?
I found few articles on the web but I didnt manage to make them work
Hello everyone. I know this thread has been quiet for a while. I have OctoPrint running from OctoPi 0.18.0 on a a Raspberry Pi 4 on a custom case being powered by PoE. My Pi's fan is currently connected to the PoE HAT to 5V and Ground. As soon as the PoE HAT gets power, the fan turns on and stays on until I unplug the ethernet cable.
I would like this fan to, instead, turn on and off based on the actual internal temperature of the Pi and a threshold determined by me. I found instructions to wire the fan to a GPIO pin and control it by changing the config.txt file or use the GUI from Raspberry Pi OS. I think these instructions assume that I have Raspberry Pi OS installed. Is there a way to do this based on the OctoPi image install?. I found the boot/config.txt file when I access the Pi via SHH but the parameter that I need to change is not there. It is:
dtoverlay=gpio-fan,gpiopin=14,temp=80000
Can I just add it to the config.txt file or do I need to install RaspberryPi OS for this to work?. Maybe another solution?. I have studied the current plugin solutions in OctoPrint but, I think, none allow me to set temperature thresholds and use the internal temperature sensor of the Pi.
Duh!!!. Obviously the second I press send on this thread I find that I should have tried Raspi-Config to enable fan control. I now can control the fan via GPIO pin 14 but need to automate it. I started to learn Python a week ago and maybe could take on this project as a way to learn and build a plugin for OctoPrint. Too hard for a complete coding newbie?
I have a fan on my Pi 3 that I turn on and off with print jobs. My fan on code is:
#!/bin/bash
gpio export 11 out
gpio -g write 11 1
and fan off is:
#!/bin/bash
gpio export 11 out
gpio -g write 11 0
The way my setup works is:
I use the Action Commands plugin to add fanOn and fanOff commands that run the appropriate script. fanOn runs "sh /home/pi/fan_on.sh", fanOff runs "sh /home/pi/fan_off.sh
In Octoprint's GCODE Scripts I added "M118 //action:fanOn" to "Before print job starts" and "M118 //action:fanOff" to "After print job completes".
This turns the fan on and off with the print job, since there's enough noise from the printer that I don't notice the whiny Pi fan. This is fine for a Pi 3 and keeps the system cool when under load, I don't know if you need something more extreme for a Pi 4. Maybe you can adapt this to your needs, hope it helps.