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

preview_player
Показать описание
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 Youtube, but it's not acceptable. So I put it on the link below.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.
Рекомендации по теме
Комментарии
Автор

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

ramana
Автор

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))

apistolgrunt
Автор

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

hydromakers