
In this project a cooling system will be built with Arduino. It mainly uses a DTH11 temperature sensor, fan and LCD display.
When the Arduino board detects a temperature > 28°C the fan starts to rotate until the temperature becomes < 28°C.
To complete the assembly, you can connect:
For relay
For the fan:
For DHT11 sensor:
For the LCD display:
the SDA pin at the Arduino analog pin A4.
the SCL pin at the Arduino analog pin A5.
the VCC pin at the Arduino 5v pin.
the GND pin at the Arduino GND pin
This is the cooling system program.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#include <dht11.h> #include <LiquidCrystal_I2C.h> #define DHT11PIN 2 // DATA -> Pin 2 #define ventilateurPIN 1 // Pin -> for Fan LiquidCrystal_I2C lcd(0x27, 20, 4); dht11 DHT11; void setup() { pinMode(ventilateurPIN,OUTPUT); //sets the Pin 2 digital of the Arduino in output mode lcd.init(); } void loop() { DHT11.read(DHT11PIN); lcd.backlight(); lcd.clear(); lcd.setCursor(0, 0); lcd.print("temperature= "); lcd.setCursor(0,1); lcd.print((float)DHT11.temperature); if ((float)DHT11.temperature >28) { digitalWrite(ventilateurPIN,HIGH); // the fan starts to turn } else { digitalWrite(ventilateurPIN,LOW); // the fan stops } delay(2000); } |
Note: both libraries must be downloaded DTH11 et I2c_LCD1602