Hi
Ive been using a hall effect sensor to measure the rotation speed of a spinning spherical neodymium magnet, using the code I found on DIYHACKS arduino-hall-effect-sensor-tutorial using their code
/*
Arduino Hall Effect Sensor Project
by Arvind Sanjeev
Please check out http://diyhacking.com for the tutorial of this project.
DIY Hacking
*/volatile byte half_revolutions;
unsigned int rpm;
unsigned long timeold;
void setup()
{
Serial.begin(115200);
attachInterrupt(0, magnet_detect, RISING);//Initialize the intterrupt pin (Arduino digital pin 2)
half_revolutions = 0;
rpm = 0;
timeold = 0;
}
void loop()//Measure RPM
{
if (half_revolutions >= 20) {
rpm = 30*1000/(millis() - timeold)*half_revolutions;
timeold = millis();
half_revolutions = 0;
Serial.println(rpm,DEC);
}
}
void magnet_detect()//This function is called whenever a magnet/interrupt is detected by the arduino
{
half_revolutions++;
//Serial.println("detect");
}
Its the [Sunfounder Hall Switch](SunFounder focuses on STEAM education with Open-Source robots hall sensor) everything goes well, I am getting my read out as a rediculously long list of numbers, the question is can anyone point at either the code, the hall sensor or the actual arduino, as to why can I only get to 25000 rpm and nothing above that displays even though the sphere is gaining speed beyond that number ?
Thanks in advance
Nik