ใครมี code วัด RPM ขอหน่อยครับ ของอะไรก็ได้ครับ PIC AVR ARM
Motor ชนิดไหนครับใช้ encoder แบบไหน
MOtor CPU ครับ
http://www.themakersworkbench.com/content/tutorial/reading-pc-fan-rpm-arduino (http://www.themakersworkbench.com/content/tutorial/reading-pc-fan-rpm-arduino)
by google ;D
http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/
ถ้าใช้ Arduino ดูตามลิงค์ เลยครับ มันเป็นการอ่านความถี่ ถ้าอ่านความถี่จาก encoder เราต้องรู้ก่อนว่า มันหมุนไป 1 รอบ ให้ พัลส์กี่ลูก
เพื่อที่จะได้เอาคำนวน เป็นความเร็วรอบ
S=(F x 60) / P
โดย
S=ความเร็วรอบต่อนาที
F=ความถี่ (Hz)
P=จำนวนสัญญาณพัลส์ต่อรอบ
#include <FreqCounter.h>
int P= 100;
void setup() {
Serial.begin(57600); // connect to the serial port
Serial.println("Frequency Counter");
}
long int frq;
Void loop() {
FreqCounter::f_comp= 8; // Set compensation to 12
FreqCounter::start(100); // Start counting with gatetime of 100ms
while (FreqCounter::f_ready == 0) // wait until counter ready
frq=FreqCounter::f_freq; // read result
Serial.println((frq*60)/P); // print result
delay(20);
}
ลองดูนะครับ
intput เข้า pin 5 ของ Arduino นะครับ
ขอบคุณมากครับได้แล้วครับ