Temperature Controlled Fan ON-OFF Switch Using Arduino Nano 16X2 LCD and LM35 Sensor

 

Compact Temperature controlled fan on/off switch is based on Arduino Nano multipurpose TWOVOLT shield, the circuit consist LM35 temperature sensor, 16X2 LCD, 12V relay including driver transistor, circuit works with 12V supply and can controlled any fan from 12V to 230V AC, for testing purpose I have connected 12V DC fan. At normally open switch of relay. The shield has many other parts can be omit if not required, refer circuit diagram for more info. Relay can switch load up to 7amps supply 5V to 230V AC.

Download PDF Schematic

 

Arduino Pins LCD

  • LCD RS pin to digital pin 12
  • LCD Enable pin to digital pin 11
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground

Arduino Pins Various Devices

  • Switch 1 Arduino Pin A3
  • Switch 2 Arduino Pin D6
  • Switch 3 Arduino Pin D7
  • Current Sensor ACS714 Arduino Pin A5
  • Trimmer Potentiometer Arduino Pin A0
  • LM35 Sensor Arduino Pin A4
  • Power Mosfet Arduino Pin D9
  • Relay Arduino Pin D8

 

Default temperature trigger point is set to 35C, if you want to change the value , change here

Arduino Code for this project


/*
Tempereture Controlled Fan ON/OFF using arduino tempereture display on 16X2
LCD, Arduino Code, Circuit Diagram, PCB Layout Available at www.twovolt.com.
The project switch on the Fan at max set point
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int tempPin = A4; // LM35 Temp Sensor Analog Output
int Relay = 8; // Relay Pin
int temp;
int tempMin = 25; //
int tempMax = 35; // Switch On The Relay

void setup() {
pinMode(Relay, OUTPUT);
pinMode(tempPin, INPUT);
lcd.begin(16,2);
}
void loop() {
temp = readTemp(); // Temperature
if(temp < tempMin) { // if temp is lower than Minimum-Temp

}
if(temp > tempMax) { // if temp is higher than Temp-Max
digitalWrite(Relay, HIGH); // Turn on Relay
} else { // else Turn of The Relay
digitalWrite(Relay, LOW);
}
lcd.print(“TEMP: “);
lcd.print(temp); // Display Temp
lcd.print(“C “);
lcd.setCursor(0,1); // move cursor
lcd.print(“FAN:ON/OFF”);
lcd.print(“”);
delay(300);
lcd.clear();
}

int readTemp() { // Temperature and convert it to celsius
temp = analogRead(tempPin);
return temp * 0.48828125;
}

Leave a Reply

Your email address will not be published. Required fields are marked *