Controlling DC 12v FAN Arduino

Controlling DC 12v FAN Arduino

Hello world! Today i made a simple project with a LM35 Temperature Sensor and a LCD1602 Screen to control a 12v DC Fan with a arduino and a Relay.

Schematic:
Controlling DC 12v FAN Arduino

Parts list:
Arduino uno, i used the RobotDyn uno. (Has 8 analog pins)
LCD 1602.
LM35 Temperature sensor.
KY-019 Relay module
Potentiometer
12V DC FAN (From a old computer will do.)
Jumper wire set MM/FF/MF

Code:

#include <LiquidCrystal.h>
int reading = 0;
int sensorPin = A0;
int relay =7;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
void setup() {
  lcd.begin(16, 2);
  pinMode(relay,OUTPUT);
}
 
void loop() {
  reading = analogRead(sensorPin);
  int celsius = reading/2;
  lcd.setCursor(0, 0);
  lcd.print("Temperature: "); 
  lcd.setCursor(0,1);
  lcd.print(celsius, DEC);
  lcd.print((char)223);
  lcd.print("C");
  if (celsius >35) {
    digitalWrite(7,HIGH);
  } else {
    digitalWrite(7,LOW);
  }
  delay(500);
  lcd.clear();
}
Danny van den Brande

http://www.arduinosensors.nl

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

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