You Are Here: Home » AVR ATmega Projects » Temperature Measurement Projects » Temperature Controlled DC Fan using Microcontroller

Temperature Controlled DC Fan using Microcontroller

Generally, electronic devices produce more heat. So this heat should be reduced in order to protect the device. There are many ways to reduce this heat. One way is to switch on the fan spontaneously. This article describes a circuit that automatically, switches the fan when it detects the temperature inside the device greater than its threshold value.

Temperature Controlled DC Fan using Microcontro

Temperature Controlled DC Fan Circuit Principle:

The main principle of the circuit is to switch on the fan connected to DC motor when the temperature is greater than a threshold value.

The microcontroller continuously reads temperature from its surroundings. The temperature sensor acts as a transducer and converts the sensed temperature to electrical value. This is analog value which is applied to the ADC pin of the microcontroller. The ATmega8 microcontroller has six multiplexed ADC channels with 10 bit resolution. The analog value is applied to one of the input ADC pins. Thus conversion occurs internally using successive approximation method. For ADC conversion, internal registers should be declared. The ADC pin outputs a digital value. This is compared with the threshold value by the controller which switches the fan if value is greater than threshold

Temperature Controlled DC Fan using Microcontroller

Declaring of internal ADC Registers:

The ATmega8 microcontroller internally has three register namely ADMUX, ADCSRA, ADC data registers. Analog to digital converter is of 10 bit resolution.

1) Initially, select the reference voltage to the ADC using ADCMUX register.

2) Select REFS0 and REFS1 values in ADMUX register to set the reference voltage.

3) Now select the ADC channel using MUX0-MUX3 bits in ADMUX register. Below given table shows the binary value to be placed in the MUX0-MUX3 bits to select a channel.

4) If the sensor is connected to ADC0 channel with AVCC with external capacitor at AREF pin, then the binary value to be assigned to the ADMUX register is  ADMUX=0b01000000.

5) Now select the pre scalar value using ADPS0, ADPS1 and ADPS2 bits of ADCSRA register and also enable ADC using ADEN bit in ADSCRA register.

The following bits decide the division factor between XTAL frequency and input clock of ADC:

For more detail:  Temperature Controlled DC Fan using Microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
GSM Module SIM300 Interface with AVR Ameg
GSM Module SIM300 Interface with AVR Amega32

A GSM/GPRS Module like SIM300 can be used for any embedded application that requires a long range communication, like a...

Scroll to top