# Tachometers



## Rauce (Mar 30, 2022)

I’m interested in adding tachometers to some of my tools since I have variable speed drives on everything. 

I have bought and tried the cheap Hall effect ones and not been overly impressed. 

Found a product called the Tachulator that makes them with optical sensors and both with and without a built in SFM calculation feature. There are a few resellers in the states like http://www.mkctools.com/tachulator.htm and little machine shop. I was surprised to find with some digging that they are made in Toronto by http://www.trexon.com/ . 

Has any one bought or seen one in person before? I emailed the address on the trexon page but didn’t get a response.


----------



## Susquatch (Mar 30, 2022)

Nothing, but interested in knowing what you find. 

@whydontu out in BC has done some awesome work with an Arduino. @YYCHM has already implimented some of the concepts. 

Thread 'Bridgeport Mill Tachometer' https://canadianhobbymetalworkers.com/threads/bridgeport-mill-tachometer.3986/

The thread covers some of the issues and might explain your experience. Like so many digital systems, the numbers depend on the programmer who may or may not have a clue about what's really going on or how to make it work..... 

Lots of other info on the forum. Try searching on "Tachometer Arduino" on the forum. 

My DRO has the hall effect system built in. But no SFM. I am still thinking I'll make my own. I have very little faith that they did it right. (running average, missing counts, filtering, programmability, etc


----------



## Mcgyver (Mar 30, 2022)

Good topic.  I looked at the unit in the link, how does SFM work when there is no keyboard to input the diameter? 

What didn't you like about the hall sensor types?  

I like the idea of a tach, but think maybe SFM is a bit gimmicky.....even if you could enter dia, its so quick to do rpm=4*CS/dia in your head I probably couldn't be bothered constantly punching in a dia.


----------



## Rauce (Mar 30, 2022)

Mcgyver said:


> Good topic.  I looked at the unit in the link, how does SFM work when there is no keyboard to input the diameter?
> 
> What didn't you like about the hall sensor types?
> 
> I like the idea of a tach, but think maybe SFM is a bit gimmicky.....even if you could enter dia, its so quick to do rpm=4*CS/dia in your head I probably couldn't be bothered constantly punching in a dia.


From what I can tell the knob is also a push button, so you push to switch modes to the input function and then turn it to dial in a diameter.

I agree that it’s a bit gimmicky, I definitely wouldn’t bother with the SFM version on my drill press and could easily live without it on my lathe and mill. 

My Excello has the variable speed pulley system and I rarely change speed at the VFD. The displayed speed on the machine head is accurate enough. 

What really got me thinking about this is the incoming hendey lathe. Other than the back gear all speed control will be from the motor/drive so a tachometer would be handy. I could of course make a chart of RPM at spindle vs. Drive frequency to reference but it would be nice to just have a display. I still have a $25 Amazon Hall effect thing but I was hoping there was a better plug and play option that I would trust more. Making a custom mount/enclosure is fine but I’d prefer not to mess with electronics or programming.


----------



## Mcgyver (Mar 30, 2022)

Rauce said:


> What really got me thinking about this is the incoming hendey lathe.



So you did the deal?  Right on.  Glad to have been the matchmaker on it


----------



## Rauce (Mar 30, 2022)

Susquatch said:


> Nothing, but interested in knowing what you find.
> 
> @whydontu out in BC has done some awesome work with an Arduino. @YYCHM has already implimented some of the concepts.
> 
> ...


Maybe you or someone else knows more but a lot of the equipment I deal with at work (turbines/compressors) have stand alone tachometers or sensors wired in to a PLC or similar control system. Typically we physically install this stuff but some control tech at site takes it from there. These have a non contact sensor positioned near a toothed wheel. No magnets, not optical as far as I can tell. It seems having a pick up wheel with multiple positions would yield greater accuracy right? The trexon device is optical but gives you option of multiple pick up points per rotation.


----------



## Rauce (Mar 30, 2022)

Mcgyver said:


> So you did the deal?  Right on.  Glad to have been the matchmaker on it


Haven’t picked it up yet (scheduled for next Friday) but yeah I’m commited!


----------



## Susquatch (Mar 30, 2022)

