Hi,
I am trying to integrate Delta 2A LIDAR with an Arduino UNO. I know that for a lot of reasons this is not the best idea as Arduino is not powerful enough to handle so much data from a LIDAR but I want to see how far I can go with building such a project and eventually moving to some more powerful board (MKR or Portenta).
Documentation is in Chinese but the translator helped a lot and I figured out how the frame ox HEX data starts (with AA, then there are 4 bits of frame length and some other constant values after that). After connecting the LIDAR to the computer with the UART converter and seeing the data through Serial Port Utility everything is fine, I can see what's expected based on documentation. So I started connecting that to Arduino. There is only TX, GND, and 5V to connect to Arduino and motor pins that I am powering with the lab bench power supply. I tried simply reading values from software serial and sending them to the normal serial port to see them in the serial monitor without success. Data looks different, I can't find the beginning of the frame, even sometimes there is AA and after that some kind of repeating pattern of values but not what I am looking for. Here is a code:
#include <SoftwareSerial.h>
SoftwareSerial ss(3,4);
void setup() {
ss.begin(230400);
Serial.begin(250000);
}
void loop() {
while(!ss.available()){}
Serial.print(ss.read(), HEX);
Serial.print(' ');
}
I thought that probably Arduino is not fast enough to handle reading and writing so fast so I tried reading 1000 values, storing those in an array, and after that printing to serial monitor without any success. Here is my code:
uint8_t table[1000];
void setup() {
Serial.begin(230400);
}
void loop() {
for(int a = 0; a < 1000; a++){
while(!Serial.available()){}
table[a] = Serial.read();
}
for(int a = 0; a < 1000; a++){
Serial.print(table[a], HEX);
Serial.print(' ');
delay(5);
}
}
Baud rate of LIDAR: 230400
It transmits data on it's own, you don't have to communicate with it (simplex). I spend really a lot of time trying to figure it out and experimenting with different settings. I wanted to give up but I feel like I am so close, probably there is just one stupid thing that I am doing work, and maybe it's not that hard to get it working.
Any help highly appriciated!
Have a nice day!