hi am yibrah i would like to get details on code for temperature controlled fan dc motor based with pwm
Posts: 14,118
Threads: 61
Joined: Oct 2014
Generally, electronic devices produce more heat. Therefore, this heat must be reduced to protect the device. There are many ways to reduce this heat. One way is to turn the fan on spontaneously. This article describes a circuit that automatically switches the fan when it detects the temperature inside the device greater than its threshold value.
Circuit diagram
Principle of the circuit
The main principle of the circuit is to connect the fan connected to the DC motor when the temperature is greater than a threshold value.
The microcontroller continuously reads the temperature of its surroundings. The temperature sensor acts as a transducer and converts the detected temperature to an electrical value. This is the analog value that is applied to the ADC pin of the microcontroller.
The ATmega8 microcontroller has six ADC channels multiplexed with a resolution of 10 bits. The analog value applies to one of the input ADC pins. Therefore, the conversion is produced internally using the successive approximation method.
For ADC conversion, internal records must be declared. The ADC pin generates a digital value. This is compared to the threshold value by the controller that changes the fan if the value is greater than the threshold.
Components
• Atmega8
• L293D
• Lm35
• DC motor
Component Description
1. LM35
The LM35 is an integrated circuit sensor that can be used to measure temperature. The output voltage of this sensor is proportional to the temperature in degree centigrade. The output voltage of the LM35 will vary at a speed of 10mV per degree Celsius.
In general, the range of the LM35 temperature sensor is -55 degrees C to +150 degrees C. To measure this full range of temperatures, that is, from the negative range to the positive range, we need to connect an external resistor between the Data and a negative supply of Vcc.
Either way, we will not consider the negative temperature range in this project. Therefore, under normal operating conditions, we can measure the temperature in the range of +2 degrees C to +150 degrees C.
2. ADC
All the parameters of nature are analog, that is, most of the data in the real world is characterized by analog signals. For example, if you measure the temperature of the room.
The ambient temperature varies continuously over time. This measured signal, which changes continuously with time, says from 1 sec, 1.1 seconds, 1.2 seconds and so on is called analog signal.
In order to manipulate real world data using a microprocessor or a microcontroller, we have to convert the analog signals to the digital signals, so that the processor or controller will be able to read, understand and manipulate the data.