go_away

Author Topic: IR Encoders not working!  (Read 3368 times)

0 Members and 1 Guest are viewing this topic.

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
IR Encoders not working!
« on: March 29, 2008, 11:27:51 AM »
I am trying to make some encoders for my OOPic robot, but they don't seem to be working. I am building my encoder circuit basec on the schematic on page 207 of this PDF: http://mechatronics.persiangig.com/WEBLOG/E-BooKs/Build_Your_Own_Combat_Robot.pdf

Basically, I feed 5V through a 330 Ohm resistor to the IR LEDs which then goes to ground. Then, 5 V is fed through a 4.7 KOhm resistor that goes to an IO port on the PIC which goes to the collector of the IR phototransistor. The emitter of the ptransistor is then attached to ground.

This is my PCB that I used: http://img228.imageshack.us/my.php?image=encoderpcbpz8.jpg



S1 through S4 are the four encoders, and the third pin that is unlabeled for all the four encoders is the wire that comes from the collector of the phototransistor. The grounds of the IR LED and emitter of the P.T. are tied together and come to the board and hook to ground.

Whenever I apply power to the board (5V), and check the voltage at the IO Pins when the detectors are just lying in the open, I get about 5 V. If I take my TV remote and shine it into the P.T., the voltage drops to about 4.8 to 4.7. When I turn the remote off, the voltage jumps back to 5. If I simply put a white sheet of paper close to the LED/PT pair, nothing happens.

Isn't it supposed to be where when IR light hits the P.T., the voltage drops to zero, or is the small voltage drop of about .2 V the proper occurence? Or is there something wrong with my circuit?
« Last Edit: March 29, 2008, 11:28:42 AM by vivek9856 »

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: IR Encoders not working!
« Reply #1 on: March 29, 2008, 12:31:52 PM »
I have the same problem with my custom made encoders. On the right side of the robot they work acceptable (I still need to solve some up-down-up counting in some places of the encoder disk). But on the left side, the difference between high and low is so small that the microcontroller does not see it as a change. So I started playing with the resistor values. In my schematic I had both IR LEDs wiren in series with a 220 resistor. But I had to change that and place each LED with it's own resistor in series, with different values. One is 220 and the other is 100 ohms. Also, the 10k pull-up resistor in the colector of the each P.T. has been replaced one with a 4.7k and the other with a 12k. Still, it doesn't work reliably. Probably it's the quality of the disk I made using regular paper and a laser printer. My multimeter has a Digital Signal position that will give me High, Low or in between. By switching to a voltmeter position I have determined that a High signal is over 2.5V and a Low signal is under 0.8V. I have noticed that if the wheels are wobbling a little, the signal is not high or low enough to be seen as a good logic level so that is the reason for my up-down-up counting when the wheels are spinning in the same direction.

Conclusion:
1. Check with a digital camera if the LEDs are lit. They will be seen as purple dots on the camera screen.
2. Place a white piece of paper at 1/4th of an inch distance and replace the series resitor for the LED with a pot and measure the voltage between the P.T. colector and ground while adjusting the pot. When the voltage drops to about 0.5V, disconect the power and measure the pot resistance. Replace the pot with a close value resistor.
3. Place a piece of black paper (the real disk will work fine) at the same distance from the sensor and measure the voltage on the P.T. colector (and ground). If it is lower than 2.5V, increase the pull-up resistor. If not, the sensor should work fine.
4. The remote test is not allways reliable, since it is a modulated signal. It works for a Panasonic IR detector or something similar like the Sharp or TSOP IR detector.
Check out the uBotino robot controller!

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
Re: IR Encoders not working!
« Reply #2 on: March 29, 2008, 12:49:25 PM »
I have the same problem with my custom made encoders. On the right side of the robot they work acceptable (I still need to solve some up-down-up counting in some places of the encoder disk). But on the left side, the difference between high and low is so small that the microcontroller does not see it as a change. So I started playing with the resistor values. In my schematic I had both IR LEDs wiren in series with a 220 resistor. But I had to change that and place each LED with it's own resistor in series, with different values. One is 220 and the other is 100 ohms. Also, the 10k pull-up resistor in the colector of the each P.T. has been replaced one with a 4.7k and the other with a 12k. Still, it doesn't work reliably. Probably it's the quality of the disk I made using regular paper and a laser printer. My multimeter has a Digital Signal position that will give me High, Low or in between. By switching to a voltmeter position I have determined that a High signal is over 2.5V and a Low signal is under 0.8V. I have noticed that if the wheels are wobbling a little, the signal is not high or low enough to be seen as a good logic level so that is the reason for my up-down-up counting when the wheels are spinning in the same direction.

