Page 1 of 2
Tacho!
Posted: Wed Jul 31, 2024 10:13 am
by jgu1
Hi all!
I am trying to make a tachometer. one pulse per revolution.
I manage to get it work. I am using pin Interrrupt to count the puls, and at timer interrupt to reset the counter. I have to multiply with 60 to get the readout pr/min. But of course then I get the step in 60
Is there a better, correct way to make a tachometer or the calculation on. maybe using some of the timecounter or?
Help will be very grateful without to many C progamming instruction

, please
Thank´s in advance
Br Jorgen
Re: Tacho!
Posted: Wed Jul 31, 2024 3:56 pm
by medelec35
Hi Jorgen.
What about using the timer component to time how long it takes from one pulse to the next, then calculate RPM from the time duration?
The other way is to start a timer, count pulses for say 10 seconds then x 6?
Re: Tacho!
Posted: Wed Jul 31, 2024 6:24 pm
by jgu1
Hi Martin!
Thank you!
"What about using the timer component to time how long it takes from one pulse to the next, then calculate RPM from the time duration?!
I've thought about it Martin, but I can't really figure out how to do it, maybe you could give an example?
"The other way is to start a timer, count pulses for say 10 seconds then x 6?" Yes, but then it will take 10 second before readout.
Jorgen
Re: Tacho!
Posted: Wed Jul 31, 2024 8:45 pm
by jgu1
Now I found the rigth timer component and I see your idea, I try to make a new program using the timercomponent. Do you recommend to use pin Interrupt and measure the time in the macro for interrupt?
Hope you will help if I get "stock"
You hear
Jorgen
Re: Tacho!
Posted: Thu Aug 01, 2024 7:57 am
by jgu1
Hi again!
I try to create a tacho with the timercomponent. The timer work fine. I am measuring the ON time of the puls, so that mean the longer the puls is (the higher the rpm is) the counter count longer for longer time, the measured time should be inverted.
50hZ = Rpm 3000 Wondering is it because I use a frequency generator?
How is the calculation for the rpm?
Please Martin, what am I doing wrong
Thank´s in advance
Jorgen
Re: Tacho!
Posted: Thu Aug 01, 2024 4:16 pm
by medelec35
Hi Jorgen.
There are 60000 ms to 1 minute
Therefore, I believe RPM = 60000/time(ms) for 1 revolution.
That is assuming there is only 1 magnet triggering the hall sensor.
Re: Tacho!
Posted: Fri Aug 02, 2024 8:35 am
by jgu1
Hi again!
Again many thank´s. it work with your calculation Martin, but now the step in Rpm is 157
If you are busy, don´t spend more time on this, then I have to use my own examble it has only step in 60.
Br Jorgen
Re: Tacho!
Posted: Sat Aug 03, 2024 10:23 am
by chipfryer27
Hi Jorgen
How are you actually detecting when a revolution starts and ends? Are you using optical or magnetic sensors? From your chart you count at the start of a revolution stopping once complete with your sensor "high" for the duration. Interested to know your methodolology.
When simulating, looking at your timer component it seems to be totalling pulses. In my test my first pulse (pushing and holding button) was 300mS in length which gives a result of 200 RPM. All good. My next pulse was 150mS in length which gave a RPM of 133 (incorrect) as this 150 was being added to the existing 300mS giving a total of 450mS. A 450mS pulse would equate to a RPM of 133.
Maybe I am missing something?
Regards
Re: Tacho!
Posted: Sat Aug 03, 2024 9:02 pm
by jgu1
Hi Chipfreyer!
Thank´s for your interest
First, in the beginnig I use my Signal generator, I know 50hZ * 60 = Rpm 3000, I also test with a optocoubler.
In my experiment my intention is that as long as input = 0 do nothing. When the input is high, start the millisecond counter and stop counter again when the input = 0. So measure the time while the puls is high. The value from the timer counter use this including Martin´s advice calculation RPM = 60000/counttime. Reset the display and write the new value.
It work, but changing 1 - 2 hz the, Rpm step with 157. And I think it is the calculation.
Hope it make sense

**and any help or advice is very welcome.**
Edit. Just test again and now it has a strange behavior.
Glad if you can help
Br Jorgen
Re: Tacho!
Posted: Sun Aug 04, 2024 8:52 am
by jgu1
Hi again -chipfreyer!
Hereby the first attemp I mad. Here I using intterupt and it work perfekt apart from the step in Rpm is with 60. The calulation I use, multply with 60 så the step can go lower, maybe to 1.
Do you have any way to make calculation on, please.
Br Jorgen