LightWare SF20 / LW20

The Lightware SF20 and LW20 are small but long range (100m) and accurate range finders. There are two models, the LW20/Ser which uses a serial interface and LW20/I2C which uses an I2C interface.

../_images/lightware-lw20.png

Serial connection

For a serial connection you can use any spare UART. Connect the RX line of the UART to the TX line of the Lidar, and the TX line of the UART to the RX line of the Lidar. Also connect the GND and 5V lines. You do not need flow control pins.

The diagram below shows how to connect to SERIAL4.

../_images/pixhawk-lightware-lw20-serial.jpg

If using the caseless SF20 ensure the cable looks like below:

../_images/lightware-lw20-serial-cable.png

You then need to setup the serial port and rangefinder parameters. If you have used the SERIAL4/5 port on the Pixhawk then you would set the following parameters if its the first rangefinder in the system (this can be done using the Mission Planner Config/Tuning | Full Parameter List page):

  • SERIAL4_PROTOCOL = 9 (Lidar)

  • SERIAL4_BAUD = 115 (115200 baud) for newer sensors, 19 (19200 baud) for sensors manufactured before mid 2018

  • RNGFND1_TYPE = 8 (LightWareSerial)

  • RNGFND1_SCALING = 1

  • RNGFND1_MIN_CM = 5

  • RNGFND1_MAX_CM = 9500. This is the distance in centimeters that the rangefinder can reliably read.

  • RNGFND1_GNDCLEAR = 10 or more accurately the distance in centimetres from the range finder to the ground when the vehicle is landed. This value depends on how you have mounted the rangefinder.

If you instead were using the Telem2 port on the Pixhawk then you would set SERIAL2_PROTOCOL = 9, and SERIAL2_BAUD to 115 (115200 baud) or 19 (19200 baud)

Note that you may need to use a separate 5V power supply for the Lidar on some flight boards. Refer to the power consumption in the manual for the Lidar and the limits for peripheral power on your autopilot.

I2C connection

Connect the SDA line of the Lidar to the SDA line of the I2C port on the Pixhawk, and the SCL line of the Lidar to the SCL line of the I2C port. Also connect the GND and 5V lines.

../_images/pixhawk-lightware-lw20-i2c.jpg

If using the caseless SF20 ensure the cable looks like below:

../_images/lightware-lw20-i2c-cable.png

You then need to configure the rangefinder parameters as shown below (this cn be done suing the Mission Planner Config/Tuning | Full Parameter List page):

  • RNGFND1_TYPE = 7 (LightWareI2C)

  • RNGFND1_ADDR = 102 (I2C Address of lidar in decimal). Note that this setting is in decimal. The default address is 0x66 hexadecimal which is 102 in decimal.

  • RNGFND1_SCALING = 1

  • RNGFND1_MIN_CM = 5

  • RNGFND1_MAX_CM = 9500. This is the distance in centimeters that the rangefinder can reliably read.

  • RNGFND1_GNDCLEAR = 10 or more accurately the distance in centimetres from the range finder to the ground when the vehicle is landed. This value depends on how you have mounted the rangefinder.

Testing the sensor

Distances read by the sensor can be seen in the Mission Planner’s Flight Data screen’s Status tab. Look closely for “sonarrange”.

../_images/mp_rangefinder_lidarlite_testing.jpg