Hi all, this is my first post. I am complete beginner in electronics, and have a problem in an old HOA902-11 optical encoder.
The datasheet can be found in attachment which I found in google.
This encoder is a part disassembled from a broken computerized telescope mount. I would like to reuse it. It is fixed on a motor, and an encoder wheel will pass through the encoder. As far as I understand from the datasheet, the encoder cosists of an IR LED (2pins for 1.5V max supply) and an IR sensor (which gives pulse signal when the wheel pass through, and another pin output direction). There are another 2pins for 5V and GND. I connected the encoder to raspberry pi as following:

The HOA902-11 encoder is located at the lower right under the motor.
The 4 pins for power supply are straight forward connection, except I added a 1k ohm resistor between the LED anode and raspberry pi 3.3V pin, and the cathode to rpi GND. The purple wire is connected between rpi pin 21 and the encoder direction or speed pulse output.
The following code is used for testing:
However, when I rotate the wheel by hand, the above test code gives no output, no matter if the encoder "direction" or "speed" pin connected to pin21.
Interestingly, if I use a TV IR remote to shine the encoder in certain angle, the code above will give output (about 100 signals per second), so I think the sensor is working. For the LED, I checked it with a voltmeter. There is 1.06V between the anode and cathode (which I don't know if it is normal or not).
Could you please advice which part in my setup is wrong? Thanks in advance!
The datasheet can be found in attachment which I found in google.
This encoder is a part disassembled from a broken computerized telescope mount. I would like to reuse it. It is fixed on a motor, and an encoder wheel will pass through the encoder. As far as I understand from the datasheet, the encoder cosists of an IR LED (2pins for 1.5V max supply) and an IR sensor (which gives pulse signal when the wheel pass through, and another pin output direction). There are another 2pins for 5V and GND. I connected the encoder to raspberry pi as following:

The HOA902-11 encoder is located at the lower right under the motor.
The 4 pins for power supply are straight forward connection, except I added a 1k ohm resistor between the LED anode and raspberry pi 3.3V pin, and the cathode to rpi GND. The purple wire is connected between rpi pin 21 and the encoder direction or speed pulse output.
The following code is used for testing:
Python:
import RPi.GPIO as GPIO
BUTTON_GPIO = 21
GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON_GPIO, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
counter = 0
while True:
GPIO.wait_for_edge(BUTTON_GPIO, GPIO.FALLING)
counter += 1
print("Button pressed!", counter)
Interestingly, if I use a TV IR remote to shine the encoder in certain angle, the code above will give output (about 100 signals per second), so I think the sensor is working. For the LED, I checked it with a voltmeter. There is 1.06V between the anode and cathode (which I don't know if it is normal or not).
Could you please advice which part in my setup is wrong? Thanks in advance!
Attachments
-
50.1 KB Views: 5