Converting PULSIN reading to RPM, from PC Fan?
Hello.
I have a simple circuit with PC fan. It's tachometer output is tied to VDD via 10K resistor and goes into PIC16F886. Fan model is AD0812UX-A7BGL-LF
and rated speed is 3700 RPM. It has PWM input pin, which I control via the same IC. Code is below
Code:
CHECK:
if BUT3=0 then dly=dly-1
if BUT4=0 then dly=dly+1
pulsin rpm,0, cnt
lcdout $fe, $1, "PWM=", #dly, " ", #cnt, " "
hpwm 2,dly,20000
pause 100
GOTO CHECK
PULSIN inputs some readings, which are consistent with fan speed, but how to convert them into RPM?
AT PWM=0, PULSIN returns 3700. With increase of fan speed, value drops, at PWM=255, it returns 820.
Any ideas?
Re: Converting PULSIN reading to RPM, from PC Fan?
I've connected same fan to motherboard, and used it's bios settings to change speeds from min to max and based on that, updated the code, and now it delivers results consistent with motherboard readings.
cnt=60000/cnt*50.
Re: Converting PULSIN reading to RPM, from PC Fan?
It makes very little difference now that you've managed a method that works, but there is a pretty good read on measuring frequency with Pulsin here: http://batdetector.freevar.com/ArduBat/PulseIn.html (notice the misspelling).
Re: Converting PULSIN reading to RPM, from PC Fan?
Hmmm ...
I do not think at all PULSIN is the command to use ...
just open your Holy manual :rolleyes: on page 129 ...
May be you should consider closer the waveforms to choose the good measuring method.
I could also lead you to use the "capture" module of the processor ... but here I think a simple method would be much much followed by usable results ... :rolleyes:
Alain
Re: Converting PULSIN reading to RPM, from PC Fan?
Well, at page 129, there is DEBUG statement described, have no idea, how to use it for RPM measurement :D
Re: Converting PULSIN reading to RPM, from PC Fan?
Quote:
Originally Posted by
CuriousOne
Well, at page 129, there is DEBUG statement described, have no idea, how to use it for RPM measurement :D
Hmmm ...
Here I do recognise THE Curious one ...
Are you really sure you open your manual on page 129 ??? ... I think ( and I am sure !!! ) you open it on page 131 ...
BTW ... open your eyes too !!! ( at bottom right ... and not top browser page window :rolleyes: )
Alain
Re: Converting PULSIN reading to RPM, from PC Fan?
I already tried COUNT. Returns very low number of pulses - for 3700rpm it returns something like 120. Absolutely not precise.
1 Attachment(s)
Re: Converting PULSIN reading to RPM, from PC Fan?
There is this Tip n Tricks pdf that has #5 about RPM measurment using CCP in combination with #1 and #2 tips.
Ioannis
Attachment 8958
Re: Converting PULSIN reading to RPM, from PC Fan?
All my PWM/CCP channels are busy :)
Too bad they don't make chips with 8-16 PWM outputs :)
Re: Converting PULSIN reading to RPM, from PC Fan?
In your case you need an input.
Can you multiplex with another CCP input?
Ioannis
Re: Converting PULSIN reading to RPM, from PC Fan?
1) https://noctua.at/pub/media/wysiwyg/...hite_paper.pdf
2) @ these very low frequencies, the use of a divider per 2 ( so ... to measure the rotation period ! ) and using interrupts to drive a custom counter is to consider ...
aside that that wouldn't interfere much with the general timing ...
Now, being too accurate to measure a PC fan speed is somewhat a nonsense ... ( except for some geeks ... :D )
Alain
Re: Converting PULSIN reading to RPM, from PC Fan?
Maybe you mean x2 instead of divide by 2.
Ioannis
Re: Converting PULSIN reading to RPM, from PC Fan?
Quote:
Originally Posted by
Ioannis
Maybe you mean x2 instead of divide by 2.
Ioannis
Hi, Ioannis
No, no ... it's not an error : if you divide the pulse train per 2 ( D Flip-flop ...) ... the High or low pulse you get @ output has the exact rotation period ... ( remember how you did that with ol' 74 or 4000 logic chips ... ;) )
rising edge fires the counter ... falling edge stops it.
easy then to care with an IOC interrupt stubb ...
Best Regards
Alain
Re: Converting PULSIN reading to RPM, from PC Fan?
I was thinking in terms of frequency and the low frequency you stated pushed me into that error. Sorry...
Thanks for the clarification.
Ioannis
1 Attachment(s)
Re: Converting PULSIN reading to RPM, from PC Fan?
Quote:
Originally Posted by
Ioannis
I was thinking in terms of frequency and the low frequency you stated pushed me into that error. Sorry...
Thanks for the clarification.
Ioannis
You're Welcome Ioannis ...
AND we are old friends !!! ;)
Attachment 8959
Alain
Re: Converting PULSIN reading to RPM, from PC Fan?
Yeap! That's right! Nice picture with the two grands! Well I hope I don't look that old though...
Ioannis