# KoP Rangefinder

How do you wire and program a range finder from the KoP?

I have no idea whatsoever.

Thanks in advanced and Happy Competitions!

I have reviewed the Jav API and the wiring diagrams. Some othe forums have said o plug it into the DSC D I/O slot, the Analog slot, and/or the Digital slot of the cRIO. I do not fully understand where to plug it in or how many inputs to plug in except for three of them. If anyone can show some sketch or detailed plugin info, then that old be much appreciated.

I am fairly sure you hook power to 5v power, ground to ground, and then read the analog signal with the analog sidecar.

Then, empirically find a voltage to unit conversion for whatever unit you would like to use( meters, feet, inches, yards, etc). (Use a ruler and write down the voltages at different distances).

Then read the voltage and apply that unit conversion to work with the distance sensor form code.

That’s what our team is doing. (for some reason, the provided unit conversion was not very accurate)

Reading the analog (AN) signal using the Analog breakout on the cRio is the easiest way.

As a rough estimate, you get about 10 mV per inch. So a voltage of 1.44 volts is 144 inches or 12 feet. Then calibrate it as described above.

Well, I want about 10 to 12 ft for shooting and I don’t really understand hat you mean. Do you want me check the voltage emitted by distance to test?

OK, if you give the sensor +5 volts and ground, it will return a voltage between about 0.07 and 2.55 volts on the AN pin. That voltage, which you have to read into the cRio using a channel on the analog breakout, tells you the distance to the first solid object it encounters.

For example, if you read a voltage of 1.44 volts, you will be about 144 inches - 12 feet - from some object. You may need to measure for more exact voltages and distances.

What exactly that object IS can vary - it might be the backboard, it might be the fender, it might be another robot (or, if you mount it low enough, I suppose a ball). Sound waves are directional kind of like light from a flashlight, so where you point your sensor will affect which distance it ‘sees’.

Smaller objects need to be closer to be sensed, larger objects can be further away. The upper limit for the KoP sensor is IIRC 256 inches, but verify that. Maxbotix makes similar sensors good to about 33 feet though.

Does that help?

its not that simple, but most if not all sensors have a datasheet saying the mV/Inch and on the code side

``````
analogin.getVoltage() / mV); //mV is the mV per inch you have to look up..

``````