$15 360 degree XV proximity lidar

Yes i did… no clue on what’s going on

can you paste the full error message?

make sure you extract these into their own folders in the arduino libraries folder
xv11lidar-Library.zip (9.1 KB)
Arduino-PID-Library.zip (10.3 KB)

It compiled with the attached files… seams like analogWriteFrequency function on line 34 is commented out… in this… :slight_smile:
I used the version in your git page, which is 5years old… the attached xv11lidar lib seams to been updated 2023-08-10.

all good now…
Thanks for the help

1 Like

I must have made changes to it that I forgot about, I have uploaded the files to github. I think its because the library was made for a teensy board originally, so i must have made changes to get it to work on the stm32F3 and RP2040

I think i have to play around with the PID settings because the rotation starts, but often turns off after a couple of seconds. You can then rotate it manually to help it start again… and sometimes it keeps running, sometimes not….
Been looking on the pwm signalling with an oscilloscope, and it seams the PID routine is the culprit.


Yellow pwm signal from rp2040, green is collector of transistor. Here it looks like expexted. But othertimes you can see the PWM slowly droping to 0% duty cycle… I.e stopping the motor.

I believe there is a check in the library to see if its getting data from the lidar, if it doesnt then it stops the motor after a while, is the RP2040 getting serial data from the lidar when its spinning?

Yes, I get data… at least at some times as i have seen varying serial output by enable the debug prints… I will connect a 3rd channel to the lidar tx and see if its there continiously…
My gut feeling was otherwise that there was to much resistance in the rotation and that the pid-settings was not optimised for this system setup.
The pid values of 1.0 0.5 0 in this lib, even in the original version seams to be the pure defaults… so there might be room for some tuning…

How are you switching the motor? Is it just a transistor /resistor? When i was using the stm32 chip and the transistor module it would sometimes not start like you describe, like it needed more voltage but since i changed it to the rp2040 and transistor/resistor its been very reliable.

I built another one yesterday from scratch so the software and instructions are accurate.

Yep… exactly as my drawings… at first i suspected that the transistor did not bottom out and was not coopimg with the current, thatd the reason for the oschiloscope measurements… to see of the transistor was able to pull the motor current reasonable close to the ground potential. But the measurements show that this was not the issue…

My suspicion is that my built specimin has a little higher friction than normal… and thats why my unit behaves like it does… all assumptions… but… :slight_smile: that might be why these are availible cheap… rejects from production ?

When you switch it on it will spin the motor slowly until it receives data then it starts the pid to hold speed. If it doesnt receive anything it just stops.

It sounds like its not receiving data from the lidar.

I think they are all used. One of mine arrived with a plastic standoff broken lose internally, I just glued it back together.

Ahh… that it also a plausable thought…
Will experiment some more when time is availible… :slight_smile:

I will look at the code again. Il try and add something to show if lidar data is being received like blink the led

If i remeber right iwe seen some notes somewhere that the lidar dors not produce data until it spins at an acceptable rpm… so some debug ouput about spinrate and pwm values was something i was thinking of…

You wont get that unless its working as the lidar reports its rpm via the serial link to the rp2040.

It starts at low speed and will not keep spinning using pid unless its getting data as the rpm comes from the lidar.

Attach a usb serial to the lidar data pin to check if its putting out data.

Hello again!

While waiting for parts to arrive, are there any datasheets for the xiaomi lidar? Just want to get some info about the laser “FOV” and other… i wonder how low would i need to mount it so it detects road curbs, the place i have for it is around 17 cm off the ground, wchich could be a little bit too high…

No as it was never sold on its own, its part of a vaccume cleaner. So all information on it is reverse engineered. It has a very narrow vertical fov its basically a laser dot.

1 Like

I have made a version that uses the RGB LED on the RP-2040 board.

When you apply power the led will turn red, once it receives data from the LIDAR it will turn green. if it doesnt turn green then its a communications problem between the lidar and the RP-2040.

You will need to install the RGB library I uploaded also as the built in led is a bit different.

I have been doing more research as I cannot remember where I read that the 1s version was the 3.3v version. it’s possible I’m mistaken , It was the 3.3v version of the XV lidar that I fried, not Xiaomi… I’m finding places selling the lidar saying they are compatible with the 3 versions so I might be wrong about it being 3.3v

Suitable models: Xiaomi Mi Robot 1s 1st SDJQR01RR SDJQR02RR SDJQR03RR Robot

https://www.amazon.co.uk/BKNOWN-Compatible-SDJQR01RR-SDJQR02RR-SDJQR03RR/dp/B0BQDBBDR9

can you post a photo of the bottom of your Lidar so i can compare it to the one i have to see if there is actually a difference between them, the seller might just be listing the same module with 2 names.