Go Down

Topic: how to get the rpm and position of rotary encoder  (Read 379 times) previous topic - next topic

sharmela

Hi,

I am using rotary encoder of incremental type e40s6-1000-3-t-24. Here my problem is how to get the RPM of the rotary encoder.In the data sheet there is a formula like ((maximum allowable frequency of the divided / pulse per resolution.)*60).The PPR is 1000.How do i get the rpm and position through the program .I am attaching the the program here.can you plz tell me whatever the program written is correct or not. If i run this program some values are getting is that correct program.
int i=0;
int j=0;
int encoder0PinA = 6;
int encoder0PinB = 7;
void setup() {
  pinMode (encoder0PinA, INPUT);
  pinMode (encoder0PinB, INPUT);
  Serial.begin (9600);
}
void loop() {
 for(int j = 0;j<8;j++) {
 i += pulseIn(7, HIGH, 5000);
 Serial.println(i);
 }
 i = i >> 3;
 delay(2000);
 Serial.print((300*60)/i); //speed r/min (60*1000000/(45*6*2*i))
 Serial.println(" r/min");
 i = 0;
}

pylon

Your encoder has 3 output pins, why did you connect only 2 of them? And why are you using only one of them?

How did you ensure the 24V output of the rotary encoder doesn't destroy the Arduino's inputs? Post a wiring diagram!

How did you get to the formula? I would say you measure the time between two pulses in the variable i. If you multiply that by 1000 you get the time you need to make one complete turn. So divide 60 seconds (1 minute) by that value and you get the correct result, or simplified: 60000 / i.

sharmela

pin a ->6 of arduino
pin b->7 of arduino
pin c->9 of arduino
vcc->5v of arduino
gnd -> gnd of arduino
The formula i have got is from online.In various posts i have got that we can use only one pin for getting rpm of the motor.I dont know how to measure the pulse between the time .Plz help me in this.And also i need to find the angular position so i used only one pin.I dont know how to get this.

jremington


sharmela

Ya I have made the mistake . Now I have connected to 24v but still didn't working.Is that program what ever written is correct.can you plz tell me the formula to calculate the rpm

jremington

#5
Jun 16, 2019, 04:32 pm Last Edit: Jun 16, 2019, 04:32 pm by jremington
Quote
How did you ensure the 24V output of the rotary encoder doesn't destroy the Arduino's inputs?

Truedson


sharmela

I have not given 24v to Arduino pin.But I have given this 24v pin to other supply.one question is .Is that my program is correct

jremington

#8
Jun 17, 2019, 03:42 am Last Edit: Jun 17, 2019, 03:47 am by jremington
Quote
I have not given 24v to Arduino pin.
What is the voltage output by the A and B encoder terminals, when it is powered by 24V?

Please explain the numbers in this line of code:
Code: [Select]
Serial.print((300*60)/i); //speed r/min (60*1000000/(45*6*2*i))

sharmela

Rpm =(max.allowable frequcy*60)/PPR
PPR=1000 pulse per revolution.
max allowable frequency=300khz
The output voltage I didn't check..I will check and let you know

jremington

I don't think that conversion factor will give you the correct RPM.

The correct formula is (60 seconds/minute)*(1 rotation/1000 pulses)/(seconds/pulse)


Quote
The output voltage I didn't check
In spite of being warned by two forum members. Smart move!

sharmela

Means rpm is = (60*1000)/number of pulses per second.
I need to put this formula right
How to calculate the number of pulses per second in Arduino

jremington

#12
Jun 17, 2019, 04:53 pm Last Edit: Jun 17, 2019, 08:25 pm by jremington
Quote
Means rpm is = (60*1000)/number of pulses per second.
No. But the details would not matter, if you destroyed the Arduino by applying 24V to the input pins.

Go Up