Let's Make Robots!

QRD1114 digital output

converts analog output to digital one

Hi...

 

Back again with some info... So I want to hit it in the middle...

 

Everyone who bulit a line follower sometimes get annoyed by the thing that his sensor returned an analog value and it was a pain in the "shoulder" to make it to get a good reading... I know AVRs need time to make conversion etc but why would you keep the MCU draining power etc when you can get a simple digital value back... Seriously, digital value with QRD1114...

 

    What you need to do is just attach 3 type of resistors... 1 is for sure to don't blow the IR led... but the other two are needed as one for pull-up and 1 for limiting current into the MCU...

 

The cap can vary from 0.01uF to 0.1uF sorry for this :D everywhere is 0.01uF I wrote 0.1 but its working too

As you see it's not a pain now to work with simple 1 and 0... Now I ask... better add 2 resistor in plus and a cap... or stay and eat your hat with programming?

 

Thats it guys, I know it's not hard or you can just google up and search etc... but why would you that?

 

 

I got the ideea from the guy who made the video too so all credtis goes to him... I just poested this as a post and ad him all the credits...

 

Thanks to OITRC


Goodbye,

      Hesit8

Comment viewing options

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

Nice! All I need is digital from my QRD. Great tip!

you are welcome :) this reduce the cost and developboard of LM394 needed for digital conversion... :) I use it in my new robot... will post it tomorrow

I wonder if that can be used with simple IR LEDs

Why bother with the 220Ω resistor going into the micro? Most digital inputs already have extremely high input impedance.

Also worth noting that the 10kΩ resistor can be changed to increase/decrease the sensitivity of the sensor, effectively moving the high-to-low threshold up or down. This is especially important if you've got a schmitt trigger type input instead of a TTL input, as high sensitivity can be required for proper switching.

donno why is that 220 ohm resistor there... i found this schematic somewhere... if you say that this is stable... and safe for an atmega8 than this is great cause I can free up some space... and what about the cap, I'm dare to ask, I used schematic found here: http://www.pololu.com/catalog/product/959/resources and one on youtube....

The QTR-1RC uses that extra capacitor to create an RC timing element for analog readings using a digital input - if you just want an immediate high or low signal you can drop the cap.
Not only do you free up a little more space, but the sensor's response time will be faster.

The 220Ω resistor is there to limit the current when the digital pin is configured as an output to charge the capacitor before an analog reading. If you remove the cap and/or only use the pin as an input then you don't need it at all.

so it should work only with pull-up? by the way the QTR-1RC returns digital value... how is that?

If you want a maximum speed digital input, just use the QRD1114 with a resistor for the IR LED and a pull-up/down resistor on the IR phototransistor. When the [reflected IR] > [setpoint value] you'll get a low on the input, when [reflected IR] < [setpoint value] you'll get a high on the input. The setpoint is changed by altering the phototransistor resistor value. The response time should be within 100μS.

The QTR-1RC is designed to return a digital value it's true... but it's not designed to return it immediately.
The idea is that you first set the pin to a high output and charge up the capacitor. Then you revert the pin to an input, and at the same time you start an internal timer. The phototransistor will gradually drain the capacitor, and the drain current is a factor of how much IR is reflected into the sensor; more IR = faster drain time.
Eventually the phototransistor drains the capacitor enough that the digital input goes from high to low, at which point you can stop/record the timer to see how long it took. That time is your analog value. The bigger the time, the less IR was received by the sensor, so the reflective surface must have been darker.

So there you have it - an analog value generated by a totally digital system. It actually works pretty well, I tried the same sort of idea myself in this little project.

now you explained it very clear... thanks mate...

 

but.. QRD1114 isn't digital as start... still don't understand why the QTR-1RC uses the cap and the 220 ohm resistor...

 

so If I want to use to return 1 or 0... just put the pull-up... nice...

 

still dont understand this [reflected IR] > [setpoint value].... so the setpoint is set by the pull-up/down right? what If I put the pull-up on 5V and I need 5V or 0V to MCU?   eh as soon as I will get my QRD1114s I will try  out just with a simple pull-up :D

 

as you described the cap charging is something like the PING))) uses? share the I/O on the same pin? taking a pulse, to charge the cap, change direction register from output to input.. enable ADC, read ADC, wait for conversion and thats it... oh god :D how many ideeas to reduce the pin usuage...

The setpoint value is indeed controlled by the pull-up/down in this case. Changing the setpoint allows you to control how much IR it takes to trigger the input to change from high-to-low or low-to-high.

The output of the QRD is never going to be totally digital unless you use a buffer/inverter/comparator/etc, but that doesn't really matter. Even though we think of a digital input responding to a 0 or a 1, a 0V or a 5V signal, there are actually a few different ways that digital inputs can respond to incoming signals, but the result you see internally will always be a 0 or 1.
Have a look into TTL inputs vs. Schmitt Trigger inputs and you'll get the idea.

Yeah, it is kinda like the PING))) in that regard, with combined input/output on one pin, and using digital timing instead of an ADC to generate an analog reading.