Measuring the rpm and the Band-speed at a Band-saw

Use this section to discuss your embedded Flowcode projects.
Post Reply
AndreasR
Posts: 13
http://meble-kuchenne.info.pl
Joined: Tue Feb 09, 2021 5:16 pm
Been thanked: 2 times

Measuring the rpm and the Band-speed at a Band-saw

Post by AndreasR »

This project makes me insane :x

Measuring the rpm of a rotating wheel seems not very difficult but i'm too stupid to do this.

The facts:

Using
pic 16F887
LCD 16x2 characters
an inductive sensor
and a bit of peripherie

i tried more than 5 ways to get a stable output of the rpm of the guide roller but nothing works
i connected the inductive sensor at INT0 Pin (Pin 33)
made an ISR to count the pulses of the sensor while the guide roller turns
okay this seems to work
got the TMR0 at 3276800Hz CPU clock pulse
At a prescaler rate of 1:2 i get an interrupt frequency of 1600Hz so this will give me ticks of 625µsec
so i get 1600 ticks for one second
at the ISR routine i only decrement a counter
at the main routine i wait for 4 turns of the guide roller to stable the output
if the guide roller counts are > than 4 i calculate the rpm
rpm = (1600 ticks * 60sec) / count_of_guide_roller_turns
all this seems to work

but
when i modify the rpm the output at the diaplay shows nonsense
when the speed of the guide roller is low (5-10 turns per second) most time it works but not every time
when i take a higher speed ( >50 turns) the display will show the rpm at 30000 or more
when i step down the speed the display shows no reaction until i reset the pic.

next problem is that the refresh rate of the display is to high
at higher speeds i'm unable to read any number.

Please take my hand and help me to cut this node befor it drives me mad
Attachments
Version-3-Bandgeschwindigkeit.fcfx
(20.15 KiB) Downloaded 176 times

medelec35
Matrix Staff
Posts: 1430
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 505 times
Been thanked: 468 times

Re: Measuring the rpm and the Band-speed at a Band-saw

Post by medelec35 »

Hi, AndreasR.
Some observations.
While the interrupt is being used, it uses up the time that would normally be used for the normal running of the main code.
For example display routines and calculations.
The higher the Oscillator frequency, the better chance the main code will work.
3.2768 MHz is really low compared to what frequency the microcontroller can run at.
The only advantage of running at a low frequency is when using battery power only to save power consumption.
However, there is a performance reduction as you are experiencing.
I have a few suggestions.
1. Run the microcontroller at the fastest speed you can.
2. Use timer 2 to get more accurate timings.
I created a spreadsheet calculator for that purpose.
I need to update the site with the lost images due to a forum update. :lol:
3. Time for a second using a timer interrupt, e.g timer 2 using the spreadsheet. Disable pin interrupt. update RPM calculations ie. RPM = pin interrupts * 60. Display the results. Re-enable the pin interrupt. Then the display won't be affected by fast RPM speeds.
Martin

AndreasR
Posts: 13
Joined: Tue Feb 09, 2021 5:16 pm
Been thanked: 2 times

Re: Measuring the rpm and the Band-speed at a Band-saw

Post by AndreasR »

Hi Martin,
let me think over :roll:
The speed of a band-saw is about 800m / min as upper limit.
2040mm length of the band and a diameter of round about 350mm for the roller guides gives roundabout 800 U / min for the roller guide.
This will be ~13Hz from the inductive sensor.
Not so much.
The lower limit is about 30 m / min -> 250mHz of the sensor.
So i thought it is a better idea not to measure the frequency of the sensor pulses but measure the periode.
In my program i try to measure the periode of 4 Pulses (4 rotations of the roller guide).

Are you sure that i have to increase the cpu clock?

The system is running at 24V DC downregulated to 5V so energy is not the problem.

Tomorrow at holy sunday i will test your idea to use timer 2
and please hurry up to update the spreadsheet pix :-) ;)

at last thx very much for your ideas and stand by me to prevent my relocation to an insane asylum,
Andreas

medelec35
Matrix Staff
Posts: 1430
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 505 times
Been thanked: 468 times

Re: Measuring the rpm and the Band-speed at a Band-saw

Post by medelec35 »

Hi, Andreas.
AndreasR wrote:
Sat Jul 24, 2021 4:58 pm
Are you sure that i have to increase the cpu clock?
Only if the higher speed RPM affects the performance.
AndreasR wrote:
Sat Jul 24, 2021 4:58 pm
So i thought it is a better idea not to measure the frequency of the sensor pulses but measure the periode.
In my program i try to measure the periode of 4 Pulses (4 rotations of the roller guide).
Nothing wrong with the period measuring option.
Of course, you can use either method,
I just wanted to give you alternative solutions.
It's nice there is more than one way to achieve the same objective.
Have a try with both methods to see which suit you better.
Martin

Post Reply