Pages: [1]   Go Down
Author Topic: Temperature controlled fan speed using LM35  (Read 853 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

Does anyone have a simple sketch and schematic for the above, or at least point me in the right direction.

It is to control the internal cabinet temperature, of my CNC control cabinet, by varying the speed of the dc fan, ie, the fan goes faster the hotter the internal temp gets, having a set-point for coming ON and OFF. I would also like to programme a ATtiny 85 to save the Arduino for something else.

Having an LCD temp indicator would also be nice, but not necessary, but good as a project.

I found a schematic on the internet once but i  did not bookmark it, now i cannot remember were it is.

Regards
Ray
Logged

Sweden
Offline Offline
Full Member
***
Karma: 1
Posts: 185
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I have a sketch but it is quite large (222 lines of code), I use a 7-seg display + bargraph to indicate temperature and speed.

Here is an idé what you have to do:

1. First you should make a function that reads the temperature. You will find a lot of examples.
e.g. http://playground.arduino.cc/Main/LM35HigherResolution


2. Then you can use the Arduino PID-library to get a output value of 0-255. The temperatur from the function is the input.
Use the output value to control a PWM signal with analogWrite.
http://playground.arduino.cc//Code/PIDLibaryBasicExample

3.Adjust the PWM Frequency to >20Khz.
http://playground.arduino.cc/Code/PwmFrequency
http://arduino-info.wikispaces.com/Arduino-PWM-Frequency

4.  Use a Mosfet (or DC-DC SSR) to control your fan.

/Olof
« Last Edit: December 13, 2013, 01:33:45 pm by olof_n » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many thanks olaf, but a bit to far advanced for me, this is my first ever project, i can read schematics and make ocbs etc, but arduino language is very alien at the moment, i just really want a schematic and a list of parts, i will worry about the sketch later.

Regards

Ray
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well the LM35's easy: it has a signal wire which you use on an analog pin. The LM35's other 2 wires are just power.

Then for the fan, you'll need a transistor to switch it, and a resistor on the base. The motor itself will need a diode in parallel. This tutorial shows a typical setup to drive a motor. The characteristics of the transistor will depend on the fan.

Use a PWM pin to drive the transistor base, then you can vary the speed of the fan. You could even try without PID- some simple rules might work, eg if deltaT (the diff between set point and actual) is more than 20, go fast, if it's between 10-20 go medium and if it's less than 10, go slow. Bit of trial and error but will be easy to code and reduces complexity for your early project.
Logged

Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Pages: [1]   Go Up
Jump to: