Questions tagged [rotary-encoder]

An electro-mechanical device for detecting angular position and/or motion.

Filter by
Sorted by
Tagged with
15
votes
2answers
13k views

How precise can I get Arduino using rotary encoders?

Stepper motors are often pricey for a large motor. However, with a powerful, standard DC motor and a rotary encoder, you can "simulate" a stepper motor. How accurate are rotary encoders with Arduino ...
10
votes
1answer
2k views

How to design and debug a custom I2C master-slave system?

How to proceed, when in need of a custom I2C master-slave system? What are the design criteria to apply? What are the debugging tools one can use to troubleshoot problems?
4
votes
4answers
2k views

Rotary encoder on Uno and interrupts issue

This question is regarding a project using an Arduino Uno. I have one of these quadrature rotary encoders. I'm using a slightly modified version of the code from the article, Quadrature Encoder too ...
3
votes
2answers
6k views

How to detect the direction of a rotary encoder?

I'm trying to detect the direction of rotation for an incremental rotary encoder. I'm supposed to get +1 for clockwise and -1 for counter-clockwise. However, I receive random values. Any help ...
3
votes
1answer
2k views

Encoder + Bounce2 Library

I am working towards debouncing my keyes rotary encoder using the Bounce2 library found here ( https://github.com/thomasfredericks/Bounce2 ). I believe the problem lies in my code as there isn't much ...
3
votes
2answers
713 views

How to control cold to hot (blue to red gradient) RBG LED strip/bulb with a rotary encoder? [closed]

I'm doing a project for university and I am struggling to code and set up a rotary encoder that can control hot-cold variations. Much like the idea of communicating temperature selected by turning a ...
2
votes
4answers
9k views

How to read data from a rotary encoder with ATmega328

I'm using a home made "bare bones" Arduino, made with the ATmega328, and I need to read angle data from a geared DC drill motor, turning at speeds between 0 and 450 RPM. This is so I can use it as ...
2
votes
2answers
7k views

Reading from a KY-040 rotary encoder with Digispark

I have a rotary encoder KY-040 connected to a Digispark like this: CLK go to p0 and and DT go to p2, SW is disconnected for now (it's just a button). I did everything like the instructions here: ...
2
votes
1answer
4k views

Reading several rotary encoders

Have an upcoming project where user input will be based on spinning a large cog and I have several UNOs available Since rotary encoders need two pins, only a Mega would be able to handle the 7-8 ...
2
votes
1answer
348 views

Sampling rate issue

I have an Arduino code which runs decently. // Read in 10-bits Magnetic Encoder AEAT-6010-A06 into Arduino Uno // Sampling // Declarate const int CSn = 4; // Chip select const int CLK = 7; // ...
2
votes
1answer
1k views

Quadrature Encoder:Interrupts: Reset Count

I'm working on a quadrature encoder(with a 500ppr codewheel) with a Channel A, B and an Index pulse output. Using an Arduino Mega I'm counting the number of pulses on Channel A on the rising edge. ...
2
votes
2answers
3k views

Turning a DC motor a set number of Rotations using an encoder

I'm using an arduino UNO, and i want to turn a motor a set number of revolutions, i'm trying to read the clicks of the encoder which has a resolution of 360 clicks/ revolution, my logic is that i ...
2
votes
2answers
8k views

Arduino Mega 2560 interrupt pins and port mapping with rotary encoder

I am trying to use port manipulation in interrupts to read a rotary encoder. I found code for a Uno, so the port call for pins 2 and 3 are different. I think on the Mega they are PORTH3 and PORTH4 ...
2
votes
4answers
8k views

Using rotary encoders with pin change interrupts

I'm using an Arduino Uno and two (3-pin) rotary encoders for a project. Since the loop takes a bit long and accuracy is important, I'd like to use interrupts to read the values from the rotary ...
2
votes
1answer
781 views

Read/write data from 2 Arduinos simultaneously with Python

So for my project I have one Arduino Mega hooked up with a quadrature rotary encoder which is connected to the computer. An Arduino Uno is connected to a circuit I built, which in turn is connected to ...
1
vote
2answers
220 views

If statement behaves erratically

I connected the output from an encoder motor to int0. this is used to increment a counter at every pulse. in the loop(), I check this counter and stops the motor if it is above certain value. But this ...
1
vote
1answer
2k views

bitRead() gives wrong answer Arduino UNO R3

I am trying to read from a quadrature rotary encoder using an Arduino UNO R3. This is done by connecting the encoder's channel A pin to the Arduino interrupt 0 pin (digital IO pin 2). Inside the ...
1
vote
1answer
80 views

Unexplainable int behavior in encoder/LED project

I am trying to use a rotary encoder to cycle through the brightest versions of R, G & B. And it works! Red goes to blue just fine. Then G happens. For some reason, the int for green goes ...
1
vote
3answers
334 views

How do I read a sub-degree angle? [closed]

I need to measure (and record changes over a short time) the angle of a lever at a sub-degree resolution (The fulcrum can be the sensor) using an Arduino. I've looked at rotary encoders, but even ...
1
vote
1answer
1k views

Interfacing pc mouse (serial port DB-9)

So I`ve got that mouse with serial connector. It is named serial so it should be easier to connect than even a ps2 mouse, right? I can`t find any instruction on it. Or should I see instruction on ps2 ...
1
vote
2answers
306 views

How can I make a rotary encoder change between neopixel programs?

I am making a program to use a rotary encoder instead of a button in the buttoncycler example in the Adafruit NeoPixel library. I am using the US Digital S1-256-250-IE-B-D. Datasheet can be found ...
1
vote
2answers
3k views

Problem to convert rotary encoder output to angle

I'm using this incremental rotary encoder with a rotating disc. Here is my system: I will explain the system briefly and above is the illustration for that: The rotary encoder(blue) is attached/...
1
vote
1answer
240 views

Shaft Encoder Accuracy

So, first of all I just want to point out this code is from: Reading Rotary Encoders and is not mine. I have a magnetic shaft encoder mounted on a regular DC motor, my problem is that I cannot ...
1
vote
1answer
110 views

KY-040 rotary encoder skipping steps

Yesterday I asked a question about de-bouncing this rotary encoder and Jsotola suggested that I should use a method like This to detect the previous state and then do the counting. using that method ...
1
vote
1answer
95 views

Problem with encoder count on a segway handlebar

I'm trying to implement a steering mechanism for a segway project. The idea is to sense the tilt of the segway's handlebar with an incremental rotary encoder (omron e6j-cwz 600ppr). This way when I ...
1
vote
1answer
361 views

Problem in reading data from encoder with arduino

Hello guys I am trying to count the number of the steps of a stepper motor with an encoder (Avago heds). I found an Arduino sketch to count that steps and display them on the console and I found ...
1
vote
1answer
4k views

Rotary encoder I2C LCD menu

I am trying to make a menu for a monitoring/control system. I am not sure how to make this without interrupting my current code which needs to be monitoring my system at all times to shut off if it ...
1
vote
3answers
541 views

Absolute encoder vs Accelerometer for calculating angles

I've been toying with this idea for a while and after some thorough research I'm more than happy that the project is realistic. However I'm in need of some direction in terms of the sensors I should ...
1
vote
2answers
1k views

Reading quadrature encoder

I am using an encoder motor for one of my projects and i was reading encoder values manually through Arduino. It was working fine when i turned it slowly, but whenever i would rotate it at some higher ...
1
vote
1answer
2k views

Is it possible to use two encoders with Arduino Uno?

I would like to control 2 motors with the Arduino Uno board, which provides only two interrupt pins on digital 2 and 3. I've set one encoder using these pins, and it works. What do you think about ...
1
vote
0answers
158 views

read with Arduino SSI encoder signal

I'm stuck in my project, I try to read an absolute encoders angular position with my Arduino. I used and cabled a differential line receiver and driver between Arduino and the encoder, like explained ...
1
vote
0answers
32 views

How can I get the count of pulses of two encoders on the serial monitor?

I have two encoders; I connected them to pin 2 and 3 and I want to count the pulses of them to make two DC motors to work until it reaches a specified number of pulses, than stop working. I have ...
1
vote
1answer
980 views

Weird behaviour of rotary encoder values

The plan is to control a NEMA 17 stepper motor with an endless rotary encoder. First, I found a code to read the rotary encoders data on www.HowToMechatronics.com by Dejan Nedelkovski. It basically ...
1
vote
0answers
346 views

Rotary Encoder on LoLin NodeMcu increases value when rotating right/left

I have a test program running on my LoLin NodeMcu board, with a Rotary Encoder connected. I use Task.h and RotaryEncoderTask.h from this library: https://github.com/Makuna/Task (though my issue is ...
1
vote
0answers
72 views

Program does not seem to be passing from setup to loop, or printing to SD card

I am trying to write code to test servo motors using an encoder. I create a file in the setup part, and then set 1500 microseconds to 0 for the encoder. However, if I try to print something to the SD ...
0
votes
3answers
352 views

Will a simple RC filter work with my mechanical rotary encoder, or do I need a Schmitt trigger?

I bought some incremental rotary encoders online https://www.bourns.com/docs/Product-Datasheets/PEC12R.pdf The spec sheet for those suggests a filter circuit for the outputs of the encoder that ...
0
votes
2answers
84 views

How to sample incoming 600khz pin and divide it by 4 and generate low frequency signal at output pin of arduino

I am trying to divide a incoming high frequency signal 600kHz by 4 and output wave at arduino MEGA2560 digital pin. The input to arduino comes from incremental Encoder which is connected to motor ...
0
votes
1answer
47 views

Forward kinematics of a differential drive robot

I've been braking my head over this for the past few days and can't make it work.. So, I have a small robot with a rotary encoder on each wheel and i want to track its position (in x and y) on a flat ...
0
votes
1answer
100 views

Rotary encoder using interrupt

This is my first time working with a rotary encoder and interrupts. I am using a Pro Micro which has interrupt pins at pin0 and pin1. The code below works as expected. My question: do I need to use ...
0
votes
1answer
23 views

How to add numbers to a position when controlling a seven-segment display

I'm recently having a hard time with my Arduino project. I'm trying to control a seven-segment display (it has a microcontroller on it) with an encoder, and I'm trying so that everytime I rotate the ...
0
votes
1answer
69 views

Optical Rotary Encoder Index issue [closed]

I have the following code working correctly except for the Index portion. I am not sure if I have the syntax correct for the hardware. The end result I am looking for is to have the encoder reset to ...
0
votes
1answer
2k views

Interfacing with an SSI sensor?

I'm trying to interface with version RM08S of this rotary encoder using an Arduino Mega. The sensor supports a "Synchro serial interface (SSI), single ended" interface. I'm unfamiliar with this ...
0
votes
1answer
156 views

Arduino Rotary Encoder Pulses?

I made an program so if I turn on my rotary encoder the position and the rotation comes on a LCD screen. But I need to change it a bit up for my teacher, she wants to see the graph of the pulses on ...
0
votes
2answers
3k views

How to control a DC Motor with absolute encoder using Arduino and Motor Driver?

I am a beginner in Arduino, I have only basic knowledge and a big appetite :) I'm working on my cable-cam project. I've made all the mechanical parts by myself, bought all electricity parts through ...
0
votes
1answer
595 views

Why is my code only reading the change of the encoder's pin A?

I am writing code for reading in a quadrature encoder. I used attachInterrupt on pin 2 and 3, but by using the same ISR. int encAPin= 2; int encBPin= 3; volatile int encAValue= 0; ...
0
votes
2answers
48 views

Will an Arduino Uno be able to read 3x incremental encoders?

Encoders are quadrature 600ppr encoders with X2 counting. Therefore 1200 counts per revolution for each encoder. Is there an edge rate limit? I currently have one encoder hooked up using code with ...
0
votes
1answer
86 views

real-time reading of a quadrature encoder at full resolution with only one interrupt on ATmega328

I want to read a quadrature rotary encoders at full resolution with only one interrupt on Arduino Nano (ATmega328). So I found out that we can use XOR to reach a full resolution: Where pin 3 ...
0
votes
2answers
23 views

Encoder coupled with motor shaft.Encoder is giving larger redings than expected

I am a rookie and i dont have much experience on arduino. please help me. I intend to build a robot that will drive on a straight path even on nonuniform surfaces like the ones we see in agricultural ...
0
votes
2answers
63 views

Can't you easily use “quadrature” incremental rotary encoders at 2X or 4X their number of “stops”?

I bought a 12-step "quadrature" incremental rotary encoder as an input device for a project I'm working on. When I wrote the code to track "ticks" of rotation, I made it respond to any change in the ...
0
votes
1answer
84 views

Calculation error with Optical Encoder

I have corrected my code for reading the optical encoder index but I am now getting a different calculation error. At the index the encoder reset's to zero but now my readouts are as follows: Index ...