LIDAR Lite v4 set up with PIXHAWK

hello ,
I have problem setting the parameter for lidar lite v4 in pixhawk .

Has anyone figured out what to set for the following parameter for lidar lite v4 ?
in the documentation is only wriiten about version 2 and 3 but not version 4.

RNGFND2_TYPE

RNGFND2_ADDR
@sbofill

Hello,
Being a relatively new version, there is no driver written yet for the Lidar Lite V4.
If you really want to use it now, you can interface to an Arduino that works at 3.5 volts (ProMini 328) and use Garmin Library to read I2C data and output to Tx at 115200 bps. This way it emulates a standard serial Lidar :

thanks,
Can I use it using PWM ? @ppoirier

Unfortunately, there is no PWM on the V4.

In any cases , here is the arduino code

#include <stdint.h>
#include <Wire.h>
#include “LIDARLite_v4LED.h”

LIDARLite_v4LED myLidarLite;

#define FAST_I2C

#define MonitorPin 3
#define TriggerPin 2

void setup()
{
// Initialize Arduino serial port (for display of ASCII output to PC)
Serial.begin(115200);

/// Initialize Arduino I2C (for communication to LidarLite)
Wire.begin();
#ifdef FAST_I2C
#if ARDUINO >= 157
Wire.setClock(400000UL); // Set I2C frequency to 400kHz (for Arduino Due)
#else
TWBR = ((F_CPU / 400000UL) - 16) / 2; // Set I2C frequency to 400kHz
#endif
#endif

digitalWrite(SCL, LOW);
digitalWrite(SDA, LOW);

// ----------------------------------------------------------------------
// Optional GPIO pin assignments for measurement triggering & monitoring
// ----------------------------------------------------------------------
pinMode(MonitorPin, INPUT);
pinMode(TriggerPin, OUTPUT);
digitalWrite(TriggerPin, LOW);

// ----------------------------------------------------------------------
// Optionally configure the LidarLite parameters to lend itself to
// various modes of operation by altering ‘configure’ input integer.
// See LIDARLite_v4LED.cpp for details.
// ----------------------------------------------------------------------
myLidarLite.configure(0);
}

void loop()
{
if (myLidarLite.getBusyFlag() == 0)
{
// Trigger the next range measurement
myLidarLite.takeRange();

   // Read new distance data from device registers
    Serial.println(myLidarLite.readDistance());
}

}

Thanks,
can you send me the Garmin library ?
then how to configure Arduino with mission planner ?

Garmin library is on Garmin github
As for config = look at my previous post.
Please note, this is advanced stuff and I am assuming that You know how hardware works and how to program an Arduino.

I have now the sensor working with arduino, How can I connect the arduino with the pixhawk? the wiring I know through telemetry,
I need the library and the code for arduino to enable communicating with pixhawk , .ino file ?
can you help me with that? @ppoirier

As I wrote above, you set your Flight Controller port with this (you can use any available serial port): [quote=“ppoirier, post:2, topic:52183”]

so you mean I should connect the telemetry cable to the serial4/5 on the pixhawk side ?
and connect the sensor to the arduino ? @ppoirier

Yes the connection is like this:
Lidar - I2C - Arduino - serial - PixHawk (available port)

Thanks,
I Connected and configure it with pixhawk,
it is working now.

1 Like

What pins should i use on the telem 2 port (i assume).

Would it be something like:
Vcc - Vcc
UART5_TX - RX (Arduino)
UART5_RX - TX (Arduino)
UART5_CTS -
UART5_RTS -
GND - GND

My knowledge is very poor please excuse me @ppoirier.

You dont need cts-rts for this.
Please refer to my existing thread on how to capture I2C and retransmit on Serial to th Flight Controller. You need to know how to program an Arduino for this.

Otherwise , it is easier to get a LidarLite V3 … if you want to stick to Garmin

@ppoirier are you refering to this:

[/quote]

Because i am asking about the physical pin connections not the pins within mission planner.

If its a different thread where can i find it?