Bridgeport Mill Tachometer

Tom O

Ultra Member
Have you tried looking at Solarbotics here in Calgary they are situated around 32Ave and 12St in the north.
 

YYCHM

(Craig)
Premium Member
Have you tried looking at Solarbotics here in Calgary they are situated around 32Ave and 12St in the north.

Yup... kind of pricey. I got a switch, enclosure and 9V battery holder there.

 
Last edited:

whydontu

I Tried, It Broke
Premium Member
still working on my mill controller, ran across a MUCH better tachometer framework. This library uses the main system clock to measure microseconds between pulses, takes maybe ten pulses and averages the time.

(correction - 30 pulses, should have read the code)

In testing it can easily track from1 Hz to 2500 Hz with good accuracy. 60 RPM to 150k RPM with my single trigger per revolution. Is not affected by other code in the loop, which I proved by adding a delay-flash-an-LED-delay after the frequency function, and changing the length of delay has no effect on accuracy.


The library is available in the usual Arduino <Manage Libraries> menu.

Here's my testing code:

#include <FreqMeasure.h>

// pin 8 is input

void setup() {
Serial.begin(57600);
FreqMeasure.begin();
pinMode(LED_BUILTIN, OUTPUT);
pinMode(8, INPUT);
}

double sum=0;
int count=0;

void loop() {
if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 30) {
float frequency = FreqMeasure.countToFrequency(sum / count);
Serial.println(frequency);
Serial.println(frequency *60); // converted to RPM
sum = 0;
count = 0;
// otherstuff
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait a bit
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait a bit
}

}
}
 
Last edited:

deleted_user

Super User
still working on my mill controller, ran across a MUCH better tachometer framework. This library uses the main system clock to measure microseconds between pulses, takes maybe ten pulses and averages the time.

(correction - 30 pulses, should have read the code)

In testing it can easily track from1 Hz to 2500 Hz with good accuracy. 60 RPM to 150k RPM with my single trigger per revolution. Is not affected by other code in the loop, which I proved by adding a delay-flash-an-LED-delay after the frequency function, and changing the length of delay has no effect on accuracy.


The library is available in the usual Arduino <Manage Libraries> menu.

Here's my testing code:

#include <FreqMeasure.h>

// pin 8 is input

void setup() {
Serial.begin(57600);
FreqMeasure.begin();
pinMode(LED_BUILTIN, OUTPUT);
pinMode(8, INPUT);
}

double sum=0;
int count=0;

void loop() {
if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 30) {
float frequency = FreqMeasure.countToFrequency(sum / count);
Serial.println(frequency);
Serial.println(frequency *60); // converted to RPM
sum = 0;
count = 0;
// otherstuff
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(10); // wait a bit
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(10); // wait a bit
}

}
}
that is the best method of sampling to achieve fast and accurate rpm returns
 
Top