ArduinoGeneral

Problem with A01NYUB sensor - ask for help

userHead r.marciniak84 2020-04-15 23:48:25 1922 Views2 Replies
Hello,
I just bought A01NYUB and connected it to my RPi4B. I have downloaded library from https://github.com/DFRobot/DFRobot_RaspberryPi_A02YYUW. The issue I face is that I get only 3 reads of sensors at the beginning and most of the time no data. Moreover if I play with sensor I get error from script.
Please notice that I use only sensor and RPi4B, no additional board. I have modified DFRobot_RaspberryPi_A02YYUW.py as it was created for sensor with smaller range(450 vs 750). I only modified the min/max values.
See below:
Code: Select all
[email protected]:~/mu_code $ sudo python /home/pi/Desktop/demo_get_distance.py
No data!
No data!
No data!
No data!
No data!
No data!
No data!
Distance 2074 mm
Distance 2070 mm
Distance 2078 mm
Distance 2074 mm
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
No data!
Distance 790 mm
Distance 838 mm
Distance 917 mm
Distance 2065 mm
No data!
No data!
No data!
Traceback (most recent call last):
  File "/home/pi/Desktop/demo_get_distance.py", line 44, in <module>
    distance = board.getDistance()
  File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW.py", line 95, in getDistance
    self.measure()
  File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW.py", line 63, in measure
    while self.ser.inWaiting() == 0:
  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 590, in inWaiting
    return self.in_waiting
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 467, in in_waiting
    s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
IOError: [Errno 5] Input/output error
2020-04-16 01:57:57 topic can closed, I found an error. I had to disable serial console. Apparently it was causing some conflict. userHeadPic r.marciniak84