Conclusion:
1. Check with a digital camera if the LEDs are lit. They will be seen as purple dots on the camera screen.
2. Place a white piece of paper at 1/4th of an inch distance and replace the series resitor for the LED with a pot and measure the voltage between the P.T. colector and ground while adjusting the pot. When the voltage drops to about 0.5V, disconect the power and measure the pot resistance. Replace the pot with a close value resistor.
3. Place a piece of black paper (the real disk will work fine) at the same distance from the sensor and measure the voltage on the P.T. colector (and ground). If it is lower than 2.5V, increase the pull-up resistor. If not, the sensor should work fine.
4. The remote test is not allways reliable, since it is a modulated signal. It works for a Panasonic IR detector or something similar like the Sharp or TSOP IR detector.

Hey. Thanks for the detailed response. You have a fairly good voltage change (about 1.7V), but I only have about a 0.2V difference, lol. And I am using the same value resistors, etc., so I don't know whats wrong.

I did try checking the resistance between the emitter and collector of the PT (If this is of any use), and when blacked out (my finger on the window), I get infinite resistance, but when open to the regular daylight, I get maybe 30 KOhms of resistance. Does this mean anything to you?

I didn't think of the camera idea for the LEDs. I thought most cameras have IR coatings on the lenses, which gives them the purple like color, but I may be wrong. I'll try that and see if my LEDs are actually working.

I'll post back in an hour or so after experimenting.

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
Re: IR Encoders not working!
« Reply #3 on: March 29, 2008, 01:29:12 PM »
Oh, one more thing. Theres nothing that you see wrong with my circuit, is there?

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: IR Encoders not working!
« Reply #4 on: March 29, 2008, 01:49:57 PM »
No, it seems fine.
But, are you sure the P.T. is IR sensitive? Measure the resistance when IR light is facing it, it should be lower than 30k. If it isn't, change the pull-up resistors to something like 60k.
Check out the uBotino robot controller!

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
Re: IR Encoders not working!
« Reply #5 on: March 29, 2008, 02:26:18 PM »
No, it seems fine.
But, are you sure the P.T. is IR sensitive? Measure the resistance when IR light is facing it, it should be lower than 30k. If it isn't, change the pull-up resistors to something like 60k.

The P.T. is IR sensitive, because I am using a QRB1114 package, that has an IR LED and P.T. in one small package.

I tried wiring the LED to a 3.3V pwr source through a 220 ohm resistor, and I saw nothing on the camera. When I shined the remote into the camera, I did see the purple light.

So could it be that the LED's are burnt out? I tried this on all four of my LEDs, and none of them showed up on the camera.


Also, is it possible for me to just get a ball mouse, and keep the mouse in tact, and use the mouse output someway to get the same effect?
« Last Edit: March 29, 2008, 02:47:40 PM by vivek9856 »

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: IR Encoders not working!
« Reply #6 on: March 29, 2008, 03:16:38 PM »
The P.T. is IR sensitive, because I am using a QRB1114 package, that has an IR LED and P.T. in one small package.

I tried wiring the LED to a 3.3V pwr source through a 220 ohm resistor, and I saw nothing on the camera. When I shined the remote into the camera, I did see the purple light.

So could it be that the LED's are burnt out? I tried this on all four of my LEDs, and none of them showed up on the camera.

Try to connect one LED in series with one 220 resistor to 5V. 3.3V is too little for a 220 resistor in series with a LED. If it still does not work, try switching the LED's leads.

Quote
Also, is it possible for me to just get a ball mouse, and keep the mouse in tact, and use the mouse output someway to get the same effect?

I know it is possible to use a mouse for encoders, but I didn't do it myself, so you have to find more info on the net.
Check out the uBotino robot controller!

Offline Steel_monkey

  • Full Member
  • ***
  • Posts: 85
  • Helpful? 0
Re: IR Encoders not working!
« Reply #7 on: March 29, 2008, 03:28:06 PM »
It is useful to put signal on comparator first (something like LM 339 cheapes solution) non-inverting input, and bias inverting input with resistor devider (one of resistors can be potentiometer for bias tuning). From comparator you will have clear digital output.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: IR Encoders not working!
« Reply #8 on: March 30, 2008, 02:48:55 PM »
Read this tutorial for selecting the proper resistor value:
http://www.societyofrobots.com/schematics_photoresistor.shtml
(yea, its a different sensor, but the concept and schematics are the same)

