Let's Make Robots!

Infrared Proximity Sensor

I have a Infrared Proximity Sensor. Is there a way to debug the distance so I know how far I want it to detect something. I always see people's codes have 400 and 700 and I'm like where did they get those?

Comment viewing options

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

What micro are you using?
Many can send data back to a PC so you can see what value the input from the IR sensor has when an object is at the desired distance.

Alternatively you can measure the output voltage (assuming analog output on the IR sensor) with a multimeter/etc, and then convert that into the expected digital value the micro would get from the ADC.

Finally you can set a guess threshold value, and make an LED or something turn on when the range is less/greater than that value. With a bit of trial and error you can figure out what the desired threshold should be.


Check out this post on how to use the serial line to send data from your PICAXE to your PC through the terminal.

Write your PICAXE program so that it reads the analog input connected to the IR sensor, and then sends the data back via the serial line.

Thanks for your help!

Acctaully I noticed that the article was about the computer controlling the PICAXE. I need a code that alows me to see the data from the PICAXE.

Look closer, data is being sent both ways. SERRXD is the Rx/receive command, SERTXD is the Tx/transmit command.

Oh ok. Thanks

TofuRobot, You're asking a lot of questions that could be answered by going through the picaxe manuals. The first manual goes through how to read adc and output it. This can be done in a couple of lines of code. Tutorial 7 gives you what you need....

Please start looking at the manuals....

Sorry. I'll go look.