Let's Make Robots!

Why am I an idiot and IR transistors...

Here's the encoder part http://www.sparkfun.com/datasheets/Sensors/QRB1114.pdf


This should be simple... resistor pulls the input pin high, transistor clicks and pulls it to ground.

What am I missing?!?!?



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi Chris,

 just call me Cliff,

A little point to note is looking at the datasheet (fig 5) you will get the best performance at around 1/8", at that distance the IR LED will be painting a disk 0.2" diameter so the size of the stripes on the encoder will need to be > 0.17" apart or they will start to interferr with each other.

Thanks man,

Naw, the idiot thing was the fact that I have wired basically this same configuration many times before and was just stumped why this time is was not working. --You know, a  "man, I gotta be missing something simple here..." moment. At any rate, all the encoders similar to this on in the past all just sorta "worked" with a "standard" 330r on the led and a 10k for a pull-up. Thus the "WHY ISN'T THIS WORKING!!??"  When I got to this one. Oh, and all my diagrams are just sharpie on typing paper, that and I still have to keep all my programming notes on paper (with a pencil) or I get confused. --We spend $6mil on a ball-point pen that would write in space, the Russians used a pencil.

In terms of processors and encoders for that matter, I am a picaxe guy (because the BASIC doesn't scare me and seems to work the best in my brain). With this encoder, and the final solution, I just needed to get the "low" low enough to break the picaxe's threashold of recognizing it as a 0. You nailed the idea of getting that LED brighter by the way, and thanks for the math lesson -it went straight to my notebook. I don't think I will need any amplification though, I did all my testing with the unit pointing straight up at a flo. light from the breadboard. When it is tucked in under the chassis 1/4" from the stripes on the wheels, I should have no problems at all. Not to mention, the tests were with typing paper and the stripes on the wheels wil be nice, high gloss paint and flat, dull black tire.

One more quick one (I don't want to eat up any of that 12gig of bandwith a month restriction you Aussies have) --That momentary idiot thing you speak of, well, it's a "brain-fart"... I don't know how universal that is.

Thanks for the help, as always...

Hey Chris,

I forgot to mention, you’re not an idiot, they are not found building robots, therefore simple logic dictates that Chris ≠ Idiot.

I forgot to compliment your drawing above, very nice, does your wife mind when you draw on the wall? Or is that where the Idiot part came in? ;-) Sorry I jest.

We are of course all momentary idiots, I have many situations where something I have done has let the magic smoke out of some component, decimal points and polarity are pesky things.

On a serious note, one thing you might consider, I am not sure what processor you are using but some Microcontrollers have ports which can be setup up as Comparators, usually with an internal reference voltage or an external one, a Comparator (for completeness) out puts a high when the voltage is above the reference voltage and a low when below. There are comparator chips and the market but it is easy to build on from an OPAMP just a few resistors, this would mean no ADC, and you could run the sensor off an interrupt if you wanted to.

all the best from Down under

All this WAS in the shout-box...      ...and it WAS a shame...

In a shoutbox... What a shame that would have been...


Alright ladies and germs...

Final numbers...

Current limiting resistors on LED emitters: 100R

Pull-up resistor on input pin (Digital): 22K

I have awesome sensitivity with this set-up. The unit is triggered starting at about 3/4" away using white printer paper. When this is installed on Walter, it will be about 1/4" away so I feel I have a pretty good safety margin.


Word, yo.

So much to go through... (and it is early morning now, I have not tested any of this yet.)

Yes, Frits nailed it with the test with ADC thng.

Rik is funnier

Frit's suggested a way to test, rik suggested a tool to test with -points to each of you.

Frits is a very competent person

cwignell is a electronics math guru.

Now, stuff I learned:

These are encoders for walter's wheels -White and black stripes on the edge of he wheels. Now that I have it down to a 35k pull-up and it is on the edge of usability, yes, the bright sun or flo. lights might just throw a wrench (spanner) into the works. I reread cwignells math a few times and I think I actually have it in my head now. One major thing he mentioned (which before I didn't know how to calculate) is the current limit resistor on the LED. His math puts it down below 100R instead of 330R. I like this a lot... I would like to think that a brighter LED would do wonders in terms of triggering the transistor, this will one of the first things I will try. Second, he mentioned running + into the collector and adding the resistor and output to the pic on the emitter side. I though this was a no-no with a NPN. Actually, I have "switched positive" with other NPN encoders before and remember being told not to but it seemed to work then. I will try this on the next pair I play with, I etched the PCB's last night and don't want to again --they are etched with the set-up described at the begining of the post. I can change resistor values when I solder them up but not the wiring. I am curious though, about the performance difference between each set-up.

The bottom line and where I sit now: I think I am basically going to get the LED brighter, retest (using ADC and a pot) with the brighter LED and see if I can get the pull-up's a little lower in value. This should give me a wider window so when I do run into bright sun or flo. lights, I will have a better chance of being in that window.

Thank you all for your help and consideration, I feel less like an idiot now, we are all competent, you are all loved!

In the words of Rodney King...

"Can't we all just get along?"  :)

I was probably bothered about the connection of the collector to a positive source, resistor off the emitter, might have asked you about it long ago. It didn't seem right ot me, but couldn't think of a good reason why.  So I mentioned, "what the heck, if it works, might as well", or something like that.

You must be doing something right Chris.

With a title like that, not one person could explain why your an idiot :P

He is an idiot for listening to rik!