Hi i am trying to read an encoder like the ones using in mouses it is from TTC and it also says 55 on it. I am having trouble with the code and my devkit v1 doesnt appear in device manager so i am using an arduino uno for now. I am a complete begginer and i don t even know where to start
Welcome to the forum
Do you know what the pinout of the encoder is ?
thanks! not really i could only find this site Conventional encoder-103 series-Huizhou Zhengpai Science and Technology Co., Ltd
where it is listed as
"Conventional encoder(through axle) 8mm 20-32gf.cm 24 dot 12 waveform 1.74±0.02mm A\B two phases 1030901112000"
(the 16th one)
(i am pretty sure, not 100% tho)
You will make no progress until you have established the pinout
Can you buzz out the pins and discover which ones are shorted to one another and under what circumstances
what do you mean by buzz out the pins?
i am trying to figure out the pinout right now
Using a multimeter in continuity mode
Based on this: http://en.ttc9.com/productdetails/45.html
I’d make the guess that
Pin 1 = GND
Pin 2 = Channel A
Pin 3 = Channel B
If you have a multimeter, you can test this out by slowly turning the encoder. It should have 24 detent locations per revolution and you can see which pins are shorted at each location.
You could also connect it up to your board - don’t know what a devkit v1 is - and make the the encoder pins INPUT_PULLUP and then detect and report when the pins go HIGH/LOW.
You can try this library
i managed to fix it, it is an esp32 running at 240mhz
can you help me with writing the code?
also where did you find the information about the 24 rotations?
somehting like a datasheet would be really useful!
i cant figure out how it works
Have you installed the library ?
If so, then where are you stuck ?
Have you installed it or just downloaded it ?
i installed it from arduino ide, my bad
also have a look at ESP32Encoder
also RotaryEncoderPCNT
example code
// ESP32 RotaryEncoderPCNT
// https://github.com/vickash/RotaryEncoderPCNT/tree/main
// NOTE: uses GPIO12 - boot fails if pulled high, strapping pin
#include <RotaryEncoderPCNT.h>
// Constructor args are: pinA/Clock, pinB/Data, start position, glitch filter time in ns.
// Start position and filter time are optional. Defaults are 0 and 1000ns respectively.
//
// RotaryEncoderPCNT encoder(25, 12, 0, 1000);
// RotaryEncoderPCNT encoder(25, 12, 0);
//RotaryEncoderPCNT encoder(25, 12);
//RotaryEncoderPCNT encoder(16, 17); // ESP32 & ESP32S3
RotaryEncoderPCNT encoder(8, 9); // ESP32 & ESP32S3
int old_position;
int position;
void setup() {
Serial.begin(115200);
// Change position after initialization.
// encoder.setPosition(128);
// Show initial position.
old_position = encoder.position();
Serial.println(old_position);
}
void loop() {
// Show position when it changes.
position = encoder.position();
if(position != old_position){
Serial.println(position);
old_position = position;
}
delay(5);
}
results using a QEI encoder
1
-2
-4
-5
-6
-7
-8
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
15
14
12
11
10
9
8
7
6
5
4
3
2
1
0
-1
-2
-3
-4
-5
-6
-8
-9
-10
--------------------------------------------------------------------
ESP32S3
0
1
2
4
5
6
8
9
10
12
11
10
8
7
6
4
3
2
1
0
-1
-2
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-16
-17
-18
-19
-20
-19
-18
-17
-16
-15
-14
-13
-12
i think i saw someone on the other one complaining that it only works with up to 2 encoders? and on this one it says it works with up to 8?
i am planning to use 5 so the first won't work and this one will?
i dont know what these libraries add?
Are you trying to test one of the examples that came with the library ?
i am trying to read my encoder and confirm the pins
never used more than two QEI encoder in a project
it says up to eight so I guess you will have to experiment