Also, a TV remote IR probably isn't the best to use for a test, since its modulated.

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
Re: IR Encoders not working!
« Reply #9 on: March 30, 2008, 03:27:56 PM »
Read this tutorial for selecting the proper resistor value:
http://www.societyofrobots.com/schematics_photoresistor.shtml
(yea, its a different sensor, but the concept and schematics are the same)

Also, a TV remote IR probably isn't the best to use for a test, since its modulated.


So I would measure the resistance between the emitter and collector when dark (infinite resistance), and when theres light (like 30 KOhms)? That wouldn't work with that equation, because the resistance when dark is infinite.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: IR Encoders not working!
« Reply #10 on: March 30, 2008, 04:04:15 PM »
Quote
the resistance when dark is infinite.
Impossible. Measure it!

(of course, 1 Mohm could be "infinite" relatively . . .)

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
Re: IR Encoders not working!
« Reply #11 on: March 30, 2008, 04:51:15 PM »
Quote
the resistance when dark is infinite.

Impossible. Measure it!

(of course, 1 Mohm could be "infinite" relatively . . .)


Okay, so I set my multimeter to resistance on the 200 KOhm setting, and measured resistance between the collector and emitter, and in light, it read about 20 to 30 KOhms. When I put my finger over the IR window, the resistance climbed to 80, then 150, then 190, then the meter went to 1 (Out of range). I clicked the meter up to 2M, and still "1". Clicked it up to 20 M, and still read "1".

What do you make out of this? Am I doing something wrong?

This is my LED/P.T. pair: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=QRB1114-ND

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: IR Encoders not working!
« Reply #12 on: April 06, 2008, 01:05:24 PM »
Hmmmm

Set your multimeter to 20M and put your sensor in light for a second. Then block it and watch how fast the resistance goes up.

I guess we can say it has a very very high resistance . . . so just assume its about ~100k (effectively).

Offline brijesh

  • Full Member
  • ***
  • Posts: 55
  • Helpful? 0
Re: IR Encoders not working!
« Reply #13 on: April 06, 2008, 11:13:47 PM »
From the picture you have shown a single 330Ohm resistor is feeding current to 4 LEDs. The supply voltage is 5 volts. Assuming that forward voltage drop through the LED's is about 1 volt then the max current through that resistor = (5-1)/330 = 12mA. The 12mA is shared by 4 LEDs which comes to about 3mA per LED. Thats too low.

You need to connect individual LEDs independently or use a much lower resistor. Drive the LEDs with at least 50mA of current each.

Brijesh
 

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: IR Encoders not working!
« Reply #14 on: April 11, 2008, 07:18:11 AM »
Quote
The 12mA is shared by 4 LEDs which comes to about 3mA per LED. Thats too low.

You need to connect individual LEDs independently or use a much lower resistor. Drive the LEDs with at least 50mA of current each.
Yea, 3mA is definitely way too low. Check the datasheet for how much current you can apply. I've used LED's that can't go over 20mA.

Offline vivek9856Topic starter

  • Jr. Member
  • **
  • Posts: 43
  • Helpful? 0
Re: IR Encoders not working!
« Reply #15 on: May 23, 2008, 07:25:53 AM »
Okay. I'm back from a month break on my robot, and am back to my encoders.

My IR LEDs in the QRB1114 package were all initially blown out. I replaced all the sensor / emitter packages, and checked with a camera, and I am getting IR light from all four of my emitters.

Now, to the LED resistor size. I have a 300 ohm pot on their power source. I figured 10 mA per LED should be sufficient, so I think about 80 ohms of resistance should be good, with a 5 V power source and 4 - 10mA LEDs. Anyone find a problem with this?

Secondly, for the voltage divider / resistor thing, I want to make it adjustable for different conditions that the sensor may be in. Therefor, I would need to put a pot instead of a resistor.  Right now, I have one individual resistor for each single detector. I wanted to know if I could just use one pot to adjust the sensitivity of all four of the sensors. Is this possible? If so, where would I put the pot on the circuit? How big a value should this pot be?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: IR Encoders not working!
« Reply #16 on: May 25, 2008, 03:15:20 PM »
Quote
Now, to the LED resistor size. I have a 300 ohm pot on their power source. I figured 10 mA per LED should be sufficient, so I think about 80 ohms of resistance should be good, with a 5 V power source and 4 - 10mA LEDs. Anyone find a problem with this?

http://www.societyofrobots.com/electronics_led_tutorial.shtml

Quote
I wanted to know if I could just use one pot to adjust the sensitivity of all four of the sensors. Is this possible?

nope, cause the signal from each sensor would be different . . .

 


Get Your Ad Here

data_list