Measuring tangential velocity with encoder

Hello everyone,

I am looking for some clever minds, able to help me out with a (possibly simple) code for reading the velocity of a rotating disc with an incremental encoder and an Arduino Uno.

The projected is a part of a PhD project at Technical University of Denmark. However, I must say that I have very limited experience using Arduino and general limited programming experience, therefore I hope someone are able to help me.

I have a rotating disc with a diameter of 100 mm (radius 50 mm) and I need to measure the tangential velocity of the rotating disc. I am using this incremental encoder with 500 pulses per revolution (https://dk.rs-online.com/web/p/drejeencodere/9189082/) with a 1:1 exchange to the rotating disc. Hence, one revolution of the disc corresponds to one revolution (or 500 pulses) for the encoder.

The tangential velocity is calculated like this: Vr = r * ω

Tangential velocity (Vr), radius (r) and angular velocity (ω) (rad/s).

So basically the code should be able to print out tangential velocity in the serial monitor.
Are anyone able to help me out?

Best regards
Lasse Jakobsen

have a look at this code here,IMHO,

in the code to get Vr, IMHO you would need to replace

 rpm = 60*1000/(millis() - passedtime)*counter;

with

 rpm = (1000/(millis() - passedtime))*((2*PI*counter)/500)*r;

where PI = 3.14159 and r is the radius.

Hope that helps...

Udgangssignal type RS422

Do you have the RS422 adapter and code to communicate pulse rate to Arduino? Which Arduino?

lasjak:
Hello everyone,

I am looking for some clever minds, able to help me out with a (possibly simple) code for reading the velocity of a rotating disc with an incremental encoder and an Arduino Uno.

The projected is a part of a PhD project at Technical University of Denmark. However, I must say that I have very limited experience using Arduino and general limited programming experience, therefore I hope someone are able to help me.

I have a rotating disc with a diameter of 100 mm (radius 50 mm) and I need to measure the tangential velocity of the rotating disc. I am using this incremental encoder with 500 pulses per revolution (https://dk.rs-online.com/web/p/drejeencodere/9189082/) with a 1:1 exchange to the rotating disc. Hence, one revolution of the disc corresponds to one revolution (or 500 pulses) for the encoder.

The tangential velocity is calculated like this: Vr = r * ω

Tangential velocity (Vr), radius (r) and angular velocity (ω) (rad/s).

So basically the code should be able to print out tangential velocity in the serial monitor.
Are anyone able to help me out?

Best regards
Lasse Jakobsen

Welcome to the Arduino world. Your requirement, as stated, was to "measure" the tangential speed at the edge of your disk. You are working at "computing" the speed based on a shaft RPM. I am sure you know the difference and which is your project needs?

Paul

If you know the RPS (revs per second) then the speed at the circumference of the disk (in mm/sec) will be

rps * circumferenceInMillimetres

...R

depending on the rpm the code linked above can have a quite relevant error.

The code linked above does increment a counter whenever a pulse triggers the interrupt.
After one second the code is looking at the counter. If the speed is low ==> only a few pulses are created
looking at the counter once every second will result in a deviation of the measured value compared to reality.
If the second is over just on millisecond bevor the next pulse occurs the measured rpm will be too low.

As a Ph.D. you should analyse what your slowest rpms are and what error this good give.
With an encoder with 500 pulses per revolution the error will be quite small but it should be calculated to work really scientific.

Do need to know the rotation-direction?
If yes the code posted above is not sufficient. This code just measures rpm with a single hall-sensor.
The code can be used 1:1 with your ecoder if you have an interface-converter from RS422 to TTL (0V/5V.)

What will be the maximum-speed of the disc? The sensors datasheet says maximum output-frequency is 250 kHz
this means 250.000 / 500 = 500 rps = 30.000 rpm. - Yeah - I guess that's enough. (just calculated to be real scientific :))

a more precise measuring is to let an ISR count up with an initial snapshot of microseconds and set a flag when calculating shall be done
count one additional pulse and do a second snapshot of microseconds to have the exact time how long it took to count up this number of pulses.

Instead of doing the calculation at a constant time.
Imagine a speed as slow as only every 3 seconds one pulse occurs.
measuring once every second would result in
1 second speed 0 (because 0 pulses occured)
2 second speed 0 (because 0 pulses occured)
3 second speed 3 times too high (because 1 pulses occured and rpm is calculated based on one second)
Real rps is 1/3 rps not 1 rps.

Though in a high number of pulses the error will be small.
(again for your scientific work the analysis how big the error will be for different rpms should be done)

What's the main goal of this project? No idea what it is.
Is your subject pure materal-engineering where programming is just a needed part but does not belong to the work you get the exam note for? Or is programming a part of it?

best regards Stefan