[SOLVED] EV3 ultrasonic sensor returns invalid data until distance change (or maybe meaningful range?)

brickpi3

#1

When I run the EV3-Ultrasonic.py example, the sensor keeps returning invalid data, until I wave my hands in front of the sensor, or place a book in front of it. It feels to me that it has to sense some distance change (maybe in a certain range) before it starts to output meaningful values. Anyone knows how to work around that?

pi@dex:~/Dexter/BrickPi3/Software/Python/Examples $ python EV3-Ultrasonic.py
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
get_sensor error: Invalid sensor data
19.0
19.0
19.8
19.8
19.8
19.8
19.8
19.8

Hardware/software versions:

pi@dex:~/Dexter/BrickPi3/Software/Python/Examples $ python Read_Info.py
Manufacturer    :  Dexter Industries
Board           :  BrickPi3
Serial Number   :  88DD0F56504D5741372E3120FF0E2014
Hardware version:  3.2.1
Firmware version:  1.4.6
Battery voltage :  9.312
9v voltage      :  9.151
5v voltage      :  4.948
3.3v voltage    :  3.371

#2

Just saw this post, so I tried waiting for 10s before reading the sonar. Now the sensor works! Sorry for bothering. Can I ask how to mark this post as solved?


#3

Yes, we can close it. Glad you find out the problem.

Thank you!


#4