Being able to operate a cooling fan at a set CPU temp for the Raspberry Pi 3 B+


Hi there, I have never dealt with Raspbian ecosystems or Python for that matter.

I have built a circuit according to the guide, and I am wanting to run a script for the Raspberry Pi using this tutorial:

Since octoprint runs on its own OS, I am not sure how to get this working with octoprint on startup, etc. What exactly needs to be done to make this work on octoprint?


Octopi runs Raspbian, which is a fairly standard Linux flavor. After skimming it looks like in that instructable will work.

To have it start on startup, you can put it in /etc/rc.local. Let me know if you need more help.


Thanks so much for the help, because I am completely blind to the Raspbian system. To access the /etc/ folder, one would have to boot up into Raspberry Pi itself? I can not find a path within the SD Card that would lead me there.

Also the file is the only thing needed if it were to be added to that directory? No special terminal work is needed?

Thanks again,


You need to go into the terminal to do all of that. There are tutorial to walk you through it, I'd suggest Googling around to find one that gives you the right level of detail and works with your brain. Roughly, these are the tasks:

  • create the file (either pasting into an editor like nano or using the wget command in the instructable)
  • make sure the file is executable and runs by hand
  • add the entry to rc.local, make sure to use the & at the end of the line like the link I sent says.

I didn't read closely enough to see what pins the fan connects to, but there are Octoprint plugins that allow you to operate the fan. I don't know if any of them base it on CPU temp as they are designed around the printer temp.. but if so, you could do it without needing to use the terminal.