4D LearningFRC 6429 4th Dimension

Arduino deneyi 17

Automatic Fan Controller

Intermediate · 65 min · Threshold control

Switch a small DC fan on automatically when a DHT11 reports high temperature.

Sesli anlatım videosu (İngilizce, sentetik ses). Çekim videosu eklenince yerini alır.

Malzemeler

  • Arduino Uno
  • DHT11 module
  • Logic-level N-channel MOSFET
  • Small DC fan
  • Flyback diode
  • 10 kΩ gate pull-down
  • External fan supply

Bağlantı

  1. Connect DHT11 DATA to pin 4.
  2. Drive the MOSFET gate from pin 6; add 10 kΩ from gate to GND.
  3. Connect fan through the MOSFET and external supply; place the diode reverse-biased across the fan.
  4. Join external supply and Arduino grounds.

Kod

#include <DHT.h>
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
const int fanPin = 6;
const float threshold = 28.0;

void setup() { pinMode(fanPin, OUTPUT); dht.begin(); }

void loop() {
  float temperature = dht.readTemperature();
  if (!isnan(temperature)) digitalWrite(fanPin, temperature >= threshold);
  delay(2000);
}

Ne olmalı?

The fan starts at or above 28 °C and stops below it.

Meydan okuma

Add a second, lower off-threshold to prevent rapid switching.

Güvenlik ve sorun giderme

  • Bağlantıyı değiştirmeden önce gücü kes.
  • Her LED ile direnç kullan.
  • Kart ve port seçimini Arduino IDE'de kontrol et.
  • Her kablonun koddaki pin numarasıyla eşleştiğini doğrula.

Not: Ders metinleri İngilizcedir. Orijinal Türkçe çalışma kâğıdı PDF olarak indirilebilir.