Use of Sharp Optical ranging sensors & OpenMV interaction

In my application for the OpenMV, I’d like to know the distance between the camera and an object. Where I am tracking a color blob, may I assume the Methods “blob.pixels” or “blob.area” will tell me the relative distance because the number of pixels increases as I get closer? What about the case of not tracking a blob? I could use ultrasonic or other acoustic methods since there would be no visual interaction. My question is about the Sharp optical ranging sensors. I have not yet experimented to see if the IR they emit would negatively impact operation of the OpenMV. Do you have any experience with the Sharp sensors? I will read their datesheet to learn the characteristic of their output and also try placing one in the field of view for the OpenMV and observe if I can detect any difference in the images captured.

What are your thoughts on this topic?

Austin

Where I am tracking a color blob, may I assume the Methods “blob.pixels” or “blob.area” will tell me the relative distance because the number of pixels increases as I get closer?

Yes, but, keep in mind this is an 1/area^2 relationship. So, as the object moves away it gets small quick.

As for the IR ranging sensor. Those will not affect the OpenMV Cam. They emit modulated IR light. So, unlike an IR LED they don’t just shine constantly. So the integration of their IR emission will not be present in the image of the camera.

As for connecting to a sharp IR sensor. I’d use an analog one and just read the value from it. Or, you can use a digital one and clock in the value. Doing so should be easy enough with the pyb module. Note that the ADC on the STM chips is not 5V tolerant. Only pins in digital mode are 5V tolerant.

Thank you. The analog variant is simpler. For a voltage divider, how about 47k and 91k for R1 and R2. My voltage divider formula shows 5.0v comes out to exactly 3.3v. With these values, the supply draw should be very low. I have some other questions on the servo functions but I’ll put them in another post with a different subject.

Austin

That voltage divider should be fine. The ADC has 12-bit resolution so you should be able to resolve distance readings still.

My experience with the sharp sensors (mind you it was the GP2D12) is that you don’t need a voltage divider because even though its a 5v device, the output voltage never goes about 3.3v. According to the datasheet, the max voltage out of a GP2D12 is 2.8v, and the newer sensors like the GP2Y0A21YK0F have a max voltage just over 3v.

If you are going to use a voltage divider, make sure that you use high precision resistors. The default resistors you get are normally +/- 5% or 10%.

Thanks for your information. I have several variants of the Sharp sensors. I’ll round up the analog ones and measure their output. I also, appreciate the resistor advice. I have a nice selection of high precision (blue-ish ones) and will be sure to use them for my divider.

Austin