Open Source LiDAR - Unruly

We've been waiting a long time for someone to post the plans of a working LiDAR. Is it really going to happen?

Similar projects worth following
Open hardware, open software and a detailed explanation of how LiDAR works right down at the component level. These are the objectives of this ambitious project.

The name "Unruly" was suggested by my 6 year old, "Dad, it measures without a ruler!"

Primary objectives:
1. Design a simple LiDAR module that is relatively easy to understand.
2. Use as many COTS (commercial-off-the-shelf) electronic components as possible.
3. The software must be easy to modify without a complicated IDE.
4. Mechanical parts must be 3D printable.
5. Optical components must be available at a reasonable price.

The Unruly specifications: Make it hack worthy

The Unruly is not just a crazy hack but is also a serious educational tool with lots of capabilities added to allow for experimentation. Here's the Unruly feature list in no particular order:

  • The Unruly is a time-of-flight LiDAR that uses a pulsed laser diode (PLD) to generate a flash of light, an avalanche photodiode (APD) to detect the return signals and a high speed timer (TDC) to measure the return time.
  • The total circuit board area is one square inch.
  • The measuring range can be adjusted to over 100m on natural surfaces and 250m on reflective surfaces, outdoors in bright sunlight.
  • The resolution can be configured down to 1 cm.
  • The measuring rate is up to 1000 readings per second or maybe more ;).
  • The laser power, pulse width and eye safety ratings are all under software control and can be set to Class 1, Class 1M or Class 3R to suit the application.
  • The APD detector can be adjusted under software control to operate at optimum sensitivity taking into account temperature and ambient conditions.
  • The amplifier gain can be adjusted under software control to achieve the best SNR (signal-to-noise ratio).
  • The detection threshold can be adjusted under software control to set the false return error rate.
  • Up to five different target returns can be measured on each laser shot.
  • The total power consumption is less than 0.5 W.
  • USB, serial and I2C communications are available at the same time.
  • Two servo driver ports are available to control scanning (
  • A digital I/O for alarms or other purposes is available.
  • Mechanical parts are 3D printable.
  • EMC emissions are low enough for use with RTK and GPS systems without interference.
  • EMC immunity is high enough to allow for use with BLE, WiFi, LoRa or other radios in close proximity (still to be tested).

The Unruly use of open source hardware: ItsyBitsy M4 Express

The Unruly uses existing open source hardware as a starting point, the Adafruit ItsyBitsy M4 Express. This is a small microcontroller board with a SAMD51 processor, extra flash memory and almost nothing else. Why, you are asking, have you chosen such a basic controller board to manage the complicated hardware of a LiDAR? Well, my wife likes how small it is and it has a cute name. Of course it helps that the SAMD51 runs at 120MHz and has a bunch of really interesting peripherals.

The Unruly use of open source software: CircuitPython

Another reason for choosing the ItsyBitsy M4 Express board is that it can run a version of the programming language Python called CircuitPython. This is by far the least likely language to be used in a high speed embedded system, especially one that needs to work at the speed of light. Python is an interpreted, high level language that manages variables and memory in a vague, non-specific way. There are only a few APIs and these do stuff that is no use to a LiDAR.

But CircuitPython is easy to write, easy to read and can be programmed without an IDE by using a basic text editor. This seems like a good enough reason to use it.

Servo scanner.MOV

Unruly scanner using a single servo.

quicktime - 4.45 MB - 01/27/2019 at 17:10



Unruly Rev 1 schematic.

Adobe Portable Document Format - 1017.38 kB - 01/20/2019 at 14:21


  • Rev3 - Getting closer to production

    Laser Developer02/22/2019 at 07:32 4 comments


    • This revision will use the MAX3658 or MAX40658 TIA. The two different versions will be catered for on the PCB so that the manufacturer can chose the one with the best price.
    • There will be no VGA post-amplification. This will reduce the measuring range a little but make the product much cheaper.
    • The unit will be able to run on a 3.6V battery.

  • Rev2 - Unruly design for lower cost

    Laser Developer02/02/2019 at 14:53 0 comments


    Once the design of a product is complete the hard work begins. The principle of operation and basic functionality remain the same but new constraints must be considered such as the availability and price of parts, ease of manufacture, tooling for lower costs and so on. These constraints make the difference between an idea and a product that can be made and sold. Hence the Unruly Rev2 has:

    • New amplifier chain chipset - lower price but similar performance.
    • Started adding test points for production.
    • Get quotes for tooling optical carrier component.
    • Get commitment from a manufacturer.
    • Get commitment from a distributer or two.



    The boards have arrived and test results are as follows:

    1. The first test is to evaluate the performance of a new LiDAR specific TIA from Analog/Linear called LTC6560.

    Positives: In terms of sensitivity, noise characteristics, overdrive recovery and stability this is a great component. It provides enough gain that there is no need for a post amplification stage thereby saving on component costs. It operates right at the theoretical limits of performance, meaning that you are not likely to be able to design a better TIA circuit yourself.

    Negatives: This device may have limited application in battery powered LiDARs because it needs a +5V power supply. It is also draws more power than the Maxim equivalents. To get full speed operation it needs a pull down resistor on the output which draws additional power.



    On balance, I have decided not to use the LTC6560 TIA. I think that the requirement of running on a 5V supply will make battery powered operation painful. Everything else runs perfectly on a 3.6V battery so it doesn't make sense to lose that capability.

    On the matter of production, LightWare has offered to produce the Unruly provided that we can get the retail price below US$100. Using the MAX4658 TIA is the cheapest option so this fits well with this requirement.

    Additionally, we can remove the VGA post amplifier to reduce the price further. This will bring the useful measuring range down to about 60m but for most robotics applications this is more than enough. The maximum range is still beyond 100m but it needs a large white wall as a target.

    So, on to Unruly Rev3!

  • Rev1 - Final test article

    Laser Developer01/20/2019 at 16:33 7 comments

    Rev1 is a stable test board for further software development. New features specifically for educational purposes have been added:

    • Laser pulse width controls added.
    • Laser power controls added.
    • Updated laser CAD model to improve optical alignment.
    • Made I2C pins available to the user.
    • Increased mounting holes size for optical parts.
    • Moved main supply to HVI to allow for battery operation.
    • Added power controls on VGA through D2 PWM.

    You will notice on the circuit board overlays that there are lots of small holes and very few visible tracks. The holes bridge the inner ground layers and outside layers together to reduce transmitted interference and cross talk between the laser driver and receiver circuits. The signal tracks are on the inner layers, shielded by ground plains, to reduce electromagnetic susceptibility.

    Above is the top side of the board and below is the other side showing the pulsed laser diode (PLD) and the avalanche photodiode (APD). At the moment we're using a laser from Laser Components and an APD from Hamamatsu.

    In order to test Unruly it's important to be able to access the components on both sides of the board while it is running. This is done by adding "wings" instead of headers. These wings are just headers soldered on at right angles.

    The optics are then screwed on.

    Using the wings, jumper cables connect the ItsyBitsy M4 Express to the Unruly LiDAR leaving the back of the circuit board accessible to an oscilloscope.

    Test 1 - Unfiltered signal stability - indoors:


    Single shot STDEV (standard deviation) = 1.0 cm (33 ps)

    Single reading APD bias voltage measurement STDEV = 0.11 V

    Single reading APD temperature measurement STDEV = 0.2 C

  • Rev0 - Initial test article

    Laser Developer01/20/2019 at 16:24 0 comments

    The following tests were conducted on Rev0:

    • CircuitPython APIs tested. Note that import order is important for correct hardware configuration and pin assignments.
    • Range confirmed >100m on grass and tress, >250m on reflector.
    • Resolution  confirmed <1cm for nearby targets indoors.
    • Update rate set to 1024 readings per second to allow for interleaved software functions.
    • EMC - emission levels extremely low especially around 2.4GHz and all satellite bands.
    • EMC - susceptibility minimal over wide range of frequencies and power levels.
    • Power consumption - VGA draws significant current (48mA) so power control added to Rev1.
    • With VGA power control on the average consumption is approximately 70mA at 5V.
    • Operation on battery connection confirmed.
    • Serial port tested (not I2C).
    • Servo ports tested. Note that port D4 produces 3.3V logic but port D5 produces 5V logic.
    • Initial eye safety testing done. Repeat for Rev1 to include the laser power controls.
    • Confirmed laser SMPS draws 2.5mA at firing rate of 2048 shots per second.
    • Confirmed APD high voltage supply draws 2.0mA at operating point.
    • Lenses and optical filter characterized through functional testing.

View all 4 project logs

  • 1
    Unruly glossary: TLAs (Three Letter Acronyms)
    • LiDAR = Light Detection And Ranging - a sensor that measures distance using laser light.
    • TOF = Time Of Flight - measuring distance by timing how long it takes a flash of light to reach a target surface.
    • PLD = Pulsed Laser Diode - a semiconductor chip that produces bright flashes of laser light.
    • APD = Avalanche Photo Diode - an optical detector with high sensitivity.
    • TDC = Time to Digital Converter - an IC that uses digital codes to represent short time periods.
    • SMPS = Switch Mode Power Supply - a circuit that changes voltage levels by switching current through an inductor.
    • TIA = TransImpedance Amplifier - an IC that converts current from a photosensor into a voltage.
    • IBM4 = ItsyBitsy M4 Express - a microcontroller breakout board manufactured by Adafruit Industries.
    • PWM = Pulse Width Modulation - a method of changing the duty cycle of a digital signal to produce different analog voltages.
    • SNR = Signal to Noise Ratio - an indication of how big a signal is compared to unwanted noise.
    • VGA = Variable Gain Amplifier - an amplifier with a digital interface to select the gain.
  • 2
    Unruly overview: How does it work?

    The Unruly LiDAR is made up of electronic circuits, optical parts and software. None of these are trivial even though they may look simple at first glance.

    The electronic circuits are on two circuit boards that plug together. The first board is the ItsyBitsy M4 Express controller and this is the brains of the LiDAR. The other board carries all the LiDAR specific components including the optics.

    The electronic circuits on the LiDAR board perform a number of functions. The measuring sequence starts when the TDC (time-to-digital converter) receives a start signal from the processor. At the same time the laser driver circuit fires a PLD (pulsed laser diode) to produce the outgoing flash of laser light.

    The return signal is detected by an APD and amplified in two stages. Firstly, a TIA (transimpedance amplifier) converts the current from the APD into a differential voltage. Secondly, a VGA (variable gain amplifier) increases the amplitude of the signal to a useable level.

    The analog signal is then converted into a digital signal using a comparator and this digital signal stops the TDC. The results from the TDC are transmitted back to the processor via an SPI bus.

  • 3
    Unruly optics: Seeing a long way...

    The optical components give the Unruly LiDAR its performance. Many thanks to Tracy for the hundreds of hours that she put into designing these critical parts.

    The PLD (pulsed laser diode) produces short flashes of light forming a beam that spreads out over a wide area. Without additional optical components the beam loses intensity and the measuring range is reduced. To correct for this beam divergence the Unruly has a lens placed in front of the laser, making the beam come out nearly parallel. This optical collimation significantly increases the measuring range.

    Photons in the outgoing laser beam hit the target surface and scatter in all directions. Only a small proportion of these photons head straight back, most of them are lost. In order to collect the returning photons a focussing lens is placed in front of the optical detector. The  lens collects more photons than the detector could do on its own so the measuring range is again extended.

    Mixed in with the returning photons are additional photons from various sources of background light such as the sun. These unwanted photons create noise in the detector making it hard to pick out the laser photons. To reduce this noise a narrowband optical filter is placed directly in front of the detector. This filter allows light through that is the exact color of the outgoing laser light and blocks light from other sources, letting the Unruly work even in bright sunlight.

    The detector is a very sensitive APD (avalanche photodiode) that converts the returning photons into electrons. The APD is 100 times more sensitive than a regular photodiode and it produces many electrons for each photon that it detects. This sensitivity helps the Unruly pick up very weak signals from distant target surfaces.

    A precision 3D printed holder keeps all the optical parts in place. The optical alignment is critical to the Unruly performance and errors as small as 0.1 mm can reduce the measuring range significantly. Tracy used a resin printer with an industrial grade, black resin to make the holder.

View all 15 instructions

Enjoy this project?



majpatmcd wrote 6 days ago point

I'd like to experiment and contribute, but with my limited experience, I can't take what's given and turn it into a viable PCB, much less circuit python code.  Could the files for those be uploaded?

  Are you sure? yes | no

Simon Merrett wrote 06/08/2019 at 12:33 point

Would you be able to increase range of measurements taken by changing any of software or hardware settings? Taking multiple measurements would be acceptable too. I'm looking for upto 300m against a white/light background in sunlight. 

  Are you sure? yes | no

SmallDevices wrote 06/12/2019 at 22:29 point

this should be a golf range finder, not lidar. google how laser range finder works.

  Are you sure? yes | no

Simon Merrett wrote 06/15/2019 at 08:38 point

@SmallDevices Please could you explain how this project is less suitable than a golf laser range finder? Genuinely interested as my Google search didn't make it clear to me. 

  Are you sure? yes | no

Lincoln Wang wrote 06/16/2019 at 02:41 point

300m distance requires a more powerful laser source, but then we need to consider eye safety issue. Using laser with different wavel like 1550 nm is safer at higher power. But those laser are larger and more expansive.

  Are you sure? yes | no

Simon Merrett wrote 06/16/2019 at 07:00 point

Thank you @Lincoln Wang 

  Are you sure? yes | no

iliasam wrote 06/16/2019 at 08:00 point

@Lincoln Wang As I know, most of the golf rangefinders have 905nm lasers. Can you give links to a golf rangefinder with 1550nm laser? Also, most of the golf rangefinders are using 75W laser, just like "905D1S3J09UA" laser used in Unruly.

  Are you sure? yes | no

SmallDevices wrote 06/19/2019 at 22:52 point

300m with a lidar under $100 is not feasible. instead, use correlation/averaging tricks you can detect 300m distance （600m round trip) with cost down to $25. The response will be slow, say 10 to 100Hz.

  Are you sure? yes | no

Simon Merrett wrote 06/22/2019 at 09:13 point

That is plenty fast enough for me. What would need to be different in the HW compared to this unruly lidar?

  Are you sure? yes | no

Lincoln Wang wrote 04/08/2019 at 19:43 point

The temperature control of the APD looks not simple. Did you implement PID control to the BIAS_PUM?

  Are you sure? yes | no

Lincoln Wang wrote 04/05/2019 at 21:19 point

I am also trying to make a LiDAR with a scanner. 

Question: why you use a variable gain amplifier(VGA)? When you need to change the gain? Since I see use fixed gain amplifier might also work.

  Are you sure? yes | no

PointyOintment wrote 04/04/2019 at 13:42 point

An annoyance that I think I'm going to start trying to combat: the capitalization "LiDAR". Nothing personal (or "projectal")—this is just the one where I finally decided to say something. Do you (and everyone) write RaDAR or SoNAR/SoDAR as well? I doubt it. And while this may not be the case for those two, I believe "lidar" was the capitalization used the very first time that acronym was used in print.

But this project looks cool, and I'm following it now :)

  Are you sure? yes | no

Laser Developer wrote 04/04/2019 at 14:18 point

Thank you! I couldn't agree more. The acronym has been driving me nuts for a few years now but we can't seem to get away from it. In truth it should be LRF (Laser Range Finder) but a number of influential companies decided that LRF wasn't cool enough so they started using LiDAR and it has just stuck. A Lidar used to be a laser to measure atmospheric particles. Oh the complexities of language evolution...

  Are you sure? yes | no

