As per my Logic Level Shifter for reading motor encoders post, I am using an Arduino Nano 33 IoT to drive a Pololu 30:1 Metal Gearmotor and read the encoder signals. The Arduino runs on 3.3V, but the minimum voltage to power the encoder is 3.5V, so I am using the 5V pin from the Arduino to power the encoder. I then need to convert the 5V encoder signal to 3.3V for the Arduino.
I used the level shifter ok, but I get variations in the encoder readings with a constant PWM signal. For example, with a PWM duty cycle of 7.8%, I get readings of 1623, 1618, 1604, 1580, 1579, 1590, and 1600 counts per second.
I use interrupts in the Arduino to read the encoder signals. I don’t have an oscilloscope to check, but I wondered if there might be some additional transients on the signals due to the level shifter, and this is responsible for the variance I’m seeing.
I figured I’d try switching to using a voltage divider as Patrick suggested in the other post. I tried a voltage divider with 1K and 2K resistors, but no signals were detected in the Arduino. I checked the voltages with a multimeter, and the voltage out of the encoder is around ~1V rather than ~5V. Is this low voltage due to the resistors I have chosen? If so, what would appropriate resistor values be?
Also, is it possible that the level shifter is the cause of the variance in encoder readings, or is this level of variance expected?