Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 04:02:54 16:02


Login with username, password and session length


Pages: [1]
Print
Author Topic: Simple PIC Fan Controller  (Read 3191 times)
0 Members and 1 Guest are viewing this topic.
Magnox
Active Member
***
Offline Offline

Posts: 249

Thank You
-Given: 976
-Receive: 279


Oink!


« on: June 19, 2019, 06:55:01 18:55 »

I've had a very long break from electronics due to unfortunate circumstances, but I'm back now. First job... make myself a new PSU. That was easy (it was mostly just wiring up SMPS modules into an old SCSI CDR enclosure) but I wanted a fan speed controller in it. I made one with what I had on hand.

The only 'clever' thing is the use of an adjustable LDO voltage regulator as the output stage. It had never occured to me to do that before but it worked nicely. The regulator adds its own reference voltage to the output, above the voltage I give to its reference input. So, I get almost the full 12V (11.7V) into the fan.

  • Microchip PIC 18F1320 controller (ADC, PWM, internal 8MHz oscillator, and because I have a box full)
  • Temperature sensed in two locations with Microchip MCP9701 linear sensors (because I have a bag full)
  • TI 2.5V TL431 reference for the ADC (I might as well because... you guessed it)
  • On Semi LM2931 output regulator (because it is LDO, has an Inhibit pin and... yes, a tube full!
  • Linear voltage output to fan: completely off, or 4.5V (minimum PWM determined by experiment) to 11.7V
  • Files attached for the design (CCS C, KiCad schematic and PCB) and a schematic PDF.
  • Most values are not critical.

The PIC samples the temperatures on a timer interrupt, averages and adds hysterisis to stop the output being annoying, and produces a PWM output of the required speed. Of course, two-wire fans (I had a nice Sunon to hand) don't like PWM. A low pass filter takes care of that, followed by an op amp to buffer and multiply by two. That feeds the regulator which adds its reference and feeds the fan. Simples! I used a 2.5V reference for the ADC to give more useful range. A couple of resistors to divide the 5V supply would suffice really, but I had the v.ref's so why not.

When I thought of using the regulator, a quick search found that I wasn't the first (well, d'uh) but the example I found was clearly flawed and could not possibly work as advertised. Mine does. The CA3130 (because I found one) runs fine on a single rail and the output goes to ground, so the final output is below the fan's minimum (only the regulator's reference voltage added). The regulator's Inhibit pin turns off the output when I want the fan off, so it's not sat there with a low voltage on it.

The code really should be tweaked and recompiled for a fan's minimum running speed. It gives a full speed burst to start the fan up, then drops speed to where required. The temperature set points are of course for my kit as are the rate of fan speed increase for each.

The PCB was designed to fit a small space in my enclosure with a screw hole in the middle, and to be 'hand made'. It could certainly be better, but it was quick to make and it worked. The circuit is simple enough to build on veroboard. Note that there is just one wire link on the PCB, for the Inhibit line from the PIC to the regulator. I wanted it finished and couldn't be bothered trying to re-route for it. Apart from three reservour capacitors, all passives are 1206 because I can route traces under those and still hand make the board.

To give a little protection from all the switching noise inside the case, the temperature sensor wires are old CD-ROM to motherboard audio cables. They are screened three-core and I earthed the screen to the case. The MCP9301 regulators use the internal wires of the cable, with a 1uF 1206 MLCC (not shown in the schematic) soldered directly across the sensor's power pins right underneath the plastic case. A heatshrink wrap finished those off nicely. At the board end, a low pass RC filter helps keep things smooth.
« Last Edit: June 19, 2019, 11:38:26 23:38 by Magnox » Logged
Signal
Active Member
***
Offline Offline

Posts: 197

Thank You
-Given: 111
-Receive: 81



« Reply #1 on: June 20, 2019, 09:30:42 21:30 »

The regulator adds its own reference voltage to the output, above the voltage I give to its reference input.
Interesting feature of LM2931!
But strictly speaking regulator does not add it's own reference to output (rather subtracts it from). I'd say (trying to avoid ambiguity) regulator's voltage reference is applied between ADJ pin and Output instead of ADJ pin and ground. So regulator adds reference voltage to ADJ pin potential.

Posted on: June 20, 2019, 11:25:44 23:25 - Automerged

Why R10 has value 330 Ohm?
Logged

Give a right name to a right game and play it right
Magnox
Active Member
***
Offline Offline

Posts: 249

Thank You
-Given: 976
-Receive: 279


Oink!


« Reply #2 on: June 20, 2019, 10:35:42 22:35 »

That... is a good question! I wondered if someone would ask.

The example circuit I found on the 'net used a 741 and LM317 regulator, with the 330 ohm resistor as in mine but with nothing given for the op amp feedback/gain resistors.

What I found simply by experiment with the LM2931 was that it seemed to give the expected output with that same value. With no resistor there, or other values, the output was off.

To be honest I couldn't be bothered analysing the regulator's circuit diagram to find out if I could calculate a better value or why it worked that way. I just wanted to get my PSU up and running.

If anyone feels in the mood to do so I would be interested, if I don't get around to it myself.
Logged
pickit2
Moderator
Hero Member
*****
Online Online

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #3 on: June 21, 2019, 02:32:07 14:32 »

R10 is a load resistor in Adj Regulator. its being set by the op-amp and R9-R8.
Data sheet says it all.
we used to get the new intake to design a Regulated Power Supply. with a list of parts needed.
Wait till they done all the work, transistors, resistors, and capacitors, the ask why not use a Regulator IC.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC