Sunday, November 17, 2013

Temperature Controlled Relay with Arduino

In this project, we are going to build something very simple project, a temperature controlled relay that is used to turn on a dc fan. You can actually change the DC Fan to other electrical devices such as light or servo motor. We are going to make an automatic fan that will be ON when the temperature rises above certain threshold temperature and OFF when it is below.

temperature controlled fan

Just follow the steps below and you are ready to get yourself one Temperature-Controlled Automatic Fan!
Things that you need
  • Arduino UNO
  • LM35 Temperature Sensor(Celsius) – datasheet
  • Relay Module ( May refer to my previous post on how to make a relay module)
  • A 9V battery (To supply to the coil of relay and the fan)
  • A DC fan (9V/12V)
  • Some jumper wires
  • 16 x 2 LCD
Okay, now let’s get started.
Step 1
Connect the hardware according to the schematic below:
LCD & LM 35
arduino lcd lm35
Relay Module
arduino relay module
DC Fan
arduino dc fan
                                        Done with the hardware part? Awesome!
Part 2: Software

                             Code of this project download  here

Some brief explanation about the coding:
1. reading = analogRead(sensorPin);
– Read analog pin from LM35 temperature sensor input pin and store at reading.
2. int celsius = reading/2;
– LM35 are design to give the exact value of temperature in Celsius. To get the celsius
value, the ADC value are required to divided by 2 .
So, load this code into your arduino UNO and you are ready to go!

Problem Encountered & Solutions

Problem 1
The GND of the 9V battery is not connected to the GND of the arduino. So, this cause the fan unable to move even if the temperature exceed the threshold temperature.
Solution 1
Connect the GND of the battery to the GND of arduino – common GND. If you are using a 5V relay instead of 12V relay, you only have to connect the arduino GND. I am using a 12V relay. So the coil voltage required would be higher.
Problem 2
When done uploading the code into my arduino UNO, the LCD display nothing.
Solution 2
After some troubleshoot work, I realised it is due to the contrast(pin 3 on LCD). You have to adjust the potentiometer connected to pin 3 of LCD until the LCD would display what you want it to display.
Hope this simple guides would lead you to make your own success Temperature-Controlled Automatic Fan too.
If you have any doubt, do leave your comments or contact me.
Hope you enjoy. Happy reading !
Thank you.

No comments:

Post a Comment