Go Down

Topic: Current monitor for fan running with PWM through FET (Read 5738 times) previous topic - next topic


Nov 15, 2012, 08:52 pm Last Edit: Nov 15, 2012, 08:55 pm by retrolefty Reason: 1
Btw, i still don't really understand, how to synchronize the analogRead with the PWM (to measure without low pass filter). Can you give me a code example? This is my part for measuring current:

I don't think such a method exists, In the external (to the AVR chip) electronics world the PWM lives in the digital domain and the analogReads lives in the pure analog world, they are only equally digital inside the code, So external low pass filtering to eliminate the PWM switching frequency will always be required, unless someone can prove differently?

On second thought, I guess it would be possible to implement a low pass filtering function in code to take many analogRead samples and effectively filter out the PWM switching frequency, might be an interesting project for someone better at software then me.  ;)



Btw, i still don't really understand, how to synchronize the analogRead with the PWM (to measure without low pass filter). Can you give me a code example?

Something like: (warning - untested code!)

Code: [Select]

 int sensorValue;
    while (digitalRead(fan) == LOW) { }    // wait for PWM pin to go high
    sensorValue = analogRead(A0);
 while (digitalRead(fan) == LOW);   // repeat if PWM pin has gone low already

 float voltage = sensorValue * 5.0 / 1024.0;  
 float current = voltage / 0.22;
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.


The simplest method is to buy a fan with a speed feedback output, most computers use one... on the Processor and there are Many different types available. Go For Google...

--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


I bought TC670 predictive fan failure detector.. If i power my fan directly with 12V it works great with any kind of fan (because of this i am using this IC).

Now i've got a problem because i want to run my fan through FET with PWM. If i use 100% pwm (255 in arduino) this detector works but not if i use any other PWM value. I tried to add low pass filter between source of FET and SENSE of IC but without luck.

Does anyone have any idea how to fix this? This are pictures of TC670 scheme and FET with fan. I connected fet above the sense input, so the SOURCE of the FET and sense resistor and capacitor are connected.




I think I found a solution.. I didn't try yet but it seems like that's it.



I tried this technique but without luck. The same problem like before. If i am running FET with 255 (100% PWM) from arduino signal led is always on but if i use any other PWM value (191 for example), led is always off (also if i am holding fan).

Any idea?

I am using TC670 with IRF530 FET.

TC670 scheme

FET wiring

Go Up