Skip to main content

Temperature Based Fan Speed Control And Monitoring Using Arduino

 

Temperature Based Fan Speed Control And Monitoring Using Arduino







This project is a standalone automatic fan speed controller that controls the speed of an electric fan according to the requirement. Use of embedded technology makes this closed-loop feedback-control system efficient and reliable. The microcontroller (MCU) ATMega8/168/328 allows dynamic and faster control and the LCD makes the system user-friendly. Sensed temperature and fan speed levels are simultaneously displayed on the LCD panel.

The project is very compact and uses a few components only. It can be implemented for several applications including air-conditioners, water-heaters, snow-melters, ovens, heat-exchangers, mixers, furnaces, incubators, thermal baths and veterinary operating tables. The project will help save energy/electricity.


Circuit and working

Circuit diagram of the temperature fan speed control and monitoring is shown in Fig. 1. It is built around Arduino Uno board (Board1), 16×2 LCD (LCD1), temperature sensor LM35 (IC1) and a few other components.

Arduino is at the heart of the circuit as it controls all functions. LM35 is a precision integrated circuit whose output voltage is linearly proportional to Celsius (Centigrade) temperature. It is rated to operate over a -55°C to 150°C temperature range. It has +10.0mV/Celsius linear-scale factor.




Fig. 2: Screenshot of the source code on Arduino IDE

Temperature sensor LM35 senses the temperature and converts it into an electrical (analogue) signal, which is applied to the MCU through an analogue-to-digital converter (ADC). The analogue signal is converted into digital format by the ADC. Sensed values of the temperature and speed of the fan are displayed on the LCD. Temperature and monitoring using Arduino The MCU on Arduino drive the motor driver to control fan speed.

Fan speed control technique

A low-frequency pulse-width modulation (PWM) signal, usually in the range of about 30Hz, whose duty cycle is varied to adjust the fan’s speed is used. An inexpensive, single, small pass transistor can be used here. It is efficient because the pass transistor is used as a switch.

One disadvantage of this approach, however, is that it can make the fan noisy because of the pulsed nature of the signal. The PWM waveform’s sharp edges cause the fan’s mechanical structure to move (like a badly-designed loudspeaker), which can easily be audible.

Construction and testing

Fig. 3: Actual-size PCB pattern of the temperature-based fan speed control and monitoring circuit using Arduino


A single-side PCB for the temperature-based fan speed control and monitoring circuit is shown in Fig. 3 and its component layout in Fig. 4. Assemble the circuit on the PCB.



Fig. 4: Component layout of the PCB

CON2 and CON3 are used to connect Board1 (Arduino UNO board) through external connectors. A 12V battery is used to drive the 12V DC-operated fan.


Software

Software for the automatic temperature controller and monitor circuit is written in Arduino programming language. Arduino Uno is programmed using Arduino IDE software.

ATmega328P on Arduino Uno comes with a pre-programmed bootloader that allows users to upload a new code to it without using an external hardware programmer.

Connect Arduino board to the PC and select the correct COM port in Arduino IDE. Compile the program (sketch). Then select the correct board from Tools Board menu in Arduino IDE and upload the sketch (abfc.ino) to Arduino through standard USB port.


Code

//Include necessary libraries
#include <OneWire.h>
#include <DallasTemperature.h>

//Define temperature sensor pin
#define ONE_WIRE_BUS 2

//Create OneWire instance
OneWire oneWire(ONE_WIRE_BUS);

//Create DallasTemperature instance
DallasTemperature sensors(&oneWire);

//Define fan pin
int fanPin = 3;

void setup() {
  //Initialize serial communication
  Serial.begin(9600);
  
  //Initialize temperature sensors
  sensors.begin();
  
  //Set fan pin as output
  pinMode(fanPin, OUTPUT);
}

void loop() {
  //Call sensors.requestTemperatures() to get temperature readings
  sensors.requestTemperatures();
  
  //Read temperature in Celsius
  float temperatureC = sensors.getTempCByIndex(0);
  
  //Convert Celsius to Fahrenheit
  float temperatureF = (temperatureC * 1.8) + 32;
  
  //Print temperature in Celsius and Fahrenheit
  Serial.print("Temperature: ");
  Serial.print(temperatureC);
  Serial.print("C / ");
  Serial.print(temperatureF);
  Serial.println("F");
  
  //Control fan speed based on temperature
  if (temperatureC >= 30) {
    analogWrite(fanPin, 255); //Set fan speed to maximum
  } else if (temperatureC >= 20) {
    int fanSpeed = map(temperatureC, 20, 30, 0, 255); //Map temperature to fan speed range
    analogWrite(fanPin, fanSpeed); //Set fan speed based on temperature
  } else {
    analogWrite(fanPin, 0); //Turn off fan
  }
  
  //Delay for 1 second
  delay(1000);
}




Comments

Popular posts from this blog

Weather Station Using Arduino & DHT11

Weather Station Using Arduino & DHT11      Introduction: Weather monitoring is an important task in many industries and applications. In this project, we are going to build a weather monitoring station using Arduino Nano, DHT11 sensor, 16x2 LCD display, and I2C module. The DHT11 sensor will be used to measure temperature and humidity, and the results will be displayed on the 16x2 LCD display with the help of the I2C module. Hardware Required:

Understanding the Basics of Resistors: A Beginner's Guide

  Understanding the Basics of Resistors: A Beginner's Guide Introduction: Resistors are one of the most basic and fundamental components used in electronic circuits. They play a vital role in controlling the flow of current in a circuit and have a wide range of applications in everything from simple LED circuits to complex electronic systems. In this blog post, we will dive into the world of resistors, exploring what they are, how they work, and the different types of resistors that are available. What is a Resistor? A resistor is an electrical component that is used to regulate the flow of electrical current in a circuit. It is designed to have a specific resistance value, which is measured in ohms (Ω). The resistance value of a resistor determines how much current can flow through it, with higher resistance values limiting the current flow, and lower resistance values allowing more current to flow. Resistors are passive components, which means that they do not generate or amplify

Exciting ESP8266 Projects to Elevate Your DIY Skills

Exciting ESP8266 Projects to Elevate Your DIY Skills 1. Home Automation System: A home automation system based on the ESP8266 offers an excellent way to transform your house into a smart home. The ESP8266, being a low-cost and powerful microcontroller, can easily communicate with various sensors and actuators to control appliances and devices. It can be connected to your home Wi-Fi network, enabling remote access from anywhere through a web interface or mobile app. To set up a home automation system, you'll need to start by connecting the ESP8266 to the sensors and actuators you want to control. For example, you can use relay modules to switch lights or appliances on and off, and motion sensors to detect movement. Temperature and humidity sensors can help you monitor the environment and adjust the climate accordingly. The ESP8266 can host a web server that allows you to control the connected devices through buttons or switches on a web page. You can also create a mobile app using p