Problem on an old optical encoder

Thread Starter

brianon99

Joined Jun 20, 2022
9
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:

IMG_20220621_011520.jpg
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)
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!
 

Attachments

MrChips

Joined Oct 2, 2009
30,708
Welcome to AAC!

Do you have access to an oscilloscope or know someone who can help you with using an oscilloscope?
This would make the trouble shooting proceed a lot faster.

If there is no oscilloscope available then we will have to be resourceful and find other methods of testing this.
It is going to be difficult to test code if you don't know what the hardware does.
 

sagor

Joined Mar 10, 2019
903
Many older IR LEDs get weak over time and can no longer trigger the detector. Is there a change to change the IR/detector module. Are they separate components or one module? If separate components, you may try to replace the IR LED with a similar one.
Seems the HOA902-11 is a module, try to replace it if possible, I see a few online on places like Ebay.
 

Thread Starter

brianon99

Joined Jun 20, 2022
9
Welcome to AAC!

Do you have access to an oscilloscope or know someone who can help you with using an oscilloscope?
This would make the trouble shooting proceed a lot faster.

If there is no oscilloscope available then we will have to be resourceful and find other methods of testing this.
It is going to be difficult to test code if you don't know what the hardware does.
Thank you for your reply, MrChips!

Sorry I don't have an oscilloscope. All I have which may be useful are: a raspberry pi, a digital multimeter, and an Arduino nano.

Actually there are 2 set of HOA902-11, but I cannot make any of them work.
 

Thread Starter

brianon99

Joined Jun 20, 2022
9
Many older IR LEDs get weak over time and can no longer trigger the detector. Is there a change to change the IR/detector module. Are they separate components or one module? If separate components, you may try to replace the IR LED with a similar one.
Seems the HOA902-11 is a module, try to replace it if possible, I see a few online on places like Ebay.
Thanks, Sagor. The IR LED and sensor is one component, and it is hard to replace only the LED with my limited skill. Buying one HOA902-11 is expensive in my country. Is there any other way of testing?
 

Thread Starter

brianon99

Joined Jun 20, 2022
9
I have finally got it working. Thank you for all your help.

The breaking point is that I found another datasheet on the internet, which shows that 1.06V between the LED cannot trigger the pulse. (lower right graph below, the 25C curve, for 1.06V the current is way too small). Then I connected the LED pins directly to an 1.4V alkaline AA battery and every thing works.
smallpdf.com_zh-TW_pdf-reader.png

However, I have another problem now. I learned from the arduino tutorial that connecting LED directly between pins may burn the circuit. However as I originally put a 1K resistor next to the LED and raspberry pi 3.3V, the voltage droped to 1.06V which is not enough. How should I configure the circuit now? (I don't want to keep the AA battery in my setup :p ) Thank you.
 
Last edited:

MaxHeadRoom

Joined Jul 18, 2013
28,617
Look at the specs for the max LED current, IIRC for this device it is max 50ma.
If you include the voltage drop of the LED, you should be able to go much lower in value.
 

panic mode

Joined Oct 10, 2011
2,715
the 50mA is the absolute maximum. this is on the edge of destroying product and should never be used.
datasheet tells test condition used 20mA for IR emitter. at this current forward voltage is about 1.2V.
So you get

(3.3V -1.2V)/20mA = 105 Ohm
so choose nearest value and that would be 100 Ohm (alternatively 120 Ohm).
 

Thread Starter

brianon99

Joined Jun 20, 2022
9
the 50mA is the absolute maximum. this is on the edge of destroying product and should never be used.
datasheet tells test condition used 20mA for IR emitter. at this current forward voltage is about 1.2V.
So you get

(3.3V -1.2V)/20mA = 105 Ohm
so choose nearest value and that would be 100 Ohm (alternatively 120 Ohm).
Thanks. I have ordered some 100ohm resistor and will try it later.
 
Top