Rauce said:


> Maybe you or someone else knows more but a lot of the equipment I deal with at work (turbines/compressors) have stand alone tachometers or sensors wired in to a PLC or similar control system. Typically we physically install this stuff but some control tech at site takes it from there. These have a non contact sensor positioned near a toothed wheel. No magnets, not optical as far as I can tell. It seems having a pick up wheel with multiple positions would yield greater accuracy right? The trexon device is optical but gives you option of multiple pick up points per rotation.



My goto reference for such things nowadays is the crankshaft position sensor in a modern engine. Not only do they know the RPM very accurately, but they also know the exact position in each revolution as well as the rate of change of rpm (accelerating decellerating, etc etc.

They typically use a sort of hall effect sensor that actually counts gear teeth in a ring gear as well as a special syncing tooth to keep everything accurate. I'd bet big bucks that's what you saw for turbines.

The problem here is speed. If the device measuring the speed isn't order's of magnitude faster than the devices it is measuring, the whole house of cards crumbles. That is why I wanted to directly access the timer registers in the Arduino. I just have not had time to do it. And at the rate that time is flying by, I may never do it.

It's not that I don't have the time or the knowledge. Instead, it's all about priorities. My first priority is a working dro on my mill, then my farm gps navigation system that I need working before May, then then then. Someday I'll get to the tach. In the meantime, as others have said, it is not essential.

As @Mcgyver says, the sfm number is ridiculously easy to do. And if not, there are websites, calculators, and graphs that make it even simpler. So it's not a real big deal or a show stopper either way.

In the thread I referenced above, @whydontu got it working acceptably with an Arduino.


----------



## ShawnR (Mar 30, 2022)

Rauce said:


> Maybe you or someone else knows more but a lot of the equipment I deal with at work (turbines/compressors) have stand alone tachometers or sensors wired in to a PLC or similar control system. Typically we physically install this stuff but some control tech at site takes it from there. These have a non contact sensor positioned near a toothed wheel. No magnets, not optical as far as I can tell. It seems having a pick up wheel with multiple positions would yield greater accuracy right? The trexon device is optical but gives you option of multiple pick up points per rotation.



I think they would be using proximity sensors. They sense the steel. The tooth triggers it whereas the space between the teeth does not (yes, that sensitive) Doing it this way, dropping a pulse or two or 10 will not adversely affect the signal. Then, in the programming, the tooth count is divided out. Very nice but a little elaborate for the home shop, although, with an arduino, not hard to do at all. I don't know the cost of the sensors good enough to do this but with technology, they might be cheaper than I think

I had to research a bit. Something like this what I am *guessing *they use for the installation as you describe

Sensor


----------



## Susquatch (Mar 30, 2022)

ShawnR said:


> I think they would be using proximity sensors. They sense the steel. The tooth triggers it whereas the space between the teeth does not (yes, that sensitive) Doing it this way, dropping a pulse or two or 10 will not adversely affect the signal. Then, in the programming, the tooth count is divided out. Very nice but a little elaborate for the home shop, although, with an arduino, not hard to do at all. I don't know the cost of the sensors good enough to do this but with technology, they might be cheaper than I think
> 
> I had to research a bit. Something like this what I am *guessing *they use for the installation as you describe
> 
> Sensor



A crankshaft position sensor is a LOT cheaper. Extremely high volume part. Dead nuts reliable too. 






						A-Premium Crankshaft Position Sensor Compatible with Hyundai Accent Elantra Coupe GT Tucson Veloster Kia Forte Koup Rio 2012-2019 Soul 2010-2019, Crankshaft Position - Amazon Canada
					

A-Premium Crankshaft Position Sensor Compatible with Hyundai Accent Elantra Coupe GT Tucson Veloster Kia Forte Koup Rio 2012-2019 Soul 2010-2019 in Crankshaft Position.



					www.amazon.ca


----------



## ShawnR (Mar 30, 2022)

Damn! Another project! 

Quit doing that @Susquatch !!


----------



## David_R8 (Mar 30, 2022)

Rauce said:


> I’m interested in adding tachometers to some of my tools since I have variable speed drives on everything.
> 
> I have bought and tried the cheap Hall effect ones and not been overly impressed.
> 
> ...


I emailed the Tachulator reseller but haven't received a response.


----------



## whydontu (Mar 30, 2022)

Tachulator seems reasonable on price, maybe double the cost to build mine. 

Most expensive single component was the 5”x5” electrical box.

Mine uses an IR optical sensor counting holes in a punched disc attached to the quill. The Arduino code measures time between successive pulses, averages out the value after seven pulses, and displays the results. Two dials set cutter diameter and material. This is used to calculate recommended RPM and SFM. The tachometer calculates actual running SFM from RPM and cutter diameter.

Top two lines are current, bottom two lines are reference book values.


----------



## David_R8 (Mar 30, 2022)

whydontu said:


> Tachulator seems reasonable on price, maybe double the cost to build mine.
> 
> Most expensive single component was the 5”x5” electrical box.
> 
> ...


Did you write the code yourself?


----------



## whydontu (Mar 30, 2022)

Cobbled together from this. My programming skills are best described as brute force with zero elegance.

I added code to read two pots and select material and sfm values from a simple lookup table, then use these values and a bit of math to calculate the display text.

A real programmer could probably write it better, but my hack works so it’s Good Enough.









						Easy Arduino Tachometer
					

Build your own tachometer with an LCD display to check some RPMs.




					www.pyroelectro.com


----------



## David_R8 (Mar 30, 2022)

whydontu said:


> Cobbled together from this. My programming skills are best described as brute force with zero elegance.
> 
> I added code to read two pots and select material and sfm values from a simple lookup table, then use these values and a bit of math to calculate the display text.
> 
> ...


Thanks! I have an Arduino sitting around looking for a project so...


----------



## chip4charlie (Mar 30, 2022)

LMS sells the Tachulator: https://littlemachineshop.com/products/product_view.php?ProductID=2658&category=


----------



## SomeGuy (Mar 30, 2022)

Not that this is what you're looking for, but as a cheap "check the RPM" thing...these do work:


			Amazon.ca
		

Worth grabbing if this isn't something you're too worried about all the time (like if a few key marks on your speed dial would get you close enough).


----------



## Rauce (Mar 30, 2022)

chip4charlie said:


> LMS sells the Tachulator: https://littlemachineshop.com/products/product_view.php?ProductID=2658&category=


Yeah that’s where I saw it first. If I can get it from the manufacturer that would be better than buying from the US. 

I do have a princess auto optical tach  like that Amazon one, but it would be nice to have something permanently fitted to the lathe.


----------



## David_R8 (Mar 30, 2022)

@Rauce I just received a reply from Trexon:


Hi, David:-

Tachulator is 115.00 + 10.00 shipping + 5% GST (BC) = 131.25 CAD
including sensor.

Payment can be by Paypal or Interac to this e-mail.

It would take a couple days to finish off your unit. Please let
me know if you would like to go ahead.

Best regards,
--sp

I might go for this option...


----------



## Rauce (Mar 30, 2022)

David_R8 said:


> @Rauce I just received a reply from Trexon:
> 
> 
> Hi, David:-
> ...


As did I! I probably will order one as well.


----------



## whydontu (Mar 30, 2022)

I wish I had researched the Tachulator before I built my Arduino version. The Tachulator does similar functions to mine, maybe not as convenient but looks more robust than an Arduino. At $132 including shipping and tax is looks like a great option. I’ve probably got 20 hours into building and coding mine.


----------



## David_R8 (Mar 30, 2022)

whydontu said:


> I wish I had researched the Tachulator before I built my Arduino version. The Tachulator does similar functions to mine, maybe not as convenient but looks more robust than an Arduino. At $132 including shipping and tax is looks like a great option. I’ve probably got 20 hours into building and coding mine.


I only just learned about the Tachulator on March 27 from a post on Hobby Machinist.


----------



## YYCHM (Mar 30, 2022)

whydontu said:


> I wish I had researched the Tachulator before I built my Arduino version. The Tachulator does similar functions to mine, maybe not as convenient but looks more robust than an Arduino. At $132 including shipping and tax is looks like a great option. I’ve probably got 20 hours into building and coding mine.



Ya, but look at how much fun you had figuring it out.  The learning experience is priceless.


----------



## Susquatch (Mar 30, 2022)

SomeGuy said:


> Not that this is what you're looking for, but as a cheap "check the RPM" thing...these do work:
> 
> 
> Amazon.ca
> ...



@Rauce, @SomeGuy, & @David_R8 .

I actually like the optical tach. As a cheap check the tach device, they work.  I have an old mechanical one that counts revolutions and you use with a stop watch. It is dynamite, but one of my boys borrowed it to check his marine engine and it never came home.

If you are having trouble with the optical tach, try using it at about 12 inches from the reflective tape, and use black electrical tape to mask off all the way around the shaft but where you have the reflective tape. That dramatically improves contrast and steadies up the reading.

You guys might like that gizmo from Trexon, but keep in mind that using the Arduino ala @whydontu, is MUCH more flexible and adaptable. Plus you can always add features. You cannot do that with the Trexon which is strictly "what you see is what you get".


----------



## David_R8 (Mar 31, 2022)

So a bunch of surfing last night and for about $20 I can build an Arduino based tachometer that uses infrared light as the trigger.
So I added some electronic components into my shopping cart:


			Amazon.ca
		






						1pcs 16x2 Character LCD Display LCD Module,IIC LCD1602 Green : Amazon.ca: Industrial & Scientific
					

1pcs 16x2 Character LCD Display LCD Module,IIC LCD1602 Green : Amazon.ca: Industrial & Scientific



					www.amazon.ca
				








						1pcs 16x2 Character LCD Display LCD Module,IIC Interface : Amazon.ca: Industrial & Scientific
					

1pcs 16x2 Character LCD Display LCD Module,IIC Interface : Amazon.ca: Industrial & Scientific



					www.amazon.ca
				




I already have an Arduino so there's that


----------



## whydontu (Mar 31, 2022)

David_R8 said:


> So a bunch of surfing last night and for about $20 I can build an Arduino based tachometer that uses infrared light as the trigger.
> So I added some electronic components into my shopping cart:
> 
> 
> ...


I’ve probably tried a dozen different boxes of Arduino tachometer codes. This one is the best, except because it uses interrupts to measure time between pulses it can’t be used for any other functions.On the other hand, it’s very stable and very accurate.






						FreqMeasure Library, for Measuring Frequencies in the 0.1 to 1000 Hz range, or RPM Tachometer Applications
					






					www.pjrc.com


----------



## David_R8 (Mar 31, 2022)

whydontu said:


> I’ve probably tried a dozen different boxes of Arduino tachometer codes. This one is the best, except because it uses interrupts to measure time between pulses it can’t be used for any other functions.On the other hand, it’s very stable and very accurate.
> 
> 
> 
> ...


Thank you sir!


----------



## Susquatch (Mar 31, 2022)

whydontu said:


> I’ve probably tried a dozen different boxes of Arduino tachometer codes. This one is the best, except because it uses interrupts to measure time between pulses it can’t be used for any other functions.On the other hand, it’s very stable and very accurate.
> 
> 
> 
> ...



I don't understand this @whydontu. I must be missing something. I would have thought the exact opposite. 

The whole purpose of the processor interrupt system is to allow the processor to do other things when it isn't busy with a priority task. 

In a tach, the processor would be busy calculating sfm or stress or or or until it gets an interrupt to get an rpm count, reset the counters, and update the display. Then it would exit the tach interrupt routine and pick up where it left off on the other lower priority task. 

What am I missing?


----------



## whydontu (Mar 31, 2022)

Susquatch said:


> I don't understand this @whydontu. I must be missing something. I would have thought the exact opposite.
> 
> The whole purpose of the processor interrupt system is to allow the processor to do other things when it isn't busy with a priority task.
> 
> ...


major snag with this one - rising edge of pulse kicks the interrupt, times until next rising edge, and calculates t2-t1. If the quill stops turning, it hangs until the next rising edge to reset the timer. Tach is now stuck. 

My programming skills arent good enough to interpose an If statement to detect when the quill is stopped. I tried multiple ways to stick my subroutines in the timing gap to read the material and cutter values to calculate SFM, but never got it to work.

I have code that works in real time, but I’m only going to send it out to the world if no one laughs at my code…


----------



## SomeGuy (Mar 31, 2022)

whydontu said:


> major snag with this one - rising edge of pulse kicks the interrupt, times until next rising edge, and calculates t2-t1. If the quill stops turning, it hangs until the next rising edge to reset the timer. Tach is now stuck.
> 
> My programming skills arent good enough to interpose an If statement to detect when the quill is stopped. I tried multiple ways to stick my subroutines in the timing gap to read the material and cutter values to calculate SFM, but never got it to work.
> 
> I have code that works in real time, but I’m only going to send it out to the world if no one laughs at my code…



I'm a software dev (well, architect now) by day...can I take a look and maybe I can make a few suggestions?


----------



## David_R8 (Mar 31, 2022)

whydontu said:


> major snag with this one - rising edge of pulse kicks the interrupt, times until next rising edge, and calculates t2-t1. If the quill stops turning, it hangs until the next rising edge to reset the timer. Tach is now stuck.
> 
> My programming skills arent good enough to interpose an If statement to detect when the quill is stopped. I tried multiple ways to stick my subroutines in the timing gap to read the material and cutter values to calculate SFM, but never got it to work.
> 
> I have code that works in real time, but I’m only going to send it out to the world if no one laughs at my code…


No laughing on my part!


----------



## Susquatch (Mar 31, 2022)

whydontu said:


> major snag with this one - rising edge of pulse kicks the interrupt, times until next rising edge, and calculates t2-t1. If the quill stops turning, it hangs until the next rising edge to reset the timer. Tach is now stuck.
> 
> My programming skills arent good enough to interpose an If statement to detect when the quill is stopped. I tried multiple ways to stick my subroutines in the timing gap to read the material and cutter values to calculate SFM, but never got it to work.
> 
> I have code that works in real time, but I’m only going to send it out to the world if no one laughs at my code…



I see. Well that's a different outcome than I expected! 

How about making the software "assume" it stopped unless something tells it didn't. Sort of an A** backward approach?


----------



## whydontu (Mar 31, 2022)

File is a plain txt file, I couldn't upload as an .ino file.

No snickering or snide comments about my coding is allowed, I'll start to cry. I'd be happy to have a better programmer clean up this code, hint hint...

And no whining about my using two pots to select cutter diameter and material, it's cheap, simple to code, and means each dial only has one function, a defining characteristic of good HMI design. I could have changed it to a rotary encoder, but Arduino nanos only have two interrupt pins, so it would need a menu system and multiple steps to select inputs, so why bother?

My mill has a 16-hole disc on the quill, just change the RPM Array formula to match the number of pulses available per revolution. And any IR sensor will work, I first set it up with a reflective sensor and a single chunk of white tape on the quill.

My mill tops out a 2000 RPM, so my <cal rpm> function displays ">2000" for any calculated rpm values above 2000, no point in displaying something my mill can't do. YMMV

There is no code restrictions on the actual tachometer display, I've successfully tested this at 5,000 RPM with good results.

/*
  Modified from:

  Author: Chris @ PyroElectro.com
  Date: 8/26/2012
  Description:
  This project is meant to capture interrupt counts from an IR breakbeam circuit
  and display them as an RPM number on a 16x2 LCD module.

  Full Project Details:
http://www.pyroelectro.com/tutorials/tachometer_rpm_arduino/

components

Arduino Nano
Nano screw terminal board
20x4 LCD with I2C interface
Two 10K pots
LM393 slot-type iR speed sensor module





						Slot Type IR Optocoupler Speed Sensor Module (LM393 Chip) - X2 Robotics in Canada
					

This speed sensor has an optical sensor that allows you to measure revolution per minute (RPM).




					x2robotics.ca
				



USB power adapter
case, etc.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 20, 4);

// SDA pin A4
// SCL pin A5



volatile float time = 0;
volatile float time_last = 0;
volatile int rpm_array[7] = {0, 0, 0, 0, 0, 0, 0};

void setup()
{
  //Digital Pin 2 Set As An Interrupt
  attachInterrupt(0, fan_interrupt, FALLING);

  // set up the LCD's number of columns and rows:
  lcd.begin();
  // Print the main header to the LCD.
  lcd.setCursor(0, 0);
  lcd.print("Current RPM: ");
}

void loop()
{
  int rpm = 0;

  while (1) {

    //Slow Down The LCD Display Updates
    delay(500);

    // fill array of cutter diameters
    float CutterSixteens[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 40, 48, 64}; // cutter diamters in sixteenths
    char* CutterNames[] = {"1/16\" ", "1/8\"  ", "3/16\" ", "1/4\"  ", "5/16\" ", "3/8\"  ", "7/16\" ", "1/2\"  ", "9/16\" ", "5/8\"  ", "11/16\"", "3/4\"  ", "13/16\"", "7/8\"  ", "15/16\"", "1\"    ", "1-1/4\"", "1-1/2\"", "2\"    ", "2-1/2\"", "3\"    ", "4\"    "}; // cutter descriptions in text
    int HSSsfm[] = {300, 150, 100, 80, 50, 90, 80, 40, 50, 60, 40, 175, 500}; // book values for SFM for materials

    // Set cutter diameter
    int CutterDial = analogRead(A2); // 10K pot wiper to analog Pin 2
    int  Cutter = map(CutterDial, 0, 1023, 0, 21); // maps pot to 1 of 12 cutter diamters

    char* MatNames[] = {"ALUMINUM   ", "BRASS      ", "COPPER     ", "SOFT IRON  ", "HARD IRON  ", "MILD STEEL ", "CAST STEEL ", "ALLOY STEEL", "TOOL STEEL ", "S-STEEL 303", "S-STEEL 316", "PLASTICS   ", "WOOD       "};

    // Set material
    int MatList = analogRead(A1); // 10K pot wiper to analog Pin 1
    int  Material = map(MatList, 0, 1023, 0, 13); // maps pot to 1 of 14 material types

    float SFM = (((CutterSixteens[Cutter] / 16) * rpm) / 3.82);
    int smoothedSFM = SFM * .2; // divided by five to get to multiples of five
    int displaySFM = smoothedSFM * 5; // restores by 5 to get back to rounded x 5 sfm

    // cutter rpm = sfm x 3.82 / cutter diameter in inches
    // sfm = rpm x cutter diameter in inches / 3.82
    // cutter diamters from array is in sixteenths

    int HSBookRPM = ((HSSsfm[Material]) * 3.82 / ((CutterSixteens[Cutter]) / 16));

int calmeddisplayRPM = rpm /5; // divided by five to get to multiples of five
int displayrpm = calmeddisplayRPM * 5; // restores by 5 to get back to rounded x 5 rpm

    //Clear The Bottom Row
    lcd.setCursor(13, 0);
    lcd.print("      ");

    //Update The Rpm Count
    lcd.setCursor(13, 0);
    lcd.print(displayrpm);


    lcd.setCursor(0, 2);    // prints out cutter size on line 3

    lcd.print(CutterNames[Cutter]);
    lcd.setCursor(7,2);
    lcd.print("cal rpm "); //prints out calculated rpm and restricts to 2000 max
    if (HSBookRPM > 2000){
      lcd.print(">2000");
    }
    else {
    lcd.print(HSBookRPM);
    lcd.print("  ");
    }

   lcd.setCursor(0, 1);
  lcd.print("Current SFM: ");
  lcd.setCursor(13, 1);
  if (displaySFM <5){
    lcd.print("<5");
  }
  else {
  lcd.print(displaySFM);
  lcd.print("   ");
  }

    lcd.setCursor(0, 3);    // prints material name on line 4
    lcd.print(MatNames[Material]);
    lcd.print(" "); //kills trailing zero
    lcd.setCursor(12,3); // prints material sfm on line 4
    lcd.print("sfm ");
    lcd.print(HSSsfm[Material]);
    lcd.print(" ");




    //Update The RPM
    if (time > 0)
    {
      //5 Sample Moving Average To Smooth Out The Data
      rpm_array[0] = rpm_array[1];
      rpm_array[1] = rpm_array[2];
      rpm_array[2] = rpm_array[3];
      rpm_array[3] = rpm_array[4];
      rpm_array[4] = rpm_array[5];
      rpm_array[5] = rpm_array[6];
      rpm_array[6] = 60 * (1000000 / (time * 16)); //(time x pulses per revolution) - mill quill has 16 perforated holes around circumference
      //Last 5 Average RPM Counts Eqauls....
      rpm = (rpm_array[0] + rpm_array[1] + rpm_array[2] + rpm_array[3] + rpm_array[4] + rpm_array[5]+ rpm_array[6])/ 7;
    }

  }
}

void fan_interrupt()
{
  time = (micros() - time_last);
  time_last = micros();
}


----------



## whydontu (Apr 19, 2022)

HELP!

Tachometer has a weird issue. The display randomly jumps up about 10 to 20% higher than actual RPM. I’ve confirmed the sensor is working properly. Compared sensor pulses to a crystal-based signal generator, tracked on a frequency counter, and using a couple of scopes. On the attached dual-trace scope photo, upper trace is the sensor, lower trace is the signal generator. A bit twitchy because the signals are off a bit in frequency

Also compared to my mechanical tach, which is never wrong.

The scope photo is the sensor output.

The mill is running at ~400 RPM. Tach reads 395 to 405, then jumps up to 485, then 550, and back to 395. The sensor pulse train is 107 Hz, equal to 400 RPM using a trigger wheel with 16 holes. (107 Hz / 16 pulses per revolution * 60 to RPM).

I suspect the method to time intervals is catching the Arduino timer resetting to zero in the middle of one of the interrupts, then returns to proper readings once the seven averaging counts even out. My coding skills aren’t up to the challenge. Any volunteers to help me fix this?


----------



## YYCHM (Apr 19, 2022)

@whydontu 









						Arduino Tutorial: Avoiding the Overflow Issue When Using millis() and micros() – Norwegian Creations
					






					www.norwegiancreations.com


----------



## Susquatch (Apr 19, 2022)

I'll stay away from debugging your code. It's not something I know much about..... yet..... That say will come soon enough and especially as it relates to interrupts and timers. 

However, I do note that the bottom trace on your scope on the very last photo shows what looks like a double trace. That may or may not be very important. 

Usually, when systems do what you describe, I look for noise, false triggering, and missing count resets. The double trace is very suspicious.


----------



## whydontu (Apr 19, 2022)

Susquatch said:


> I'll stay away from debugging your code. It's not something I know much about..... yet..... That say will come soon enough and especially as it relates to interrupts and timers.
> 
> However, I do note that the bottom trace on your scope on the very last photo shows what looks like a double trace. That may or may not be very important.
> 
> Usually, when systems do what you describe, I look for noise, false triggering, and missing count resets. The double trace is very suspicious.


The double trace is an artefact of the scope. It’s triggering off the rising edge of the upper yellow trace, but the two signals aren’t exactly the same frequency. So the lower trace is slowly walking out of sync, sort of like two musical pitches beating.


----------



## whydontu (Apr 19, 2022)

YYCHM said:


> @whydontu
> 
> 
> 
> ...


Thanks, that makes sense and seems to describe what I’m seeing. Off to write code!


----------



## Mr163 (Apr 28, 2022)

Rauce said:


> I’m interested in adding tachometers to some of my tools since I have variable speed drives on everything.
> 
> I have bought and tried the cheap Hall effect ones and not been overly impressed.
> 
> ...


The Tachulator is a Replica of Henry Arnolds MachTach kit, he had 2 versions a self solder kit and a fully assembled. I Purchased one of the last production runs before he stopped selling them. I used the hall effect sensor and reflective tape for signal pick up and it worked well. I assembled the kit and shoved it in a retro slime green angled hammond case i found.  I kept it and will be putting it on the new lathe when it arrives. I used the rpm quite often but did not use the sfm much. Mostly because my lathe at the time was belt driven and limited speed options. I think when i convert to a 3 phase vfd motor with variable speed than the sfm would be awesome, allowing me to match up to what the machinist handbook chart recommends.


----------



## Susquatch (Sep 19, 2022)

@whydontu - look what I found. Somebody who has direct access to the Arduino Interrupts and timers.... 

Arduino Interrupts








						The Inner Machinations Of The Arduino Are An Enigma
					

Arduinos have been the microcontroller platform of choice for nearly two decades now, essentially abstracting away a lot of the setup and lower-level functions of small microcontrollers in favor of…




					hackaday.com


----------



## whydontu (Sep 19, 2022)

Susquatch said:


> @whydontu - look what I found. Somebody who has direct access to the Arduino Interrupts and timers....
> 
> Arduino Interrupts
> 
> ...


That’s going to take some digesting. Fall project, maybe.


----------



## Susquatch (Sep 20, 2022)

whydontu said:


> That’s going to take some digesting. Fall project, maybe.



Yup, for me too! But the article just made my digesting sooooo much easier! This is exactly what I wanted to know how to do. Like you, I plan a dive deep this fall too - right after harvest and plowing is done! If the learning works out like I hope, it will break the Arduino speed door WIDE open for both of us! 

It's hard to believe that such a perfect article showed up in my google feed! Google isn't just listening, she is thinking! (I have very mixed emotions on that.....)


----------



## whydontu (Sep 20, 2022)

might need to go farther afield, since I’d like more than two interrupts so I can use rotary encoders for HMI devices. So I looked at this 









						ESP32 IoT Devkit ESP-WROOM-32 - 4MB - CP2101 USB UART
					

ESP32-WROOM IoT Wi-Fi and Bluetooth Development Module with CP2101 USB UART and 4MB external SPI Flash Memory. 80-240MHz clock speed.




					universal-solder.ca
				




32 interrupts, WiFi,  ble, bluetooth, lots of RAM, 33-bit, freeRTOS, and $13.

down another computer rabbit hole we go!


----------



## Susquatch (Sep 20, 2022)

whydontu said:


> might need to go farther afield, since I’d like more than two interrupts so I can use rotary encoders for HMI devices.



Not saying the ESP32 wouldn't do a better job.... 

But I think the article is just showing how to access the timers and Interrupts directly. I would think the rest of the hardware can be accessed the same way.


----------



## Susquatch (Sep 23, 2022)

whydontu said:


> might need to go farther afield, since I’d like more than two interrupts so I can use rotary encoders for HMI devices. So I looked at this
> 
> 
> 
> ...



Here is another option. It's much more expensive but adding WiFi and Bluetooth adds a crap load of capability. 









						ARDUINO UNO WiFi REV2
					

The Arduino UNO WiFi Rev.2 is the easiest point of entry to basic IoT with the standard form factor of the UNO family. Whether you are looking at building a sensor network connected to your office or home router, or if you want to create a Bluetooth® Low Energy device sending data to a...




					store-usa.arduino.cc
				




Note - that is US dollars. 

One of the things I'd like to do is to solve my access to the spindle problem to pickup rpm on my mill. I can do it if I take my mill head apart, but that will be a long ways from now and I'd like RPM sooner. I've been thinking about sensing motor or bull gear rpm and then multiplying that by the ratio to get rpm. An Arduino could do the calculation. Depending on where the physical rpm is measured, i might need a small bank of switches to tell the Arduino which pulleys are being used and whether or not the back gear is engaged. 

Anyway like you - other than simple research, all this has to wait till the snow flies.


----------



## PaulL (Sep 23, 2022)

Susquatch said:


> I would think the rest of the hardware can be accessed the same way.


Yes, the AVR microcontrollers are really easy that way.  The data sheets are pretty clear, and with built-in pull-up resistors they are really easy and forgiving to wire up.


----------



## Susquatch (Sep 23, 2022)

PaulL said:


> The data sheets are pretty clear, and with built-in pull-up resistors they are really easy and forgiving to wire up.



Thanks for that Paul! I had not realized that the pull-up resistors are already on board! Having one less thing to wire up is always a good thing.

If only they added analog output instead of pulse width.


----------



## PaulL (Sep 23, 2022)

Susquatch said:


> Thanks for that Paul! I had not realized that the pull-up resistors are already on board! Having one less thing to wire up is always a good thing.
> 
> If only they added analog output instead of pulse width.


As usual check your particular part, your mileage may vary, etc.
But you know that


----------

