Forum >A02YYUW Rasbperry Pi connection problem
ArduinoGeneral

A02YYUW Rasbperry Pi connection problem

userHead umutcankalkan 2020-01-01 02:04:22 4084 Views7 Replies
I just buy this ultrasonic sensor but sample python code does not work with rasbperry pi 4.
Model of sensor : A02YYUW
DataSheet : https://pdf.direnc.net/upload/a02yyuw-s ... asheet.pdf
Errors : Traceback (most recent call last):
File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW-master/raspberry/demo_get_distance.py", line 44, in <module>
distance = board.getDistance()
File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW-master/raspberry/DFRobot_RaspberryPi_A02YYUW.py", line 73, in getDistance
self.measure()
File "/home/pi/Desktop/DFRobot_RaspberryPi_A02YYUW-master/raspberry/DFRobot_RaspberryPi_A02YYUW.py", line 41, in measure
while self.ser.inWaiting() == 0:
File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 590, in inWaiting
return self.in_waiting
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 467, in in_waiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
OSError: [Errno 25] Inappropriate ioctl for device
2021-09-22 16:55:57 Hi, I have same problem as described. If I change oon the file "DFRobot_RaspberryPi_A02YYUW.py" AMA0 to S0, It runs ok but give me a "No data!". Any idea what Im doing wrong? userHeadPic daniel
2020-05-21 08:06:49 Hi nana
Thanks for your help. After I changed the settings as you told me, it works great.
userHeadPic nevermind
2020-05-19 08:19:42 Hello
I'm trying to run your scripts from https://github.com/DFRobot/DFRobot_RaspberryPi_A02YYUW and getting the following messages:
Traceback (most recent call last):
File "demo_get_distance.py", line 44, in <module>
distance = board.getDistance()
File "/home/pi/Documents/Ultrasonic/DFRobot_RaspberryPi_A02YYUW.py", line 95, in getDistance
self.measure()
File "/home/pi/Documents/Ultrasonic/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 25] Inappropriate ioctl for device

I also tried to change the file name from AMA0 to S0, but it makes it even worse.
FYI, I'm working with a Pi 3 B+ and the recommended IO Expansion HAT for Raspberry Pi 4B/3B+
Any hints would be helpful.
userHeadPic nevermind
2020-01-02 00:04:48 I figure out the problem change file name AMA0 to S0 its start to work. userHeadPic umutcankalkan