1

I'm having issues getting a pico to receive data from a Benewake TF03 Rangefinder LiDar distance sensor. The User guide/Documentation mentions it working from 5-24V and it uses low voltage (3.3V) TTL for UART so it seems perfect for working with Raspberry Pi Pico. I hooked it up (photo below) and set up some micropython which I am able to send restart and firmware version commands and receive the correct response via UART but I cannot get the device to send any distance data back.

In my code below the check firmware and system reset commands work and I get the correct response as defined in the product guide over UART (So I'm guessing the wiring is correct) but then the device isn't sending data at the default baud rate over UART the way the product guide suggests on pages 13/14/15. Am I missing something as to why no data is showing up in the while loop? How do I get the device to transmit data at the default baud rate?

Code:

from machine import Pin, I2C, UART
from ssd1306 import SSD1306_I2C
import framebuf
import time

# Initilize Serial Hardware Interfaces
lidar_uart = UART(0, 115200) # init with given baudrate
lidar_uart.init(115200, bits=8, parity=None, stop=1, tx=Pin(12), rx=Pin(13)) # init with given parameters

check_firmware_version_command = "\x5a\x04\x01\x5f" # Device sends back firmware version
system_reset_command = "\x5a\x04\x02\x60" # Device sends back success signal

lidar_uart.write(system_reset_command)
time.sleep(1)
data = lidar_uart.read()
print(data)

lidar_uart.write(check_firmware_version_command)
time.sleep(1)
data = lidar_uart.read()
print(data)


while True:
    time.sleep(0.1)
    if (lidar_uart.any() > 0):
        data = lidar_uart.read()
        print(data)

TF03 and Pico Board:

TF03 and Pico

  • Connected 5V VSYS to VCC of Lidar
  • Connected GND of Lidar to GND of Pico
  • TX of Lidar to UART0 RX of Pico (Pins 12 and 13 GPIO)
  • RX of Lidar to UART0 TX of Pico (Pins 12 and 13 GPIO)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.