I am new to Arduino so please forgive me for any ill informed questions. I have a magnetic position encoder and the first step of my project is to read the rpm of the encoder as we rotate it. I am currently using a code to get a reading and i have attached it with the post, just want the rpms. Any help will be appreciated for a beginner like me :). Thank you in advance
hashaam2345:
I am new to Arduino so please forgive me for any ill informed questions. I have a magnetic position encoder and the first step of my project is to read the rpm of the encoder as we rotate it. I am currently using a code to get a reading and i have attached it with the post, just want the rpms. Any help will be appreciated for a beginner like me :). Thank you in advanceHow to connect optical rotary encoder with Arduino - Electric DIY Lab
In order to calculate RPM you need to tell us how many pulses per revolution the encoder has.
Do you need to know the direction of rotation or just revolutions per minute?
Blackfin:
In order to calculate RPM you need to tell us how many pulses per revolution the encoder has.Do you need to know the direction of rotation or just revolutions per minute?
Not sure what the pulses per revolution the encoder has. I am using this encoder: http://www.farnell.com/datasheets/2790755.pdf it has a 12 bit resolution.
and as of now I am trying to just get the revolutions per minute
Are you sure that sensor is intended for continuous rotation?
Blackfin:
Are you sure that sensor is intended for continuous rotation?
The link tells: continues
Blackfin:
Are you sure that sensor is intended for continuous rotation?
from discussing with my professor it seems like it is meant for continuous rotation. we need the encoder to sense the speed of a roller so we can relay that rpm to a motor
The link tells 400 per rev.
hashaam2345:
from discussing with my professor it seems like it is meant for continuous rotation. we need the encoder to sense the speed of a roller so we can relay that rpm to a motor
Why don't You read the link You posted? It tells a lot.
Railroader:
Why don't You read the link You posted? It tells a lot.
thank you for your input sir, im not to sure where it says that in the link. all I saw was resolution, not sure where it says pulses per revolution
Follow the link a little bit more slowly, penetrate every piece of information.
Are you sure this is the correct link. It is for an absolute positional encoder which is very poorly suited to sensing the speed of a roller.
Railroader:
The link tells 400 per rev.
The encoder used in the "link" is not the encoder OP is using. Read post #2; OP is using this one:
Blackfin:
The encoder used in the "link" is not the encoder OP is using. Read post #2; OP is using this one:
Oh... Good You found out. How?
I'll ask OP for his Visa number.....
This guy must be in the same class as the OP": Arduino UNO and Rotary Sensor Setup - Project Guidance - Arduino Forum
Paul
Comment was intended to be to cattledog but was directed wrongly.
Blackfin:
Are you sure this is the correct link. It is for an absolute positional encoder which is very poorly suited to sensing the speed of a roller.
Are You surprised? Get any sensor/encoder and then start the project. Not really unusual.
cattledog:
http://www.farnell.com/datasheets/2790755.pdfAre you sure this is the correct link. It is for an absolute positional encoder which is very poorly suited to sensing the speed of a roller.
the reason for choosing this sensor is because the roller will be moving at extremely low speeds, around 0.2 rpm, after consulting with a professor he said this would be the best option
Your professor really has a good point...
Railroader:
Your professor really has a good point...
so any answer to my original question?
Where is the code You didn't apply in Your original question?
Railroader:
Where is the code You didn't apply in Your original question?
int val = 0;
int val2 = 0;
int sensorMin = 110;
int sensorMax = 920;
int state = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(A0);
if(state == 0)
{
Serial.print(val);
Serial.println(" state 0");
if(val >= sensorMax){
state = 1;
}
}
if (state == 1)
{
val2 = (sensorMax - sensorMin) + val;
Serial.print(val2);
Serial.println(" state 1");
if(val2 < sensorMin){
state = 0;
}
}
delay(100);
}