David Pilling |
Main »
Liquid level sensor using a laser time of flight sensorStarted 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. 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. What happened I rejected the Adafruit library as too complicated and used the Pololu library. Previously I have used a customised version of the wire and twi libraries (to disable pull ups) in this version I used the standard one and added code to handle the pull ups. I 3D printed an arm to hold the VL53L0X sensor some 250 mm above the ground level. I have a plastic box filled with gravel which the electronics sit on top of. It is important to have enough ballast so that as the water level rises the box does not float. Downloads:
I set off wanting to measure single mm of water, and ended three years later with inches (25.4 mm units) of it, a worrying trend. Comments I used a lot of freely available software. Credit to the people who wrote it and made it available.
|
David Pilling's Wiki Set view |
Page last modified on March 12, 2019, at 12:36 AM - Powered by PmWiki pmwiki-2.3.31 (pmwiki-2.3.31) |