![]() |
EP4 Encoder and Arduino
Hello there!;) , I'm having a little problems programming this encoder with arduino, i'm doing it manually (without a library) but it is not the best way to get the data.
I want to know if anyone of you have used it with Arduino or if you know how to get accurate data from the device, i need to obtain speed from a shaft. Your help is welcome ! Thanks!! Best regards from Chile! |
Re: EP4 Encoder and Arduino
Quote:
a) are you trying to measure speed or position? b) do you care about direction? c) how fast will you be spinning the encoder, and d) what's the CPR of the encoder? |
Re: EP4 Encoder and Arduino
Arduino Playground has some pretty well developed pages with code.
Need to start with Ether's questions, how many pulse/rev and what RPM rate you are looking to sense. Looks like many of the solutions use interrupts, which may be limited on the Arduino, so you may have significant limitations on rate it can process. http://playground.arduino.cc/Main/RotaryEncoders |
Re: EP4 Encoder and Arduino
Quote:
Using one channel of the encoder attached to one of the external interrupts and the other to a digital input. Use the interrupt service routine to determine the direction. Each tick of the encoder will also represent a distance of travel or amount of rotation of a shaft. With those values known, you can calculate RPM and/or distance. As mentioned by tr6scott, the Arduino may be somewhat limited on the maximum rate it can manage, so keep that in mind. How fast your Arduino can process interrupts will be directly related to how tightly you code your ISR. Here is a piece of code I used to control the motor's rate. The motor directly drove the encoder. I use the Servo library to drive the motor because the signal generated is the same as the speed controller uses. Code:
/********************************************************** |
| All times are GMT -5. The time now is 02:09. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi