Liquid level sensor using a laser time of flight sensor

Started 21st December 2016

I measured the depth of water in the crawl space under my house using a capacitive sensor (see Sensor) and an ultrasonic ranging module (see HCSR04). Then at the end of 2016 I became aware of the ST Microelectronics laser time of flight sensors.

As a young lad playing with tiny radio transmitters I had thought why not use radar to see how far away objects in my work-space were. Even for me back then the calculation was simple and the answer is that light travels fast, really really fast. At the time I doubt anyone had electronics which could measure how long light takes to cover a foot (as 300 mm was known then).

We'd been out on the vast school playing field and measured the (far lower) speed of sound with our ancient technology ("I will blow my whistle and Pilling will wave his flag when he hears it") and failed to get anywhere near the right value.

So amazing new technology, I had to give it a go.

Two versions currently are available on ebay, the VL53L0X and the VL6180X "Time-of-Flight Distance Sensor". The VL6180X is short range (10 cm) and the VL53L0X longer (1 m). The ST home pages are: VL53L0X and VL6180X.

Home pages on SparkFun VL6180X and Adafruit VL6180X and VL53L0X. SparkFun supply a library for the VL6180X which I set off using.

The ebay version (shown below) contains level shifters and a voltage regulator which means it can be connected to a 5 V or 3.3 V Arduino.

VL6180 break out board, David PillingVL6180 break out board, David Pilling

The SparkFun library is very simple to use and trivial to splice into the rest of my sensor code. Results are noisy, but if enough are averaged they are accurate. There's no problem of monotonicity like with the unmodified ultrasonic ranging module.

I used a lot of freely available software. Credit to the people who wrote it and made it available.

Software sources:

Other resources:



Click to return to index

Page last modified on December 24, 2016, at 12:46 AM
Powered by PmWiki