Handheld XV-11 LIDAR with STM32F429
HTML-код
- Опубликовано: 15 сен 2024
- With the Neato XV-11 LIDAR Laser Range scanner connected to the STM32F429 DISCOVERY board we've made a handheld and wireless laser scanner for measuring distances.
The 360-degree distance measurements is both shown on the LCD display and wirelessly (Bluetooth) sent to a PC for display using MATLAB.
Furthermore the Touch display can be used to select two points and measure the distance between them, therefor using the handheld system to measure a room quite accurately.
Please find more information about the sensor, the project and the source code at our blog:
blog.tkjelectro...
I got the STM32F7 discovery board! It's neat what to see even the M4 chip can do. Now to imagine the M7 is about double the performance is quite exciting.
Very nice project! I was looking around for ideas on how to implement Lidar on my multicopter for 3d mapping. Thumbs up for this awesome project.
Very impressive software by the way, you did a good job getting it working!
I think this is the closest thing to a minimap I have ever seen. so awesome
Very FUTURISTIC. Am I saying this from 2018 ;) Really dazzling. GR8T job. Cheers!
The rotational speed of the LIDAR is around 300 RPM.
what company is this made from?
It is a spare part for the XV-11 robot vacuum cleaner made by Neato.
HA I HAVE DONE LIKE THIS last year. but my bluetooth will lost package.
Fantastic demo, all the best with your future research.
wow I might build one, until I will find a job :) awesome work!!
Awesome!!! Really cool project!
Wow!!! This is awesome! I need one now :) Thanks for sharing!
Cool. Reminds me this green handheld motion tracking radar from movie Aliens!!
This looks awesome!. good job.
hi touching the pins can be dangerous for Electro static discharge reason?
How did you communicate with matlab?
that is soooo cool!!
can this be done with a regular laser pointer with a motor like what you have there??
so cool!
hi bro did u use the yellow electrical wire for Tx --> Rx and u put the RX on the pin pC11 ?? and what about the two red and the two black wires where did u put them ????
Is it possible for you to share the coding that you used for mapping?? I would really appreciate it
Thank you
nice job, what's the frequency of the lidar rotation? thanks
Just a suggestion but if you some how connected to LIDAR scanner directly to a smart phone which should have much better RAM and processing power than the setup you have now
Depends on the application. If you have a specific application that requires heavy processing of the LiDAR data such as point cloud algorithms or SLAM then you might be better of using a better processor or smartphone.
Would it speed up the image of the normal room or no?
No, it will not. The refresh rate of the image is not due to the processor performance.
The LiDAR sensor itself only provide angular measurements at a rate of 5 Hz, so the picture can only be updated at this rate.
I got a quiet simple question, Where did you found the STM32.tcl or the Support Package for the STM32F429I discovery board ?
Thanks by advance.
+popotubeyou We didn't use any tcl or Support Package for the board. I used the HAL library from ST including the LCD driver.
For easy generation (similar to using or generating a Board Support Package) I recommend you to have a look at the STM32CubeMX generator software from ST.
this could be the beginning of "DETECTNOLOGY"
nice projects and idea.. can u tell me the title of the song in the last sec of video..? thx
Great.
Cool!
excellent work ....
pls help on following points....
1) is lidar A1M8 compatible with xv lidar controller ?
2)u have used bluetooth to send data to computer ...can you pls tell me how...exactly it is done
3)from which website should i buy this stuff
1) No, the RPLiDAR (A1M8) is not compatible/equal to the XV LiDAR and thus not compatible with this project out of the box.
2) The LiDAR data is received and processed in the STM32 processor and stored in RAM. The processed data is then transferred over UART to the Bluetooth module which is connected to a PC emulating a Serial Port (using SPP).
3) I have purchased my XV LiDAR on eBay for around $100 USD
hi bro, my neato clean only corner not clean center my room tell me please ,what problem what i do??
I want to the pin connector diagram of the project!!Could you give me please? I use the RPLIDAR but it isn't active :(
Which RPLiDAR version do you have? Please see the wiring description in the bottom of this blog post: blog.tkjelectronics.dk/2014/08/handheld-xv-11-lidar-with-stm32f429-and-matlab
Well done bro !!
Which IDE do you use for coding in the STM32F4 Microcontroller??
TizanaMenYo CooCox CoIDE
Do you recommend a course/website/tutorials to learn more about programming with stm32 platform? Watching your github I see that in highschool they dont teach a lot of stuff that is in there...
ST Microelectronics has some good Getting Started guides and videos which I suggest you to start with: www.st.com/content/st_com/en/support/learning/stm32-education/stm32-step-by-step.html
I have also found the following blog very useful: stm32f4-discovery.net/
Awesome for a roomba
How does the lidar unit itself function? Can you dismantle it and show us what they've got inside?
+James A. McGuire Please see the following disassembly of the XV-11 robot to find pictures and more information about the LiDAR unit: www.sparkfun.com/news/490
Further pictures can also be seen here: www.robotshop.com/blog/en/neato-xv-11-disassembly-see-the-guts-of-your-robotic-vacuum-978
I also tried in open space with enough natural light. I am getting similar data.
Omg i want one please make a video on how to make it or better yet make kits and ill buy one
Hi! Sadly, your blog is down at the moment..I also received this unit, but have some problems. All readings (except for approx. 1 second during spin-up of the motor) have the bad-data-flag set, otherwise I can read out and decode the packets just fine, so protocol and connection are good. Do you have any suggestions, or did you also experience this behavior at some point?
Saying that it works for the first second while it spins up indicates to me that this issue might be related to a synchronization problem.
How are you powering and controlling the speed of the DC motor? If you power it directly from a battery or voltage supply without any speed controller you have to be aware that the motor easily makes the unit spin too quickly.
In my blog post I described how connecting the DC motor to the 3.3V supply would limit the speed and reduce the likelihood of the synchronization issue.
I tried connecting the motor to a stabilized 3.3v/3v-source, as well as spinning it exactly at 300rpm using pwm-control based on the speed-information of the packets I received from the scanner. The turnrate is rocksolid at 300rpm +- 0.5rpm. I am receiving clean and uncorrupted packets all the time, so this is no issue at all, it's just that (except for this brief 1-second period during startup) the bad-data flag is set all the time.
have you try saving the connected contours of what makes your room ? this was you can actively use that map for survey ? while your lidar will still be on doing its updates on the room and any new moving objects
Hi. Its not just a matter of saving the contour. It is a highly intensive mathematical procedure called SLAM.
But no, I haven't tried this.
Regards Thomas
mindthomas well is not math if you already got the data, all you need to do is use a program that can take those values and convert into a array of vectors therefor displaying the already scanned imaged "saved data" so if anything this will be an addition program that will run aside with this hand held. just store data in a file that the second program can grab and read C# can do this in visual studio or Processing
+Frank Lopez But the origo of these vectors needs to be adjusted while you walk around - just like LIDAR with GPS.
Please search for LIDAR and SLAM on RUclips for more practical information.
mindthomas i understand your view but do understand that your talking about one of many types of approach. this can be taken care of by using a imu module $2 and match that imu to the handheld and link that imu data to the actual program reading the saved map values, doing this update of reading constantly will translate into a moving map thats match where your pointing your device to
hi thank u for the video i wanna a Lidar like this and i don't know how much it is and don't know where can i get it
Neato XV-11 modules runs for about $100 on eg. eBay.
See eg. www.ebay.com/itm/NEATO-XV-11-12-14-21-SIGNATURE-VACUUM-LIDAR-LASER-DISTANCE-SENSOR-ORIGINAL-PART-/352008156403
yeah。 I have done this this year
Have you used a TTL adapter for lidar data?
No. That is not needed as I am using the STM32 processor running at 3.3V
круто.. лидары обычно очень дорогие..
hi, is it matlab on pc?
Yes
Which gui builder did you use? for Stm32f429 lcd
No GUI builder has been used. The graphics you see is programmed in C++ using the graphics library functions provided by ST.
Thank you sir.
Any blog with steps for visualize graphic in PC with Python?
We haven't done such. But by doing a quick Google search I stumpled upon this: matplotlib.org/
I think this is what you are looking for.
Is this device runs only with a matlab script ?
No. The embedded device itself, the STM32, is programmed in C - so no MATLAB running here.
MATLAB is only used on the computer to actually display the polar plot of the distance measurements - not doing anything else, nor any parsing of the actual XV-11 data either, as this is all done on the STM32.
mindthomas
Nice , great job
Can you please share the source code? I just picked up one of these lidar sensors and would love to replicate this on my stm32f429
Yes, I will soon be publishing a blog-post about the project including the source code and CoIDE project.
The source code has now been uploaded and can be found thru our blog. Please see the video description.
mindthomas Awesome, thank you very much!
@@sedwardstx can you help me about this project please steve edwards
hello Which software format did you use the sensor for?
What do you mean? Do you ask about the LiDAR to microprocessor protocol or the wireless protocol to the PC over Bluetooth for visualization?
Various software formats available for the lidar sensor
((((((I am using this code))))))
%% Matlab script for read and plot VX-11 lidar data
% V0.22 New
% Author: Cheng-Lung Lee
% Date: 2010/11/24
%
% Testing with this LDS
% Piccolo Laser Distance Scanner
% Copyright (c) 2009-2010 Neato Robotics, Inc.
% All Rights Reserved
%
% Loader V2.4.13386
% CPU F2802x/c600
% Serial AAA42110AA-0003662
% LastCal [2010182117]
% Runtime V2.4.13386
fid = serial('COM13','BaudRate',115200);
set(fid,'InputBufferSize',400000) % Set serial buffer size >(6+360x4)*2=2892 byte
set(fid,'Timeout',1) % Set read Timeout in 1 sec
fopen(fid)
%fclose(fid);
%% local loop back to test serial port
% fid_fake_data = fopen('XV11_NoShiled.bin'); % read data from sparkfun binary format
% for i=1:20
% tx_data=fread(fid_fake_data , 200, 'uint8' );
% fwrite(fid,tx_data,'uint8');
% end
%% Setup plot for lidar
figure(1);
lidarplot=plot(zeros(1,360),zeros(1,360),'.'),% plot something
axis equal,axis([-2000 2000 -2000 2000]),grid on
xlabel('X mm'),ylabel('Y mm')
drawnow
pause(.1)
%% Start read serial port
index=0;
deg4index=0;
XV11_Status=0; % 0~3 search for header, 4 has header, 5 timout/error.
data=zeros(2,4,'uint16');
Ddata=zeros(1,360,'uint16');
Rdata=zeros(1,360,'uint16');
if fid.BytesAvailable>0
fread(fid, fid.BytesAvailable, 'uint8');
end
while(XV11_Status=(22))
deg4index=fread(fid, 1, 'uint8' )-hex2dec('A0'); %1 byte index & unknow flag
speed=fread(fid, 1, 'uint16' ); % encoder ticks
data(:)=fread(fid, 8, 'uint16' ); % 8 byte distance data and 8 byte reflectivity or uncertainty
Checksum=fread(fid, 1, 'uint16' ); % check next header
nextheader=fread(fid, 1, 'uint8' ); % check next header
if(nextheader==hex2dec('FA'))
Ddata(deg4index*4+1:deg4index*4+4)=data(1,:);
Rdata(deg4index*4+1:deg4index*4+4)=data(2,:);
else
XV11_Status=0;
end
% like LMS200 lidar, most likely XV-11 only use 13
% bits for distance, bit 14 and 15 are flag for
% data quality and sensor information
% try to read flag here
%bit14flag=bitand(data(1,360),uint16(hex2dec('4000')*ones(1,360)))>0
%bit15flag=bitand(data(1,360),uint16(hex2dec('8000')*ones(1,360)))>0
deg4index+1; % count from 0 to 89
if (deg4index==89)
index=index+1;
dist=bitand(Ddata(1,:),uint16(hex2dec('3FFF')*ones(1,360))); %mask out bit 14 and 15
[X,Y] = pol2cart(0:2*pi/360:2*pi*(1-1/360),double(dist));
% plot(X,Y,'.'),axis equal,axis([-500 500 -500 500]),
title(['Scan: ' num2str(index)])
set(lidarplot,'xdata',X,'ydata',Y);
drawnow
%pause(.01),
end
end
case 4
%
otherwise
XV11_Status=0;
end
end
fclose(fid);
dam do you know of any links that does this but for Arduino and Processing or c#/c++ ?
+Sys.stem You can do a similar thing with an Arduino, but the processor ressources will be quite loaded due to the many samples.
TKJ Electronics how bout the samples gets BT to a pc and result sent back to the processing window, i dont care about the actual handheld this is just a approach to let the bot know its map then work out a best avoidance and route from point A to B
TKJ Electronics what would be the pseudo code for something like this ?
I want to learn stm 32 can you help me how to get started please helpmeee
You can find a lot of courses from At website.
What is is maximum detectable range? by the way, I like ur German accent:)
+YSTech2010
The range is around 0.2m to 6m.
Thanks but no thanks. I am actually Danish so please don't compare my accent to the germans ;-)
Haha, Danish is even better! XD
hi body. you stole my dreams. :) really congurulations. its perfect i think but ı am wondering that how do you show on the screen??? is it your code or is there any precode designed code and one more thing. as well you say lidar sensor very expensive how can ı procure cheaper this sensor
The graphics library to get the display on the STM32F4 board up and running is provided by ST for free (included in the CubeMX IDE from where you can generate startup files and the project).
This library contains the most general drawing functions as setting pixels, drawing lines, writing text etc. For any more advanced graphics you would have to write your own library.
This is one of the cheaper LiDAR units that you should be able to buy on eBay etc. for about $100-$150 USD.
TKJ Electronics thanks a lot.
I wish you continued success.
How accurate is the resolution ?
1 degree, but with quite some dropouts. So maybe only an effective resolution of 3-5 degree at every revolution of 5 Hz.
Stupid question: are the degrees (0-360) set as a fixed positions on the LiDAR? For example if I set it down facing one direction, will the packet containing the data for degree angle 0 be a constant poll of the same position in space?
Of course not the same position in space as this is another reference frame than the one which the LiDAR is attached to.
The sensor data is provided in a reference frame defined by the LiDAR itself. So the data will be oriented as the LiDAR is pointing.
Then you can do filtering and sensor fusion to combine the LiDAR data with a gyroscope and/or magnetometer to get estimate the current orientation and use that to map the LiDAR angle readings.
Could you show me the full Matlab code?
The MATLAB code can be found here: github.com/TKJElectronics/XV11Lidar_STM32F429/blob/master/DisplayLIDAR.m
@@mindthomas so also can you share your Arm codes ? and thanks this awesome project.
Hi, as far as I am concerned, that is a wonderful Project to implement. However, I need your help to comprehend how bluetooth modul Works with MATLAB. May I kindly request your e-mail?
Sincerely...
The Bluetooth module used in this video (HC-05) works as a Virtual Serial Port when paired to the computer. This allows me to open this serial port and read the incoming data in MATLAB using the serial port object: se.mathworks.com/help/matlab/serial-port-devices.html
What dev environment is that?
The STM32 code was developed in the Eclipse-based CooCox CoIDE. Today I would however suggest to use the System Workbench for STM32 (SW4STM32) which is also Eclipse-based but with with a wider and more recent list of supported devices. SW4STM32 is limited to STM32 devices though, whereof CoIDE supports multiple ARM families from eg. NXP/Freescale, Texas Instruments, ST etc.
The visualization is done with MATLAB which processes the incoming Bluetooth packages.
Thanks, is the programming language C? Are there libraries or do you need to poke the hardware directly?
Yes. SW4STM32 uses the GNU-GCC compiler. For STM32 devices I recommend to use the HAL library or the LL library (for space constrained projects).
To get started I suggest you try the CubeMX to generate the project files including the necessary libraries. This generator is able to generate project files for the SW4STM32 IDE.
CubeMX is incredible, schematics, even timings, and that auto project creation is very well made. I'll try programming. Is there a simulator? Also have you used an Arduino? If so how does the programming compare?
Hi, I am using arduino uno and xv lidar sensor in my project.I provide communication between arduino uno and matlab with arduino ıo matlab.
#include
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200); //seri haberleşme başlangıç
while (!Serial) { //
; // wait for serial port to connect. Needed for native USB port only
}
mySerial.begin(115200);
}
void loop()
{
if(mySerial.available()) //
{
byte in = mySerial.read();
delay(1);
Serial.println(in, HEX);
}
}
I can get data from the sensor with the above codes
But I do not know how to use this data I read.
I am transferring serial data but how can I calculate the distance?
If you answer me, please.
Just reading a single byte and then waiting will not work. The bytes that comes from the XV11 comes in a packed format so you will have to read a whole package and decode the content, after checking and confirming the validity of the package using the checksum.
Cool!