Sophi Kravitz wrote 02/11/2019 at 17:03 point

This is a really interesting project- how long have you been working on this? What chipset are you using for amplification and how much noise is there?

  Are you sure? yes | no

ttyler333 wrote 02/06/2019 at 19:47 point

Out of curiosity, how much is that APD?

  Are you sure? yes | no

Laser Developer wrote 02/07/2019 at 05:36 point

We can buy in bulk for less than US$15. It is not available through the retailers but you can approach your local Hamamatsu rep directly for quotes. There are lots of other APDs that can also be used with the same control circuitry.

  Are you sure? yes | no

Richard wrote 02/06/2019 at 18:43 point

This is really interesting. I bought a LidarLite before they sold to Garmin. Then they became too expensive...

Looks like the v3 Garmin unit is about $150 £123.

How does yours compare?

  Are you sure? yes | no

Laser Developer wrote 02/07/2019 at 05:40 point

We are getting a manufacturer on board and linking up with specialized distributors. To make it work we all want to have a retail price of US$99. This is still a challenge because we have no sense of the production volumes.

  Are you sure? yes | no

John Stockton wrote 01/26/2019 at 15:20 point

Very nice project.  One of the items mentioned was handling of multiple returns, which I assume would require either multiple TDCs or retriggering of the first TDC.  Have you come up with an approach for this?  Good work - keep it up!  John

  Are you sure? yes | no

