Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

Can't read LiDaR data with RMTT

ExcellentBadger

Active member
Joined
Nov 7, 2021
Messages
25
Reaction score
0
I have this component and I'm connecting a lidar to it. My lidar has its i2c pins connected to IO27 and IO26, how would I code this using the Arduino.cc app? These are GPIO pins and I have no idea how to code them. Nothing is being printed out onto the arduino serial monitor when I run that bare code. What do I replace the numbers inside Wire.begin(33,32) so that it is relevant to the wiring I did? I have to use the arduino app or python to code this, so I cannot use the mind+ app

Code:
```
#include <Wire.h>

#include <SparkFun_VL53L5CX_Library.h> //http://librarymanager/All#SparkFun_VL53L5CX

SparkFun_VL53L5CX myImager;
VL53L5CX_ResultsData measurementData; // Result data class structure, 1356 byes of RAM

int imageResolution = 0; //Used to pretty print output
int imageWidth = 0; //Used to pretty print output

void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println("SparkFun VL53L5CX Imager Example");

//Note: The following line will fail to compile if your platform does not have multiple Wire ports
Wire1.begin(33, 32); //(SDA, SCL) on ESP32. This resets I2C bus to 100kHz
Wire1.setClock(400000); //Sensor has max I2C freq of 400kHz

Serial.println("Initializing sensor board at address 0x3C on Wire port Wire1. This can take up to 10s. Please wait.");

if (myImager.begin(0x29, Wire1) == false) //Device address (0x29 is default), Wire port
{
Serial.println(F("Sensor not found - check your wiring. Freezing"));
while (1) ;
}

myImager.setResolution(8 * 8); //Enable all 64 pads

imageResolution = myImager.getResolution(); //Query sensor for current resolution - either 4x4 or 8x8
imageWidth = sqrt(imageResolution); //Calculate printing width

myImager.startRanging();
}

void loop()
{
//Poll sensor for new data
if (myImager.isDataReady() == true)
{
if (myImager.getRangingData(&measurementData)) //Read distance data into array
{
//The ST library returns the data transposed from zone mapping shown in datasheet
//Pretty-print data with increasing y, decreasing x to reflect reality
for (int y = 0 ; y <= imageWidth * (imageWidth - 1) ; y += imageWidth)
{
for (int x = imageWidth - 1 ; x >= 0 ; x--)
{
Serial.print("\t");
Serial.print(measurementData.distance_mm[x + y]);
}
Serial.println();
}
Serial.println();
}
}

delay(5); //Small delay between polling
}
```

this is a robot master tt btw
 
We are not experts on this, but have been playing the RMTT now for a year. it is very quickly First I wood recommend using the Mind+ to setup on we show in a recent video on Youtube channel MECATX. Download the serial drivers.. Once that tis done, I guess you would have to find a way with the user interface to recognize your Lidar sensor. You should be able to use the Arduino code in the terminal block. DFROBOT controls the Mind+. They sell two L:IDAR devices. One very cheap. Maybe worth getting one to learn how they are doing it. There is a very good video on youtube showing these LIDAR device. We are going to do this after we finish our present project with IR remote. I hope this helps. We have found that Min d+ seems to be the door into the RMTT open source controller and the extension board.
 
...how would I code this using the Arduino.cc app?
...
Code:
```
#include <Wire.h>

#include <SparkFun_VL53L5CX_Library.h> //http://librarymanager/All#SparkFun_VL53L5CX

SparkFun_VL53L5CX myImager;

...

this is a robot master tt btw

As you seem to use the libraries written for "Arduino like" microcontrollers, it will probably not work without changes on the ESP32, on which the RMTT expansion is based.

Here you find a description from DFRobot, providing a library as well together with hints, how the code must be modified in order to run on ESP32:

 
...


As you seem to use the libraries written for "Arduino like" microcontrollers, it will probably not work without changes on the ESP32, on which the RMTT expansion is based.

Here you find a description from DFRobot, providing a library as well together with hints, how the code must be modified in order to run on ESP32:

Oh I see, it doesn't define which pins the SDA and scl are connected to. To which gpio pins do i connect SDA and scl to on the expansion board? Is GPIO26 and GPIO26 the default i2c? Also, I don't have a lidar from dfrobot but from a different company, will that change anything?
 

Members online

Forum statistics

Threads
5,697
Messages
39,957
Members
17,056
Latest member
97bugsinthecode