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.