A02 UART Controlled distance sensor issue

userHead KevinJuma 2022-09-13 20:21:38 2126 Views11 Replies

Hi everyone,
I need help making an A02 UART controlled distance sensor to work with a Raspberry Pi 2.
I have enabled UART by following the procedure to enable the serial ports BCM 14 and 15.

I have confirmed that the TX and RX connectors are connected o the right ports. Swapping them still gets me the error below.

When I connect the sensor and run the sample demo script from DFRobot I only get the following results:

“No data!”



Is there something I have not done?
 

2023-01-09 04:02:45

I found the solution to this.Since this is a UART-controlled sensor, all I had to do is send an initiate bit to the controller to get a reading. Works flawlessly with a very simple script. This is a great sensor, will definately work in my implementation now!! Thanks for the resolution effort Jenna, I appreciate you!

userHeadPic KevinJuma
2023-01-08 22:15:26

I just noticed something interesting.If I disconnect and then reconnect the sensor I get a single measurement like below

 

 

I checked from the vendor I bought this from and I see this description for my particular sensor

 

My sensor is the UART controlled one. Is there something I need to modify to allow me to trigger a distance measurement?I will appreciate any help I can get.

userHeadPic KevinJuma
2023-01-08 22:11:23

Hi Jenna,Thanks for the pointers. I changes all these but still get “No data”

userHeadPic KevinJuma
2022-11-03 10:17:19

Hi! 

We updated the library and tested fine with Raspberry 4B and Raspberry 3B. 

Please update the library, change the file according to the following figure, and restart the Raspberry Pi.The configuration for Raspberry 4B and Raspberry 3B is the same.

 

If there is still no data, please modify and save the file as shown below, and restart the Raspberry Pi.

userHeadPic jenna
2022-10-25 16:16:56

Please try again and contact us if you have any questions.

userHeadPic jenna
2022-10-25 15:59:46

Hi! After entering the cmd command “ls /dev -al ” , does it return such a result? If you have a USB-to-TTL-to-serial module, you can try to connect a PC and a Raspberry Pi 4, and check the data transmission and reception through the serial debugging assistants of the two platforms.

 

userHeadPic jenna
2022-10-22 05:08:20

Just bumping this if anyone has ideas on how I can use a A02YY UART Controlled distance sensor with a Raspberry PI4.

userHeadPic KevinJuma
2022-09-20 02:41:52

Also is there a way to check if the sensor is detected on the ports I have connected it to?

userHeadPic KevinJuma
2022-09-20 02:39:15

Just to confirm that I have the UART CONTROLLED version not the AUTOMATIC version, so could there be something I am meant to do like send a trigger pulse?

userHeadPic KevinJuma
2022-09-20 02:37:44

Thanks, @embeddedprogrammer.I have tried the above but with no success. I still get the “No data” response.Any thing else I can try?

userHeadPic KevinJuma
2022-09-14 03:35:28

You have to enable UART in /boot/config.txt with the following two lines at the end

 

enable_uart=1dtoverlay=disable-bt

 

and use python3 demo_get_distance.pynot python2 demo_get_distance.py to start the program

you may need to install pyserial

userHeadPic embeddedprogrammer