Let's set our Raspberry Pi's fan to turn on automatically when the temperature rises with script

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ย. 2021
  • In this video, we'll configure our fan to turn on and off when the programmed temperature arrives. By adding a Resistor and a Transistor, we can use the GPIG21 port so when it gets to 55 degrees our fan will turn on to cool the circuit, and when it gets to 48 degrees, our fan will turn off.
    You will need the following components:
    • 5V fan.
    • NPN transistor 2N2222
    • Resistance of 680 or 340 Ohns (resistance may vary depending on your fan power and quantity.)
    • Cables for connecting to Raspberry Pi
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    *** I tried to put all commands here on TH-cam, but it's not acceptable. So I put it on the link below.
    uk.sauber-lab.com/2021/11/15/...
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Leave your comment and share with your network. It's always good to know what needs improvement.
    Don't forget to subscribe to the channel.
    To receive all notifications, tap the bell icon. It will change to a ringing bell to indicate that you have chosen to receive all notifications.

ความคิดเห็น • 6

  • @ramana8343
    @ramana8343 ปีที่แล้ว +1

    dude you are working a lot harder. I hope your channel will get many views.
    Just do your best man
    Thanks for the video..

    • @sauberlab-uk
      @sauberlab-uk  ปีที่แล้ว

      Thank you for the kind words! I'm glad you found the video helpful. I will do my best to continue creating useful content for everyone.

  • @nercules1193
    @nercules1193 3 หลายเดือนก่อน

    fan control is build in now in the os: th-cam.com/video/AdjU_AVcZTA/w-d-xo.html

  • @apistolgrunt
    @apistolgrunt 3 หลายเดือนก่อน

    Hey, very cool video, with the help of your code I was able to write my own script for fan control. Here is my code (use with care, I'm a noob):
    You will need to install RPi.GPIO to make this work.
    import RPi.GPIO as gpio
    import sys
    import time
    def cpu_temp():
    with open("/sys/class/thermal/thermal_zone0/temp", 'r') as f:
    return float(f.read()) / 1000
    gpio.setmode(gpio.BCM)
    gpio.setup(18, gpio.OUT)
    while True:
    time.sleep(2)
    temp = cpu_temp()
    if temp > 55.0:
    gpio.output(18, gpio.HIGH)
    else:
    gpio.output(18, gpio.LOW)
    print("cpu temp: " + str(temp))

  • @hydromakers
    @hydromakers ปีที่แล้ว

    Your python script is not formatted wright I couldn't use it. I will look else where

    • @sauberlab-uk
      @sauberlab-uk  5 หลายเดือนก่อน

      I apologize for the inconvenience. if you find a better solution, please poste below.