Home and Links
 Your PC and Security
 Server NAS
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>
[Using a low end PIC to control a cooling fan] [Fan control] [Power control] [Temprature sensing] [Mounting the sensors] [The PIC] [Software]
PIC Cooling fan controller project

Using a low end PIC to control a cooling fan

You can find nay number of 12c DC fans designed to cool PC cases. Some are even 'temperature controlled'. However none are designed to cool the PC case to 'ambient' temperature, and that's exactly what you want for your telescope mirror

'Variable speed' fans can also be found for PC's, however these are controller manually and aimed more at noise reduction than temperature control.
I looked at using the 'guts' of such a unit along with a PIC temperature controller, however they are simply too expensive and too crude to be of much use.
The 'best' choice is to find a decent 12c fan and then design a PIC to control it


Fan control

DC fans are essentially motors. All you need to do is feed it a variable voltage and it will deliver variable speed

Actually, we don't really need to control a variable voltage since we don't really need a variable speed.
What we want is for the fan to run at maximum, to get a warm mirror moved from indoors down to the cooler outside temperature as fast as possible, and then switch off.
A cheap MOSFET is thus all that we need (if necessary, this can be driven by a PWM wave from the PIC control pin to get a variable voltage)

During a nights observing, the outside temprature may well change, however the rate of change will be low, so there will be no need for further cooling once the initial temprature is reached.


Power control

The ideal system is one that can be 'triggered' and then left to turn itsel;f off without the need for any futher 'iser' action

This can be achieved with a push-button activated relay with a 'self-locking' function.
Using a mechanical relay means there will be no power drain when the relay is 'off'.


Temprature sensing

A simple thermister - such as the NTC MF52-103 - should be all that's needed

The NTC MF52-103 inccreases it's resistance from 10k-ohm at 25C to almost 40k at 0C.
Rated values are :-
25c 10k, 20c 12.5k, 15c 16k, 10c 20k, 5c 25.5k, 0c 39k, -5c 43k

Cost is approx 10p each (10pcs for 99p, eBay, China)

A PCB mounted NTC MF52-103 with A-D converter and 'zero' trimmer can be had for 35p each (Qty 10, Digital Thermal Thermistor Temperature Sensor Module for Arduino' for £3.49, eBay China), however this presents a 4 pin digital interface and is some-what 'over-kill' for a simple system

See my Basic-ADC-resistance-measurement page for how to measure a variable resistance.

Note that a Negative Temprature Coefficient (NTC) device increases it's resistance as the temprature drops. So rather than measureing from 10k to 1k with 2u2 capacitor, we will need to measure from 10k to perhaps 50k with a 1uF (or smaller) capacitor.

You don't need to know the actual temprature values, only that the telescope mirror glass is warmer than the surrounding air.

If the fan control is turned on when the telescope is indoors, then both sensors should be indicating the same temperature.
However, even if both are of the exact same resistance, both the 180R charge/discharge current limit resistor and the 'timer' capacitor are likely to differ in value.
At power on, the PIC can measure both sensors and thus discover any 'offset error' between the two.
This allows the PIC to 'auto-calibrate' the sensors along with the 'sensing' C-R network (it's easy enough to find two 180R resistors within 1%, however finding two capacitors to better than 5% is likely much harder.


Mounting the sensors

The biggest difficulty will be making sure the mirror sensor is 'glued' to the actual glass.

To ensure it detects the outside air temprature quickly, the second sensor can be glued to ot's own small heatsink or just glued to some metal part of the telescope that is likley to cool down quickly, such as the telescope tube or 'OTA'



So, we need 2 pins for temp. measurement plus 1 to control the fan power MOSFET. A 4 i/o pin PIC should do the trick. My 'target' will be the PIC10F206

Using the internal 4MHz OSC we get 1 MIPS which should be more than sufficient.
The 8bit TMR0 plus the Comparator (which can be 'switched' between the two 'sense' pins as needed) will be used to 'measure' the temperature sensors resistance.
It's 512 instructions and 24 'registers' should be all that's needed to run the program code.

Unfortunately, the PIC10F206 has only 3 i/o pins (the 4th pin is an 'input only' pin) and we need an output to 'turn off' the power relay when the required (outside) temperature is reached.

This means we have to 'cheat' in some way. The two sensor pins have to be left alone if we are to avoid upsetting the measurement. That leaves the fan control pin.
We need 3 'states' - fan off, fan on and system power off. Firtunatly, a PIC i/o pin does actually have 3 states. THese are :- output logic Hi, output logic Lo, and input 'floating'. A simple resostor voltage diovoder can be used to hold the i/o pin at 'half voltage' when it is set to 'input'. This gives us 3 voltage levels - Hi (4v3), 'half' (2v5) and Lo (0v3).

At power-on, the pin will be set to 'input' which is 2v5. So this has to correspond to the system default state i.e. 'fan off' and 'not power off'. Since both the fan and relay are 'inductive' devices - i.e. they incorporate windings that, which 'turned off' can generate high 'back emf' voltages. These voltage can damage a PIC, so it is a 'good idea' to use a diode or transistor between an inductive load and the PIC i/o pin. The 'extra' components can do 'double duty' be isolating the fan and relay from each other.

Using a relay rated at 3v, the 'obvious' approach is to wire the relay to 3v3 and connect it to the PIC pin via a Schottky diode (which will drop about 0v3). The 'logic half' voltage of 2v5 will be insufficient to trip the relay, and the Hi drive will be blocked by the diode. Only the Lo drive will trigger the relay and shut down the unit.
That leaves the 'hi' drive to turn on the fan. The fan is 12v rated, so the PIC will have to 'switch' the fan power using a MOSFET or similar.
For an n-channel mosfet, the gate has to be taken 'hi' to turn the device on. The problem will be to ensure the 2v5 'set' voltage is too low to turn it 'on' whilst at the sanme time the 4v3 is sufficient to drive the M



Next page :- PIC16F54 StarTrack