hey folks have any of ya made a tachometer using a Arduino ? I tried some I found online but most of them seem to have something wrong with the code? I'm not smart enough in the Arduino world to decipher the code . What are you folks using ? I don't want to buy just a tachometer? from China . I need to get one working in the Arduino platform for part of a project I've got going .
thanks
animal
|
I have implemented several tachometers in software but haven't implemented an arduino tach. I have installed several of the $15-$20 tach (RC-41) modules which are very simple to install if you just need a quick RPM display. I've been using one on my lathe spindle for a few years. I recently added a feedback loop for the spindle VFD and noticed the module speed is off by maybe 10-20% under 100RPM but gets better at higher speeds.
Coding a tachometer can be a bit tricky if you require accuracy. It all depends on how many pulses you get per revolution and how fast it's spinning. One method is to count the period between tach pulses to calculate frequency/RPM. You use a timer interrupt that captures a high?resolution timer on the pulse. You need a little bit of logic to detect slow speeds which can wrap your timer. Usually you will low-pass filter these values to smooth out the RPM value. Some automotive tachometers/software use a multiple teeth system with?a missing tooth to provide multiple position and velocity estimates per revolution.
My lathe uses a 240 pulse per revolution disk (60 teeth with quadrature pulses) for threading. LinuxCNC supports missing tooth encoders so I could remove a tooth and get absolute positioning (within 1.5 degrees) The software provides an instantaneous RPM that I low pass filter before display so it doesn't jump around. The lathe also has the RC-41 display with a 1 pulse per rev sensor that I used to set the spindle RPM when I was using a potentiometer to control the VFD. Recently, I removed the pot and control the VFD with linuxCNC. This is when I noticed the RC-41 wasn't very accurate <100RPM.
toggle quoted message
Show quoted text
On Fri, Feb 9, 2024 at 1:57?PM mike allen < animal@...> wrote: hey folks have any of ya made a tachometer using a Arduino ? I tried
some I found online but most of them seem to have something wrong with
the code? I'm not smart enough in the Arduino world to decipher the code
. What are you folks using ? I don't want to buy just a tachometer? from
China . I need to get one working in the Arduino platform for part of a
project I've got going .
thanks
animal
|
I need some 4 pin encoder code for a 1000 line encoder.
Most of the code for RPM I have found online does not work.
I do have some Arduino code that "almost" works, but it is not accurate.
Ralph
toggle quoted message
Show quoted text
I have implemented several tachometers in software but haven't implemented an arduino tach. I have installed several of the $15-$20 tach (RC-41) modules which are very simple to install if you just need a quick RPM display. I've been using one on my lathe spindle for a few years. I recently added a feedback loop for the spindle VFD and noticed the module speed is off by maybe 10-20% under 100RPM but gets better at higher speeds.
Coding a tachometer can be a bit tricky if you require accuracy. It all depends on how many pulses you get per revolution and how fast it's spinning. One method is to count the period between tach pulses to calculate frequency/RPM. You use a timer interrupt that captures a high?resolution timer on the pulse. You need a little bit of logic to detect slow speeds which can wrap your timer. Usually you will low-pass filter these values to smooth out the RPM value. Some automotive tachometers/software use a multiple teeth system with?a missing tooth to provide multiple position and velocity estimates per revolution.
My lathe uses a 240 pulse per revolution disk (60 teeth with quadrature pulses) for threading. LinuxCNC supports missing tooth encoders so I could remove a tooth and get absolute positioning (within 1.5 degrees) The software provides an instantaneous RPM that I low pass filter before display so it doesn't jump around. The lathe also has the RC-41 display with a 1 pulse per rev sensor that I used to set the spindle RPM when I was using a potentiometer to control the VFD. Recently, I removed the pot and control the VFD with linuxCNC. This is when I noticed the RC-41 wasn't very accurate <100RPM.
On Fri, Feb 9, 2024 at 1:57?PM mike allen < animal@...> wrote: hey folks have any of ya made a tachometer using a Arduino ? I tried
some I found online but most of them seem to have something wrong with
the code? I'm not smart enough in the Arduino world to decipher the code
. What are you folks using ? I don't want to buy just a tachometer? from
China . I need to get one working in the Arduino platform for part of a
project I've got going .
thanks
animal
-- Clausing 8520, Craftsman 12x36 Lathe, 4x12 mini lathe, 14" Delta drill press, 40 watt laser, Consew brushless DC motors and a non working 3D printer
|
I have added an Arduino file Tach.ino? I hope this helps? This is used in my RELS. Also see the schematics for wiring in. Cheers -- John
|
Forgot to say, added in the Files section ref RELS data. See schematic for installing. Also you may need the Adafruit files loaded in the Arduino sketch. I have attached the ZIP?s Hope this helps
Cheers
John
toggle quoted message
Show quoted text
I have added an Arduino file Tach.ino? I hope this helps? This is used in my RELS. Also see the schematics for wiring in. Cheers -- John
-- John
|
Please see in the RELS files section.
John
toggle quoted message
Show quoted text
I have added an Arduino file Tach.ino? I hope this helps? This is used in my RELS. Also see the schematics for wiring in. Cheers -- John
-- John
|
You will need to use interrupts. One per phase. Looks like an Arduino lib already exists.
toggle quoted message
Show quoted text
I need some 4 pin encoder code for a 1000 line encoder.
Most of the code for RPM I have found online does not work.
I do have some Arduino code that "almost" works, but it is not accurate.
Ralph
I have implemented several tachometers in software but haven't implemented an arduino tach. I have installed several of the $15-$20 tach (RC-41) modules which are very simple to install if you just need a quick RPM display. I've been using one on my lathe spindle for a few years. I recently added a feedback loop for the spindle VFD and noticed the module speed is off by maybe 10-20% under 100RPM but gets better at higher speeds.
Coding a tachometer can be a bit tricky if you require accuracy. It all depends on how many pulses you get per revolution and how fast it's spinning. One method is to count the period between tach pulses to calculate frequency/RPM. You use a timer interrupt that captures a high?resolution timer on the pulse. You need a little bit of logic to detect slow speeds which can wrap your timer. Usually you will low-pass filter these values to smooth out the RPM value. Some automotive tachometers/software use a multiple teeth system with?a missing tooth to provide multiple position and velocity estimates per revolution.
My lathe uses a 240 pulse per revolution disk (60 teeth with quadrature pulses) for threading. LinuxCNC supports missing tooth encoders so I could remove a tooth and get absolute positioning (within 1.5 degrees) The software provides an instantaneous RPM that I low pass filter before display so it doesn't jump around. The lathe also has the RC-41 display with a 1 pulse per rev sensor that I used to set the spindle RPM when I was using a potentiometer to control the VFD. Recently, I removed the pot and control the VFD with linuxCNC. This is when I noticed the RC-41 wasn't very accurate <100RPM.
On Fri, Feb 9, 2024 at 1:57?PM mike allen < animal@...> wrote: hey folks have any of ya made a tachometer using a Arduino ? I tried
some I found online but most of them seem to have something wrong with
the code? I'm not smart enough in the Arduino world to decipher the code
. What are you folks using ? I don't want to buy just a tachometer? from
China . I need to get one working in the Arduino platform for part of a
project I've got going .
thanks
animal
-- Clausing 8520, Craftsman 12x36 Lathe, 4x12 mini lathe, 14" Delta drill press, 40 watt laser, Consew brushless DC motors and a non working 3D printer
|
Fwiw, it's fairly easy to set up Linuxcnc which lsupports encoders. I'm running encoders with 1um and 5um resolution using mesa fpga cards. My lathe encoder worked at threading rpm (120rpm) using the parallel port.
Let's you do lots of fun turning. Here's a kindling splitter I recently "threaded" using Linuxcnc.
toggle quoted message
Show quoted text
On Sat, Feb 10, 2024, 11:01?AM Jerry Trantow via <jerry.trantow= [email protected]> wrote: You will need to use interrupts. One per phase. Looks like an Arduino lib already exists.
I need some 4 pin encoder code for a 1000 line encoder.
Most of the code for RPM I have found online does not work.
I do have some Arduino code that "almost" works, but it is not accurate.
Ralph
I have implemented several tachometers in software but haven't implemented an arduino tach. I have installed several of the $15-$20 tach (RC-41) modules which are very simple to install if you just need a quick RPM display. I've been using one on my lathe spindle for a few years. I recently added a feedback loop for the spindle VFD and noticed the module speed is off by maybe 10-20% under 100RPM but gets better at higher speeds.
Coding a tachometer can be a bit tricky if you require accuracy. It all depends on how many pulses you get per revolution and how fast it's spinning. One method is to count the period between tach pulses to calculate frequency/RPM. You use a timer interrupt that captures a high?resolution timer on the pulse. You need a little bit of logic to detect slow speeds which can wrap your timer. Usually you will low-pass filter these values to smooth out the RPM value. Some automotive tachometers/software use a multiple teeth system with?a missing tooth to provide multiple position and velocity estimates per revolution.
My lathe uses a 240 pulse per revolution disk (60 teeth with quadrature pulses) for threading. LinuxCNC supports missing tooth encoders so I could remove a tooth and get absolute positioning (within 1.5 degrees) The software provides an instantaneous RPM that I low pass filter before display so it doesn't jump around. The lathe also has the RC-41 display with a 1 pulse per rev sensor that I used to set the spindle RPM when I was using a potentiometer to control the VFD. Recently, I removed the pot and control the VFD with linuxCNC. This is when I noticed the RC-41 wasn't very accurate <100RPM.
On Fri, Feb 9, 2024 at 1:57?PM mike allen < animal@...> wrote: hey folks have any of ya made a tachometer using a Arduino ? I tried
some I found online but most of them seem to have something wrong with
the code? I'm not smart enough in the Arduino world to decipher the code
. What are you folks using ? I don't want to buy just a tachometer? from
China . I need to get one working in the Arduino platform for part of a
project I've got going .
thanks
animal
-- Clausing 8520, Craftsman 12x36 Lathe, 4x12 mini lathe, 14" Delta drill press, 40 watt laser, Consew brushless DC motors and a non working 3D printer
|
Thanks John .
animal
On 2/9/24 9:08 PM, John Lindo wrote:
toggle quoted message
Show quoted text
Forgot
to say, added in the Files section ref RELS data.
See
schematic for installing.
Also
you may need the Adafruit files loaded in the Arduino sketch.
I
have attached the ZIP?s
Hope
this helps
Cheers
John
I
have added an Arduino file Tach.ino?
I hope this helps?
This is used in my RELS. Also see the schematics for wiring
in.
Cheers
--
John
--
John
|
Jerry was that meant for me & my Tach ? or aimed at Ralph's
encoder ?
thanks animal
On 2/10/24 9:00 AM, Jerry Trantow
wrote:
toggle quoted message
Show quoted text
You will need to use interrupts. One per phase.
Looks like an Arduino lib already exists.
I need some 4 pin encoder code for a 1000 line
encoder.
Most of the code for RPM I have found online does not
work.
I do have some Arduino code that "almost" works, but it
is not accurate.
Ralph
I have implemented several tachometers in
software but haven't implemented an arduino tach. I have
installed several of the $15-$20 tach (RC-41) modules
which are very simple to install if you just need a
quick RPM display. I've been using one on my lathe
spindle for a few years. I recently added a feedback
loop for the spindle VFD and noticed the module speed is
off by maybe 10-20% under 100RPM but gets better at
higher speeds.
Coding a tachometer can be a bit tricky if you
require accuracy. It all depends on how many pulses
you get per revolution and how fast it's spinning. One
method is to count the period between tach pulses to
calculate frequency/RPM. You use a timer interrupt
that captures a high?resolution timer on the pulse.
You need a little bit of logic to detect slow speeds
which can wrap your timer. Usually you will low-pass
filter these values to smooth out the RPM value. Some
automotive tachometers/software use a multiple teeth
system with?a missing tooth to provide multiple
position and velocity estimates per revolution.
My lathe uses a 240 pulse per revolution disk (60
teeth with quadrature pulses) for threading. LinuxCNC
supports missing tooth encoders so I could remove a
tooth and get absolute positioning (within 1.5
degrees) The software provides an instantaneous RPM
that I low pass filter before display so it doesn't
jump around.
The lathe also has the RC-41 display with a 1 pulse
per rev sensor that I used to set the spindle RPM when
I was using a potentiometer to control the VFD.
Recently, I removed the pot and control the VFD
with linuxCNC. This is when I noticed the RC-41 wasn't
very accurate <100RPM.
On Fri, Feb 9, 2024 at
1:57?PM mike allen < animal@...>
wrote:
hey
folks have any of ya made a tachometer using a Arduino
? I tried
some I found online but most of them seem to have
something wrong with
the code? I'm not smart enough in the Arduino world to
decipher the code
. What are you folks using ? I don't want to buy just
a tachometer? from
China . I need to get one working in the Arduino
platform for part of a
project I've got going .
thanks
animal
--
Clausing 8520, Craftsman 12x36 Lathe, 4x12 mini lathe, 14"
Delta drill press, 40 watt laser, Consew brushless DC motors
and a non working 3D printer
|
Hello, fellow machinists, I worked in the design input and implementation of rotary shaft encoders manufactured by my employer on and off for over 30 years. I haven't noticed anyone mentioning the incremental encoder limitations, which can cause serious issues and problems. When some of the commenters say that their code "almost works", it sounds like an encoder problem. First, and most often the issue, is the maximum encoder frequency, usually specified in kHz. This is the maximum rate at which the encoder can generate pulses. Exceed this frequency and the encoder may become unreliable and may drop pulses, resulting in inaccurate readings. Let's say you have a 1200 PPR (pulse per revolution, sometimes called "lines") encoder. Let's assume a maximum spindle speed of 2400 RPM, and that you are mechanically driving the encoder 1:3. I.E., one turn of the spindle causes 3 turns of the encoder. 1200 PPR X 2400 RPM / 60 seconds/minute X 3 = 144 kHz. Under these conditions, an encoder with less than a 144 kHz frequency response may function unreliably or not at all when its conditions are exceeded. If you had, for example, a 50 kHz encoder, in our example above, it would generate pulses reliably only up to 833 RPM. The first Chinese encoders I purchased for a machining project were only rated at 10 kHz, so I would encourage you to check your conditions and make sure that the encoder you purchase meets the need of your project. Second, encoders have a maximum rated mechanical speed, specified in RPM. Make sure that you take into account and gear/belt ratio impacts. In our example, the maximum spindle speed is 2400 RPM, but the encoder is turning 3x faster than the spindle. So, the encoder is turning 7200 RPM. The rule here is simply don't exceed the maximum rated encoder speed. The third issue is more subtle and often overlooked. The relatively delicate encoder spindle is supported by bearings. These bearings have maximum radial and axial load ratings. Exceeding these loads will decrease the life of the encoder, in some cases significantly. If you are driving the encoder axially directly from another shaft of similar size, just be sure to use an instrument-type flexible coupling and things should be fine. If driving with a timing belt, avoid putting any more tension on the belt than you have to. I hope this info may be useful to you. -- Regards, Charlie New Jersey, USA
NOTE: No trees were injured in the sending of this message,
but a large number of electrons were terribly inconvenienced.
|
Thanks Charlie , I actually got a lot of that , though my math
has been way underutilized for quit some time . Your statement
about the import encoders or even other parts like that can all
too often be a perfect example of $ 0.50 holding up $ 10.00 .
animal
On 2/10/24 6:40 PM, CLevinski wrote:
toggle quoted message
Show quoted text
Hello, fellow machinists,
I worked in the design input and implementation of rotary shaft
encoders manufactured by my employer on and off for over 30 years.
I haven't noticed anyone mentioning the incremental encoder
limitations, which can cause serious issues and problems. When
some of the commenters say that their code "almost works", it
sounds like an encoder problem.
First, and most often the issue, is the maximum encoder frequency,
usually specified in kHz. This is the maximum rate at which the
encoder can generate pulses. Exceed this frequency and the encoder
may become unreliable and may drop pulses, resulting in inaccurate
readings.
Let's say you have a 1200 PPR (pulse per revolution, sometimes
called "lines) encoder. Let's assume a maximum spindle speed of
2400 RPM, and that you are mechanically driving the encoder 1:3.
I.E., one turn of the spindle causes 3 turns of the encoder. 1200
PPR X 2400 RPM / 60 seconds/minute X 3 = 144 kHz. Under these
conditions, an encoder with less than a 144 kHz frequency response
may function unreliably or not at all when its conditions are
exceeded. If you had, for example, a 50 kHz encoder, in our
example above, it would generate pulses reliably only up to 833
RPM. The first Chinese encoders I purchased for a machining
project were only rated at 10 kHz, so I would encourage you to
check your conditions and make sure that the encoder you purchase
meets the need of your project.
Second, encoders have a maximum rated mechanical speed, specified
in RPM. Make sure that you take into account and gear/belt ratio
impacts. In our example, the maximum spindle speed is 2400 RPM,
but the encoder is turning 3x faster than the spindle. So, the
encoder is turning 7200 RPM. The rule here is simply don't exceed
the maximum rated encoder speed.
The third issue is more subtle and often overlooked. The
relatively delicate encoder spindle is supported by bearings.
These bearings have maximum radial and axial load ratings.
Exceeding these loads will decrease the life of the encoder, in
some cases significantly. If you are driving the encoder axially
directly from another shaft of similar size, just be sure to use
an instrument-type flexible coupling and things should be fine. If
driving with a timing belt, avoid putting any more tension on the
belt than you have to.
I hope this info may be useful to you.
--
Regards,
Charlie
New Jersey, USA
NOTE:
No trees were injured in the sending of this message,
but
a large number of electrons were terribly
inconvenienced.
|
Charlie Thanks for the explanation on the limits of the encoder. ?Perhaps you can help me further understand the capabilities of my encoder. The relevant specs are, 600 ppr, mechanical limit 5000 rpm and 20kHz. The 600 ppr is for 1 of 2 phases. ?My software has to deal with both the rise and fall of each pulse so a total of 2400 per rev.
When I consider the 20kHz do I consider the 600 ppr or the 2400 per rev. ?I suspect it’s the 600. ?If so that gives me 20000/600 rpsecond or 2000rpm vs the mechanical limit of 5000rpm. ?Are my assumptions and math correct?
thanks John
|
Hi, John, Happy to help. The encoder generates the two rising and falling channels regardless of whether you evaluate them as 600, 1200 or 2400 PPR. The spec then applies to the 600 PPR. Each channel has its own hardware so the two channels don't interfere with each other in terms of frequency. Each channel is capable of 20 kHz. 20,000 / 600 RPM / 60 min/sec = 2000 RPM, as you calculated correctly. This is well within the maximum mechanical speed of 5000 RPM, so you should be good. This all assumes that the encoder is being driven 1:1. If, for example, the encoder was making 2 turns for each turn of the spindle, the calculations would still be correct for the encoder, but the spindle speed would be limited to 1000 RPM. (2000 RPM at the encoder would be 1000 RPM at the spindle.) I hope this helps. -- Regards, Charlie New Jersey, USA
NOTE: No trees were injured in the sending of this message,
but a large number of electrons were terribly inconvenienced.
|
I love the kindling splitter! -- Regards, Charlie New Jersey, USA
NOTE: No trees were injured in the sending of this message,
but a large number of electrons were terribly inconvenienced.
|
On Fri, Feb 9, 2024 at 03:47 PM, Jerry Trantow wrote:
"You need a little bit of logic to detect slow speeds which can wrap your timer. Usually you will low-pass filter these values to smooth out the RPM value. Some automotive tachometers/software use a multiple teeth system with?a missing tooth to provide multiple position and velocity estimates per revolution."
?
Jerry, Nice explanation. With rotary incremental encoders, you can usually buy one with what is called an "index pulse". This is a pulse that occurs once during each revolution, and is output on a separate channel. As you say, this can be used to give you position for more than one revolution. The main disadvantages of this type of "semi-absolute" system are that it depends upon some form of battery or memory to hold the last position on power down, and it does not record any movement that may occur while the power is off. For example, you home your system before shutdown and the mill spindle is sitting at your 0,0,0 location. Then you make a small part to repair grandma's recliner manually. Upon power up, the location system "thinks" it is at home, but it is really wherever you left it after your manual operation. If this is critical, one would need to use an absolute encoder that provides accurate position regardless of whether it is moved while the power is off. ?-- Regards, Charlie New Jersey, USA
NOTE: No trees were injured in the sending of this message,
but a large number of electrons were terribly inconvenienced.
|