Go Down

Topic: Optical Encoder (Read 70 times) previous topic - next topic

superrm11

Hi, I'm trying to read the rpm of an optical encoder connected to a an arduino uno. I've looked for solutions on google, but I cannot find any.
When we connect it directly to the analog ports, it prints out either 27 or 1015. I do not know how to convert this data. Any and all comments are greatly appreciated. Here's my cod so far:

Code: [Select]
void setup() {
  // put your setup code here, to run once:
  pinMode(A0, INPUT);
  pinMode (A1, INPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(analogRead(A1));
  delay(1);
}


I know by the way that the encoder works by reading the different states (on/off x 360), and that's probably what is being output, High and Low. I just don't know how to write the equation to get sensible data.

Nick_Pyner

o read the rpm of an optical encoder connected to a an arduino uno. I've looked for solutions on google, but I cannot find any.

You are probably googling the wrong thing. Try pulse counter interrupt arduino. There is a raft of stuff, all essentially the same.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy