We are trying to use the Maxbotix 1013 ultrasonic sensor but when we put it on the Rio, the range of values we get is just 233 to 350. On our arduino, we get a range of about 58 to 400ish. We were using the analog inputs on the arduino and on the Rio. All we are doing is analog.input() on the Rio. We are using pin 3 on the maxbotix sensor. Is that the actual range of the sensor? Or am I doing something wrong.
I see on the datasheet that it is supposed to be able to output 0 to 1023 for analog, but since I get nothing close to that, does that mean my sensor has gone bad or something? Thanks!
Possibly. Try using ultrasonic.getVoltage() instead of getValue() and see what you find- this method returns the analog value in calibrated units. (maybe this is what the data sheet is referring to when it says analog voltage bits values should be in between 0-1023)
Yeah I think the sensor is just not working. The voltage only changes for about 18 inches in range which is not even close to what it should be doing(5 meters). I think I’ll give some other types of ultrasonic sensors a try. Thanks for the help!
The RoboRIO has a 12-bit ADC, not a 10-bit ADC. The RoboRIO’s ADC count value can range from 0 to 4095. You can right shift that value by 2 to get a value in the range from 0 to 1023.
Each count will relate to 5mm of range. So multiply that output by 5mm to get the correct distance.
The beam pattern of that ultrasonic sensor is wide. That means that anything near it’s cone will cause a reflection. The floor or table counts.