Guys,
This is more like a physics question or maybe I don't know this part in my project. I'm prepping a sketch for my motorbike's odometer/tachometer and am using Arduino, nokia 5110 LCD and Hall effect sensor to do that.
The problem is that I'm getting wrong readings with the below logic. I'm measuring the RPM near the HUB of the wheel and I'm using the radius of the wheel which is 0.300803 metres (calculated from the circumference measured from the outer edge of the inflated tyre)
Please refer to the attached diagram and excerpt from my sketch and suggest me if I'm making any physics calculative mistakes.
void setup()
{
lcd.InitLCD();
Wire.begin();
RTC.begin(); // Instantiate the RTC
attachInterrupt(0, rpm_fan, FALLING);
}
void loop()
{
if (millis() - lastmillis >= 1000)
{ //Uptade every one second, this will be like reading frecuency
detachInterrupt(0);
rpm = revs * 60;
//Speed = 2*pi*r × RPM × (60/1000) km/hr
// Here radius(r) = 0.300803 metres
speed = (2* 3.1415926536 *0.300803 * rpm * 60)/1000;
// lines to print the above values
revs = 0;
attachInterrupt(0, rpm_fan, FALLING);
}
}
void rpm_fan()
{
revs++;
}