QTR-8A How to calibrate?

Hello!
I am reading qtr-8a sensors via 8 analog channels of my uC. ADC is 10 bits and max value is 1023. So how can i calibrate this sensor readings for my line following robot?

Hello,

Are you using an AVR-based controller? If so, you can use the Pololu AVR Library or the Arduino Library for the Pololu QTR Reflectance Sensors.

What we usually do is measure values for several seconds while moving the sensors over some black and white areas on the course. Record the max and min values seen for each sensor during this time. Then you can compute a calibrated value as something like

calibrated value = 1000 * (raw value - min) / (max - min)

You can implement that in whatever way works on your platform and in your programming language.

-Paul

Thanks for your answer Paul.
What do you mean with “raw_data”. Do you mean “sensor readed data” ?

Hello,

I did not use the words you are putting in quotes. But the whole point of calibration is to turn “raw” values read directly from the sensors into values that are independent of the lighting conditions, variations between the sensors, and course conditions. That means you need a formula to take a raw value and turn it into a calibrated value, which is what I gave you.

-Paul

Thanks for answers.

But my question is “How can i read max and min values of sensors like 3pi, automatically?”. At the starting, my robot have to read all sensors and take all max and min values but how? Can you give some piece of code please?

Hello,

What controller are you using? Do you know how to program it? Do you know how to read values from the QTR sensors?

-Paul

I use PIC18F2550 and i know how to read analog sensor outputs. But i cant calibrate sensor readings for ambient lights. Can you offer a proccess how to calibrate sensors for ambient lights?

Hello,

If you know how to read sensors, finding the minimum or maximum value of a series of readings is a very basic programming task. I suggest that you give it a try yourself and post the code from your best attempt when you get stuck.

-Paul

Thanks for reply

Okay, it looks like you are doing it exactly the way I suggested. Is it working?

-Paul

Yes it is working, but some times i get some abnormal values from sensors. My correction value changes between 255 and -255. I dont shut down emitters anytime. Should i get emitters off and sample value for ambient light like in this link?
elm-chan.org/works/ltc/report.html

It is really hard to help you if you do not give me details about your problem. For example, I cannot even tell from what you have said so far whether you are satisfied with the sensors and just worried that you might be doing something wrong or whether you are actually having trouble. I cannot suggest whether you might need to adjust readings for ambient light if I do not even know what you are doing with the sensors, where they are operating, etc. If you have trouble with ambient light, you might need to do that.

If you need more help, I suggest posting a real description of what you are trying to do and also some of the data that you are not happy with.

-Paul

Thanks for your helps. Sorry for my bad english. I couldnt tell my problem. So I will deal with it myself.