Temperature-Controlled Fan | Arduino Workshop

The circuit diagram for the temperature-controlled fan

You went to do a temperature-Controlled Fan Using Arduino. Today I show you How to Temperature-Controlled Fan with Arduino. we’ll use an LM35 temperature sensor to turn a fan on automatically when the temperature is too high.


≡ Required Component


1.Arduino

2. connecting wire

3. Breadboard

4.LM35 temperature sensor

5. 5V single-channel relay module

6. 12V mini-computer cooling fan

7. 9V battery snap and battery


≡ Circuit diagram for the temperature-controlled fan:


The computer fan requires more power than the Arduino can not give, so we need to deliver it its possess control supply: a 9V battery.

 This circuit is controlled by an electronic relay—an electronically operated switch that in this case uses an electromagnet to mechanically open or close the circuit.
relay is for the most part utilized when a low-power device is required to switch on or off a much higher-voltage device. Our relay is powered by 5 volts to function the mechanical switch. In this project, the circuit is only 9 volts, but the relay could control a circuit up to 240 volts.

The circuit diagram for the temperature-controlled fan The circuit diagram for the temperature-controlled fan

 LM35 sensor Connection  Build: 

lm35pinpot

Embed the LM35 sensor into the breadboard with the front of the sensor facing you. Interface the left pin to the +5V rail on the breadboard, the center pin to Arduino A0, and the right pin to the GND rail, as shown within the taking after the table.

LM35 SENSOR

ARDUINO

Left pin

+5V

Center pin

A0

Right pin

GND

Relay Module connections Build:

relay

the relay pins on the right side of the relay module are Signal, GND, and +5V. Join the relay’s Signal pin to Arduino pin 5, GND to Arduino GND, and +5V to the Arduino power via the breadboard rails.

5V RELAY

ARDUINO

Signal

Pin 5

GND

GND

+5V

+5V

On the left side of the relay module are the connections for the electromagnetic switch. The center pin is the common connection; the left pin is marked NO for regularly open, meaning the circuit is broken and the default state is off; and the right pin is marked NC for regularly closed, meaning the default state is on. On the off chance that the relay isn’t switched, the common pin is connected to the NC pinOn the off chance that the relay is switched, the common pin is connected to the NO pinSince we need the circuit to be off until we utilize the switch, we are going to utilize the NO pin.

Now interface the black GND wire of the fan to the GND wire of the 9V battery. At that point, as shown within the following table, join the red positive wire of the fan to the common pin on the relay, and interface the positive wire of the 9V battery to NO on the relay.

5V RELAY

FAN/9V BATTERY

NO (normally open)

9V battery’s positive wire

Common

Fan’s positive wire

NC (normally closed)

Not connected

Now Connect the breadboard power rails to each other and to the Arduino GND and +5V pins.


≡ Code Temperature Controlled Fan Arduino:


#define SENS_PIN A0 // Defines A0 pin as "sensor"
#define FAN_PIN 5
int Vin; // Reads value from Arduino pin
float Temperature; // Receives converted voltage value to temp
float TF; // Receives converted value in °F

void setup() {
  pinMode(FAN_PIN, OUTPUT); // Fan pin as an output
  Serial.begin(9600); // Start Serial Monitor
}

void loop() {
  // Tells Arduino to read pin and stores value in Vin
  Vin = analogRead(SENS_PIN);

  // Converts voltage value into temperature and
  // stores value in Temperature (as °F)
  Temperature = (500 * Vin) / 1023 * (1.8) + 32;

  TF = Temperature;
  Serial.print("Temperature: "); // Sends text to display screen
  Serial.print(TF); // Shows value of temperature in Serial Monitor
  Serial.println(" F"); // Writes F to indicate it is in Fahrenheit
  if (TF > 71) { // If temperature is more than 71
    digitalWrite(FAN_PIN, HIGH); // Turn fan on
  }
  else if (TF < 71) {
    digitalWrite(FAN_PIN, LOW); // Or keep fan off
  }
  delay(1000); // Waits for a second to read the pin again
}
We then create a variable to store the temperature and set the fan Pin as an output. A little calculation turns the voltage reading from the sensor into a temperature value in degrees Fahrenheit.
We at that point begin the Serial Monitor so you’ll be able to see the LM35 reading value when the Arduino is connected to your PC, which is helpful for making beyond any doubt the sensor is working accurately.
 A circle reads the sensor every moment, and in the event that the temperature comes to 71 degrees Fahrenheit, power is sent to the fan Pin, which triggers the relay and switches on the fan. In the event that the temperature falls below 71, the relay switches the fan off.

All Arduino tutorial available Click here

 ARDUINO TUTORIAL 

 208 total views,  1 views today