Laser Developer wrote 01/26/2019 at 15:35 point

Thanks John, we appreciate the positive comment.

TDCs usually allow for multiple returns but it depends on the manufacturer and the price as to what you get. The TDC in the Unruly was chosen because it accepts 5 stop signals for every start signal and each of these stops can be read directly by the processor.

This TDC is also in an easy to handle form factor (TSSOP) which means that we can get circuit boards made quicker and cheaper than if we had used a more complicated part.

  Are you sure? yes | no

instruct, tutor, train... wrote 01/26/2019 at 15:08 point

1. Is this a true time of flight design?  I understand that there are different types of LiDAR such as those that depend on the phase of the returning light WRT the sending light.  I imagine such a scheme would only see the strongest reflection.  I imagine a true time of flight design would see multiple responses as the light bounces off complex objects.

2. LiDAR devices have always been expensive.  Are there design trade-offs where cost and complexity can be reduced along with precision?  But repeatability is retained? 

  Are you sure? yes | no

Laser Developer wrote 01/26/2019 at 15:28 point

1. This is the real deal - direct time-of-flight. You are correct in saying that phase measurement LiDAR cannot easily discriminate multiple targets whereas the Unruly can detect up to five returns in each laser shot. Take a look at instruction #11 for an example of three targets.

2. One of the reasons for posting this open source design is to stimulate the development of more LiDAR products and thereby drive the component costs down. The Unruly should retail for well below US$100 and if we can get enough support it will go into production. There are many combinations of components that would make it cheaper but this is already a heavily optimized design. But maybe someone else can do better?

  Are you sure? yes | no

instruct, tutor, train... wrote 01/26/2019 at 16:30 point

So "The analog signal is then converted into a digital signal using a comparator and this digital signal stops the TDC." means that the uP isn't doing the stopping?  (Well, that's easy to believe as we are likely talking nS of time here.)  So, if the TDC only had 1 stop it is likely that it would be wasted most of the time on noise and other false triggers?  But with more stops the uP could pick out the strongest return?  Is that the strategy?

  Are you sure? yes | no


[this comment has been deleted]

Laser Developer wrote 01/26/2019 at 15:57 point

Smart man! Yes, that is exactly correct. Real world sensors never have zero noise. In the case of a time-of-flight LiDAR noise is the main problem because the analog circuitry needs a very wide bandwidth to handle the "impulse" nature of the laser flash. This high bandwidth will let through more noise than say, a phase modulated LiDAR that runs with a very narrow bandwidth.


Most engineers don't realize that you can fire the laser really fast without exceeding the Class1 eye safety rating. This means that you have tons of data to analyze (shots and stops) so it becomes a matter of simple statistics to discriminate between random noise and a deterministic signal.

To take the concept further, you can easily configure the Unruly to operate well below the noise floor (SNR << 1) and still pick up signals realiably (> 5 sigma certainty). 

  Are you sure? yes | no

Laser Developer wrote 01/23/2019 at 13:23 point

- The limiting factor on update rate is the CircuitPython code. Using C will be 10x faster.

- Single measurement resolution is 55ps with some jitter making it about ±2 cm. 

- Most APDs will work including the AD500-8 (it's very expensive!). I have a meeting with Hamamatsu next week to discuss bulk discount on the S10341.

- There are different ideas about what bandwidth to use in a LiDAR. By changing capacitor values the Unruly has a practical BW limit of about 500MHz. I think that changing the BW to see what happens would be a great experiment.

- Yes, I will be publishing all waveforms and test data as soon as possible.

  Are you sure? yes | no

iliasam wrote 01/23/2019 at 15:40 point

Thank you for your reply.
There are a lot of "AD500-8" sold on for <15$ but I have doubts about theirs quality.

  Are you sure? yes | no

iliasam wrote 01/23/2019 at 13:07 point

Thank you very much  for this project! It is very interesting.
Please, can you answer this questions:
- You write "The measuring rate is up to 1000 readings per second". What is the limiting factor?
- You write "Resolution  confirmed <1cm for nearby targets indoors". Is it true for single measurement (without averaging)?
- APD S10341 is looking hard to find. Is it possible to use AD500-8?
- You write "The TIA has a differential output impedance of 150 ohms so its bandwidth can be controlled by a capacitor (C23)"
I think that amplifier for a TOF rangefinder must have maximum possible bandwidth. So what is the reason for decreasing bandwidth by this capacitor?
- Are you going to publish the oscillograms from different points of the device?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates