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: 3613

Comment by Gary McCray on February 24, 2017 at 11:33am

Hi LD,

The gear lash effect is mostly noticeable in applications where the servo is externally getting pushed in alternate directions.

Then the servo has to actively respond and take up the gear the lash in the opposite direction, effectively producing a servo response lag.

In this application, it doesn't seem like that would be much of a problem and you could always preload it slightly in one direction or the other to prevent it if it was.

Digital servos tend to be so tight and fast, back lash may not be significant for this application in any case.



Comment by Laser Developer on February 26, 2017 at 10:50pm

@Gary - Even I am not too old to learn something new! Thanks for the clarification :).

Comment by Emin Bu on April 19, 2017 at 5:29am
Very it possible to tell Lidar servo to always look in direction of movement,automatically?Could you elaborate how Lidar will "eliminate fixed obstacles like landing legs..."?
Comment by Robert Gowans on April 20, 2017 at 4:41am

@Emin: You can manually control the servo position through the lw20, which makes it easy to point it in the same direction the drone is moving - provided you have a servo that can achieve that range of movement.

As for the landing legs, any fixed obstacle will always generate readings within the same position relative to the lw20, therefore when processing the data you can simply ignore points in known regions.

Comment by Pawel on September 4, 2018 at 3:50am

Do the termimal provided by lightware and LW20 software have tge same funcionlity on I2C and Serial laser interface ?

Is it possible to log laser RAW readings, distances, via I2C interface on a PC ?

I need to log two LW20 readings on I2C bus instaled on one  drone, for further research.

Any help will be appreciated.

Comment by Laser Developer on September 4, 2018 at 3:54am

Hi Pawel,

The LW20 has the same functionality on serial and I2C but the Terminal app doesn't support all the I2C features - just a test function only. This is because a PC don't have native I2C connectivity so a third party USB to I2C converter is needed. These converters don't conform to any particular communication standard and each one requires its own special software.

Comment by Pawel on September 4, 2018 at 4:14am

@laser developer. To be clear. 

My intentions is to log readings. Im using i2C and want to log the readings.

Im ussing Devantech i2c as stated and proposed in manual.

Connection is okej, limited commands i2c test are working on terminal.

Im wondering, can I via i2c using application set servo to work, and log somehow all readings during work ?

We want to use the LW20 in our system, anticolision system, but firstly just log the data.


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

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service