y'know Travis is beginning to tick me off
Designed (initially) for the commonly available VL53L1X (4 meter) IR Time Of Flight sensor from ST Microelectronics: https://www.st.com/en/imaging-and-photonics-solutions/vl53l1x.html
Using this in can be as easy as connecting to the VL53L1X-demo
wifi network (no password needed), and then browsing to 192.168.4.1
for the UI. Other WiFi settings can be used of course, see comments.
The goal of this project is to prove the suitability of this sensor for a small-scale LIDAR scanner to be used in domestic automation; robot vaccum cleaners, security robots, monitoring systems and, in my case, a K9 'companion' robot I am working on as a long-term plan.
The VL53L1X is just one of a range of similar Time-Of-Flight sensors from ST Micro. This sketch should be easily adaptable for them all, and other manufacturers have their own sensors which may also be suitable.
I have been pleasently surprised that the results are better than I expected; the scan above is of my Kitchen; here is what it looks like in reality, the sensor is the little black dot in the scan, and the little red light in the photo.
I use the standard Arduino IDE to develop and program the unit. You need to install the ESP development board definitions and libraries using the instructions at https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
The following 3rd party libraries are needed. They are not installed as standard in the Arduino IDE but are searchable and installable from within the library manager.
Select the dev board you are using from the boards manager list (normally the default generic ESP32 dev board entry) and select 'Minimal SPIFFS (1.9MB app with OTA..)' as your partition table type unless you have disabled Over The Air updates. See this.
By default the unit will create a passwordless AccessPoint named VL53L1X-demo
, you can connect to that and browse to http://192,168,4,1/
to see the demo. Alternatively rename the file mywifi.sample.h
to mywifi.h
and fill in your own details to connect to existing networks or make a more secure AP.
Currently I use the Sparkfun library; but there is also one from Pololu: https://github.com/pololu/vl53l1x-arduino & https://www.pololu.com/product/3415/resources
Both of these are 'light' libs designed for ATMega arduinos (eg limited RAM, etc). The Official ST lib is larger, but more complete and (arguably) better supported. It is also somewhat crankily documented, and requires a sign-up at stmicro .com to access.
The ST lib itself is redistributable, although the detailed documentation is not.. I still plan to move to this; and will provide it with the codebase here. See: https://www.st.com/en/ecosystems/x-cube-53l1a1.html#overview
A rather minimalist guide here, I'm afraid. I have a more descriptive set of instructions, phopos and a parts list on the Hackaday page for this project: https://hackaday.io/project/168327-cheap-and-cheerful-lidar-demo-and-dev-system
You need to follow the pinout guide here to connect the sensor and your development board together. Similarlarly for the stepper and it's H-Board driver card. And you need to maount the boards and sensor somehow. A simple design for 3d-printing with a 51x28mm 15 pin/side devboard is in the repo, as is a scadfile that can be adapted for other sizes of board(s), see line (#32)[https://github.com/easytarget/esp32-cjmcu-531-demo/blob/master/3dPrints/lidar-stand.scad#L32] for dimensioning.
Not currently used, but would be required for multi-sensor or low power sentinel use.
If you are using a H-bridge driven Servo the default pins (easily changable in code) are:
The WebUI for the demo is optimised for mobile phone displays, I run the unit in AP mode and connect from my Mobile. This allows me to demo to others easily too.
https://github.com/easytarget/esp32-cjmcu-531-demo/issues
The scanning action is driven by successful sending of the data to the web client. It is affected by network timeouts, packet drops and delays, these will make the scan action intermittent and somewhat laggy.. This would be resolved by implementing the data stream/smp plans above.
I have noticed the CJMCU-531 I2C comms seem to lock up infrequently, and needed a full power cycle to resume. This has only happened when I'm reflashing, rebooting and developing heavily; it seems stable when left in operation and not being 'messed' with.
I have included model files I used for my development board (JoyIT NodeMCU) and a paramatised SCAD file that can accomodate other MCU and Stepper driver board sizes by adjusting the relevant settings.
Two different sensor mounts are provided; the v2(taller) one also mounts the sensor at a slight angle to avoid rangefinding the edge of the table, I have found that for best results I need to stand the unit on a box or vase.
Use a ESP32-CAM instead of the dev board, stream video, take pictures, record ranges all in one.
Then link that via Serial and level converters to a ATMega328 based robot chassis I already have; and go for a WiFi drive.