i want to make speed meter with arduino but i need for very high speed motor (( water pump motor 2hp ))
so what should i use IR sensor or hall effect sensor
if IR sensor i use one like that ->
and i use that code->
#include <LiquidCrystal.h>
const int rs = 7, en = 8, d4 = 9, d5 = 10, d6 = 11, d7 = 12;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int encoder_pin = 2; // The pin the encoder is connected
unsigned int rpm; // rpm reading
volatile byte pulses; // number of pulses
unsigned long timeold;
// The number of pulses per revolution
// depends on your index disc!!
unsigned int pulsesperturn = 20;
void counter()
{
//Update count
pulses++;
}
void setup()
{
lcd.begin(16, 2);
Serial.begin(9600);
//Use statusPin to flash along with interrupts
pinMode(encoder_pin, INPUT);
//Interrupt 0 is digital pin 2, so that is where the IR detector is connected
//Triggers on FALLING (change from HIGH to LOW)
attachInterrupt(0, counter, FALLING);
// Initialize
pulses = 0;
rpm = 0;
timeold = 0;
}
void loop()
{
if (millis() - timeold >= 1000){ /*Uptade every one second, this will be equal to reading frecuency (Hz).*/
//Don't process interrupts during calculations
detachInterrupt(0);
//Note that this would be 60*1000/(millis() - timeold)*pulses if the interrupt
//happened once per revolution
rpm = (60 * 1000 / pulsesperturn )/ (millis() - timeold)* pulses;
timeold = millis();
pulses = 0;
//Write it out to serial port
Serial.print("RPM = ");
lcd.setCursor(0,0);
lcd.print("RPM = ");
Serial.println(rpm,DEC);
lcd.print(rpm,DEC);
//Restart the interrupt processing
attachInterrupt(0, counter, FALLING);
}
}
but when arduino work the lcd give me read till 700 RPM the back to zero
i want know if the problem here from sensor or the code
i so sorry for my bad english
Hall effect sensor has the advantage of less problems with dirt.
A magnet attached to the shaft may cause problems due to instability at 5000 rpm. It has got to be attached firmly to not fly off. A small hole in the shaft, or two notches (opposite sides) for a break beam sensor would be balanced.
Your motor specs should indicate the maximum free running speed it can do. This is important to know as you have to design your detection method based on this value.
1> lmgify = let me google it for you that right ??
any way i never read about the Rotary encoder so sorry
2> thanks for the now data but for the IR break beam why i think that the same idea of ir i talk be for but here the moving parts will cut the ir light not reflex it
The link you posted says RPM is 2850 and power is 1.1 kW (1.5 hp), the RPM of an AC induction will not vary much from full load to light load, maybe 100 RPM or 3%. I don't see the point in measuring it.
elsayed_ayman:
4> for hall effect if my motor run under 5000 rpm that mean will work good ??
That is not a magic limit or so. At 5000 rpm it may still work fine, it's just that you have to know what you're doing when modifying a system. Fast rotating systems require a proper balance or bad things may happen, and at speeds of 5000 rpm a small imbalance may become very noticeable.