DIY LiDAR scanner using the LW20 and a digital servo

Making a small, low cost laser scanner for sense-and-avoid applications has been a objective of mine for several years. What makes this project challenging is the cost and complexity associated with motors and their drivers to provide the motion, position encoders to provide accurate aiming information and slip rings to pass the signals through the moving parts.

In a typically anarchistic response to these limitations, we decided to throw out all of these parts and start again with a simple, low cost, digital servo bolted directly onto an LW20 LiDAR. I've used the DS-919MG servo from Corona for this example although most digital servos will work.

The servo doesn't go all the way around, so the field of view is limited. For a forward looking sensor this is a reasonable limitation, given that it is so inexpensive, small and the whole system only weighs 50g.

It is simple to connect up the LW20 to a servo because the hardware and software drivers are built in. There is one wire that connects to the PWM control line of the servo and we used a separate power supply for the servo because they tend to be noisy on the power rail.

Through the comms port (serial or I2C) of the LW20, the servo can be told to aim in any direction. There is also a command to switch on fully automatic scanning.

To make an energy efficient scanner it is nice to be able to scan in two directions (clockwise and anti-clockwise) in a continuously reciprocating movement. Unfortunately, low cost servos are notoriously tricky to use in this way because their internal control systems are designed to aim the servo in a static direction. If you try to change the aiming angle of a servo before the shaft stops moving then the shaft position always lags behind the requested aiming position.

For most applications, "servo lag" isn't a problem because the servo moves quite fast. However, the LW20 is updating 388 times a second and this is on the limit of how fast a conventional servo can accept changes in position. The result is that the position of the scanned image from a CW scan is slightly different from that of the ACW scan.

You can see the lag in the image below where the black line is the ACW data and the orange line is the CW data. The data points in this image have been thinned out to avoid clutter but the actual number of points in each scan is much higher.

Fortunately for us, the LW20 driver software includes compensation for the servo lag and with a few tries it can be eliminated almost entirely.

For the purists out there who want precise angular data, there is also a uni-directional scan available as an option in the software. This eliminates the lag problem altogether but the servo draws a lot more power when it is returning to the start position.

To help with setting up a servo driven LiDAR, our software genius, Rob, has provided a fully interactive GUI that lets you put in settings, add 2 dimensional alarm zones, eliminate fixed obstacles like landing legs and generally have a lot of fun. This GUI is part of the LightWare Terminal application that you can download for free.

A final word about the performance of this system. The LW20 is a very powerful LiDAR module so I had no problem getting good maps out well beyond 50m with some points reaching 100m. I was also able to use the first signal / last signal capability to capture both nearby obstacles and more remote surfaces at the same time while looking through trees and long grass at a shallow angle. In the image below, the blue data is first return and the orange data is last return.

For more information about the LW20 you can check out the LightWare website.

Views: 3842

Comment by graham newton on February 20, 2017 at 12:12pm

Wow! Amazing work guys

Comment by JB on February 21, 2017 at 2:17am

Great stuff LD. Might need to give this a try.

Is it possible to do the same with a SF11 model?

Also would mounting a 9axis sensor on the LW20 help with scanning accuracy/tuning?

Comment by Laser Developer on February 21, 2017 at 6:57am

@ JB - The SF11/C doesn't run as fast as the LW20 so it's not as suitable for mapping or collision avoidance.

We put a multi-axis sensor in our prototype LW20's along with a bunch of other stuff that you might normally find in the flight controller. It was a lot of work doing the integration with the laser data so we decided to leave this out on the production units. It's not clear which way sensor fusion is heading but one thing is for certain - we will keep trying out different things to bring the best products that we can to our customers :).

Comment by Thomas Stone on February 21, 2017 at 10:58am

Nice! Simpler mechanics is always better. 

Comment by JB on February 22, 2017 at 5:11am

Thx for the info LD. Will have to budget for a LW20 then!

I think all technology can be improved with convergence. I was pretty sure you had already tried it. :-)

Are you thinking of using an optical gimbal (or MEMS) in future products? With the scanning method above are you relying on positional accuracy of the actuator (servo) for measurements or just the rotation velocity of the servo between endpoints?

Comment by Laser Developer on February 22, 2017 at 6:36am

@JB - Yes, we have investigated optical beam steering using MEMS devices and whilst these are suitable for some high end projects they are way too expensive for to put into a small, lightweight system.

The absolute angular accuracy of the LW20 depends on how good the servo is at holding a constant speed and how linear the position potentiometer is. In our initial testing we looked at the static and dynamic characteristics of a bunch of servos and were amazed by how good they were. It's possible that these results were helped by the very light loading of the LW20 when compared with the high torque of the servos.

For obstacle avoidance a small amount of image distortion isn't an issue but if you want to make a precision mapping system then obviously it's important to select a good quality servo. We were able to make a noticeable improvement in some of the servos by stripping them and re-greasing the gears to remove any dry spots that caused chatter.

Comment by Muhammad Al-Rawi on February 22, 2017 at 7:15am
+1 for re-greasing servo gears. I've done this to my FPV pan/tilt and it turns much smoother. I cleaned off all the old stuff (silicone grease?) and used white lithium. Just what I had laying round.
Comment by Sergey on February 23, 2017 at 8:07am

Very nice device!

Btw, what would be a stable measurment range of LW20 on full 388 readings/s speed? Or other way - will LW20 be able to measure up to 100m with good reflecting surfaces on the full output rate speed of 388Hz?

Comment by Gary McCray on February 23, 2017 at 3:15pm

Hi LD,

Great application and these little high res, high speed rangefinders are perfect for it.

A problem I have found is gear lash, some servos are worse than others - cheap Chinese ones for instance, but lash is always a problem especially when you need exact positioning and are reversing, my guess is most of the two way scan problem is from gear lash which allows cumulative tooth offset for each gear in the gear train each time you change direction.

It is amazing they work as well as they do.

I have found light Teflon containing synthetic oils/greases to work best such as Superlube with "Syncolon" (their version of Teflon.)

Definitely will implement this myself.



Comment by Laser Developer on February 24, 2017 at 2:56am

@Sergey - From our tests on an cloudy day we see about a 10% reduction in the signal strength when changing from 48 readings per second to 388 readings per second. The LW20 will still easily measure our reference wall 110m away but the results are more variable due to the lower signal-to-noise ratio.

I must stress that this result is on a cloudy day with one sample unit only. There will be some variability in the absolute maximum performance of each unit and the range is reduced by bright sunlight or at higher ambient temperatures.

@Gary - Thanks for the info about the grease.

The gear tooth "backlash" effect is surprisingly small because the servo uses feedback from the output shaft thereby automatically taking up any slack. Also, you would expect the magnitude of backlash to be constant at all speeds but the servo lag varies significantly with speed. Who would have thought that a servo is such a surprisingly complex little device ;). 


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service