Does anyone know how to set up one of these things:
I can't seem to get it working.
Someone made a quick "tutorial" on LMR but I just don't get it.
I found a diagram here that just doesn't make sense. The wire colors are all messed up.
Then I found this:
...which I tried but it didn't work? It could be that I did something wrong or that my sensor is damaged...
Besides it's not easy to find examples of this, so a helping hand would be appreciated :)
The schematic looks good.
The schematic looks good. Wire colours and connection are ok and match with the datasheet. I don’t have this sensor but use a similar one (CNY70) in many applications. Maybe the sensor is defect. You can check the IR Led with a digicam, it should glow violet. The analog output can be tested with a multimeter and ambient light.
Remember the output signal is analog. The maximum detection distance is only a few millimeter.
What is your application?
This should help
This should help : https://www.robotshop.com/letsmakerobots/node/871
Sorry, i just noticed you had already posted it.
Nothing appears wrong in either the schematic above, or the colors used in the Arduino link, though the placement of the wires on the sensor is switched around in the Arduino link.
The sensor should have a high (5 volt) output with nothing close by, or when within 1/8" of a dark surface. When about 1/8 inch (3 millimeters) from a white surface should produce a low, (0.6 volt) signal on the output between the collector and the 10K resistor.
Well I just seemed to be getting fluctuating random numbers no matter what I did, and since I couldn’t find any diagram that confirmed my setup I presumed my setup was wrong and stopped testing out of fear of toasting my sensor.
BUT…I just tested it again and allthough the readings aren’t quite as consistent as I’d like, it does seem to be working.
Here is an example of the readings when nothing is in front of the sensor (fluctuating between 0V and a litle less that5V):
Here is an example of the readings when a white surface is in front of the sensor (fluctuating between 0V and a litle over 1V):
These readings aren't very useful though since they seem to be resting on the same "plateau" (~1V), so I'll need a LOT of readings to tell the difference. Besides when I put a black object in front of the sensor the readings look the same as if it was a white object.
I plan to use it for an encoder like this:
...which will be placed on the wheels of a robot. So I'll need some more consistent readings...
Are you trying to get an
Are you trying to get an analog reading? You just need a digital since it is either black or white.
You’re right but it’s an analog sensor so I thought I should do it like this and use code to determine whether it’s black or white. I’ll try connecting it to a digital pin though I think it will just randomly show high-low since both cases (see scopes above) occasionally dumps to 0V…
Forgot to ask
Does anyone know how often this sensor can/should be read? I know that a GP2D12 Sharp sensor should be read max every 36ms, but I haven’t found this info on the QRB1134…
I just tried using a digital input instead of an analog input and it seems to be working. I (almost) got a straight 0V’s with a white object and a straight 5V’s with nothing in front of it. Don’t understand why though, but as long as it works I guess…
The black objects I’ve tried still read as white objects, but I guess it has to be a matte pitch black surface that absorbs ALL light. I read that one should print out the encoder using a LASER printer and not an INK ditto like the one I have, so I can’t test it right now.
Still any progress is good progress…thanks mate
Try replacing your resistors
Try replacing your resistors with pots and see if you can dial in the proper sensitivity so black = black even when it isnt a matte finish.
The datasheet for the
The datasheet for the QRB1134 indicates a rise time and fall time of 8 us, so it could probably be read about 60k times per second, or about 2000 readings in the period needed to read the GP2D12.
In reality, probably only need to check it about 100 times a second as the robots reaction time will be much slower.
Thanks for the tip (again). I may do that later
Not only did I get the answer to my question, but I also learned what the hoot rise/fall time means. Some day I may even be able to read these datasheets on my own…
BTW the setup is now working. Thank y’all for the tips
Ok at it again :S
It seemed to work somewhat but actually it’s still quite messy. I don’t understand how people can get usefull readings out of these things.
When I connect it to a digital input it SEEMS to work BUT it often misses a black/white transition and often counts a transition several times.
When I connect it to an analog input…well…In the oscilloscope screenshots I posted earlier you’ll notice that the two examples both seem to “rest” on the same “plateau” (around 1V). And both give off 0V readings as well. The only difference is that the occasional spikes are higher in the 1st example.
Are the readings supposed to be like that? I’m very interested in hearing from anyone who have worked with these sensors or similar (QRD1114 or whatnot).
EDIT: I might add that I’m using the resistors shown in the schematic above and a 0.1uF ceramic capacitor…
Lynxmotion has a module
Lynxmotion has a module called the single line detector. It uses an opamp to clean up the output of a sensors somewhat similar to the QRB1134, as shown in the schematic in the manual.
The plot thickens
Interesting…However I checked the schematic and the LM311 (which I suppose is the op amp you refer to) is actually a voltage comparator. Not sure whether that is a subspecies of op amps or vice versa though?!
Anyway it’s seemingly a different setup than using the Schmitt trigger which I’ve seen and heard off quite a bit the last few days.
Thanks for the input (right now I need all I can get)
Sorry, didn’t look up the
Sorry, didn’t look up the part before posting, just glanced at the schematic symbol which is similar for op-amps and comparators. A comparator could be called a “digital” op-amp, passing a signal when it is above a certain threshold ( the other input). So yes, comparators are a subset of op-amps.
All these suggestions (schmidtt trigger, comparators) and uses point to one thing : some sort of buffer between the sensor and digital circuits trying to read it.