Posts

Showing posts from April, 2024

Temperature control fan using Arduino uno ||Arduino control fan

Arduino code #include <DHT.h> #define DHTPIN 2       // Digital pin connected to the DHT sensor #define DHTTYPE DHT11  // DHT 11 DHT dht(DHTPIN, DHTTYPE); // Motor driver connections #define MOTOR_PIN_1 3  // Motor driver input 1 #define MOTOR_PIN_2 4  // Motor driver input 2 void setup() {   Serial.begin(9600);   dht.begin();   // Motor driver pins setup   pinMode(MOTOR_PIN_1, OUTPUT);   pinMode(MOTOR_PIN_2, OUTPUT); } void loop() {   delay(2000);  // Delay between sensor readings   // Read temperature   float temperature = dht.readTemperature();   if (isnan(temperature)) {     Serial.println("Failed to read temperature from DHT sensor!");     return;   }   Serial.print("Temperature: ");   Serial.print(temperature);   Serial.println(" °C");   // Set fan speed based on temperature   int speed = temperature * 4; // Speed of motor = temperature in Ce...