Pages: [1]   Go Down
Author Topic: arduino RPM meter for laser project  (Read 683 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
I Love YaBB 2!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello
I am using arduino to make an RPM meter to read the pulses off an ordinary intel cpu fan with 3 leads (+,-, rpm signal)
I tried using digitalread() and pulsein() but I get fuzzy results.
anyone knows how to read those signals reliably?

code examples:




void loop()
 {
  
  scanvalue=digitalRead(7);
  if (scanvalue!=previous_scan) {pulsecount++; previous_scan=scanvalue;}
    
   if (millis() - previousMillis > interval)
  {
   interval=((millis() - previousMillis)/pulsecount)*50
   previousMillis = millis();    
   pulsecount=0;

   //code blinking code here
   }
}

Logged

Poitiers (France)
Offline Offline
Full Member
***
Karma: 0
Posts: 136
Ca va j'vais le faire !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Tomas,

You have to use an external interruption. Look at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1147164546, link is in french but you can understand code. In summary, the SIGNAL(SIG_INTERRUPT0) function is called each time the state of the digital digital change.
Logged

Cordialement,
Benoît ROUSSEAU

Poitiers (France)
Offline Offline
Full Member
***
Karma: 0
Posts: 136
Ca va j'vais le faire !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Tomas,

I've made a reply with code here : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152891511/0.
Logged

Cordialement,
Benoît ROUSSEAU

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
I Love YaBB 2!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks very much!
merci

ts
Logged

Pages: [1]   Go Up
Jump to: