MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Temperature regulated fan on RPI

    Scheduled Pinned Locked Moved Troubleshooting
    3 Posts 3 Posters 2.0k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      Peter
      last edited by

      I need some help (again).
      I made a temperature regulated fan following these instructions:
      https://www.npmjs.com/package/rpi-fan-controller
      It works fine, but the fan starts at the default 45 degrees celsius.
      I would like to change that to 55 or 60 degrees celcius.
      I tried several things, but no succes.
      Thanks foor any help.
      Peter

      1 Reply Last reply Reply Quote 0
      • M Offline
        MadScientist
        last edited by MadScientist

        I think more information is needed. Did you run the script with sudo rpifan -t 55 or sudo rpifan --maxtemp 55?

        1 Reply Last reply Reply Quote 0
        • cruunnerrC Offline
          cruunnerr
          last edited by

          @Peter

          why not just using a python script?

          found this one here:

          #!/usr/bin/env python3
          # coding: utf-8
          
          import os
          import time
          import signal
          import sys
          import RPi.GPIO as GPIO
          pin = 36 # The pin ID, edit here to change it
          maxTMP = 50 # The maximum temperature in Celsius after which we trigger the fan
          GPIO.setmode (GPIO.BOARD)
          
          def setup():
              GPIO.setmode(GPIO.BOARD)
              GPIO.setup(pin,GPIO.OUT)
              GPIO.setwarnings(False)
              return()
          def getCPUtemperature():
              res = os.popen('vcgencmd measure_temp').readline()
              temp =(res.replace("temp=","").replace("'C\n",""))
              print("temp is {0}".format(temp)) #Uncomment here for testing
              return temp
          def fanON():
              setPin(True)
              return()
          def fanOFF():
              setPin(False)
              return()
          def getTEMP():
              CPU_temp = float(getCPUtemperature())
          
              if CPU_temp>maxTMP:
                  fanON()
          
              else:
                  fanOFF()
          
              return()
          def setPin(mode): # A little redundant function but useful if you want to add logging
              GPIO.output(pin, mode)
              return()
          try:
              setup()
              while True:
                  getTEMP()
                  time. sleep(8) # Read the temperature every 5 sec, increase or decrease this limit if you want
          except KeyboardInterrupt: # trap a CTRL+C keyboard interrupt
          	GPIO.cleanup()
          
          1 Reply Last reply Reply Quote 1

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Sam, technical setup by Karsten.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy