We're back to improve on the "follow-me" sketch for Arduino. This time we'll be using 3x tinyLiDAR laser sensors with a single Arduino UNO. We mounted them all on a tilt/pan platform so it can follow you in all 3 dimensions. Watch the video above to see it in action.
Step 1: Sensors in Parallel
One of the more challenging aspects of using the VL53L0x or any other type of sensor is to run them in parallel. Robotics enthusiasts know this problem well. PWM and serial output sensors require extra work and extra pins to read measurement data in parallel as does using the I2C port directly on the VL53L0x chip.
Our tinyLiDAR is architecturally well equipped to handle this configuration owing to its dual hardware I2C ports built-in to the STM32L ultra-low power processor. We have one port running at full speed to the VL53L0x sensor chip and the other port handling the communications to Arduino. In this manner the tinyLiDAR sensors are run as I2C slaves and hence paralleling them is inherently simple.
The next question then becomes - how can we manage the multiple sensor addresses? tinyLiDAR boards will ship with the factory default I2C address of 0x20 and to change them individually we can use the "r" command mentioned already in our earlier Instructables.
Unlocked Stretch Goal Feature
Thanks to the generosity of so many backers from around the globe, we had our first stretch goal recently "unlocked" and we thereby committed to the development of a new feature to help auto assign the I2C addresses without physically unplugging wires and talking to each board manually. The concept took a while to hash out but we now have a solution that is working well and is demonstrated in the video above. As you can see in the video, we can easily auto assign the sensor board addresses just by pointing to each one.
The steps in using the new auto config feature are as follows:
First you can wire up multiple tinyLiDAR sensors to the I2C bus using appropriate pull-up resistors. Then using the tinyLiDAR GUI Terminal sketch, you can send the new "AR" command to tell all the tinyLiDAR sensors to go to their auto-config listen mode. They will all be blinking rapidly at this time to confirm that they are in this special mode. Next, the GUI program will sequentially assign I2C addresses starting from 0x21 upwards as you point to each sensor in any order you like. The sensors' LEDs will turn off one at a time as you hover your finger over each one - but only after they get their new addresses.
In addition, we've also added another new command called the scan & verify command or "V" for short. It's used to scan the I2C bus for available tinyLiDAR sensors and then sequentially blink each one for about one second while displaying their programmed address on the GUI terminal. These addresses are all, of course, stored in non-volatile storage inside of the STM32L processor so you can power cycle your whole system as desired.
Step 2: Servos and Platform
For this demo, we selected one of the lowest cost "tilt/pan" platforms available along with two of the most common, low cost analog servos that would fit in this platform. The servos are called "Hitec HS-55" and have a better build quality than SG90 servos. These are also low power servos that can be powered directly from the Arduino. Hence, special driver boards and external power supplies are not necessary for this project.
Using a separate sensor for each cardinal direction would have required using 4x tinyLiDAR sensors. But our most popular perk on Indiegogo was the 3 pack so we tried to make it work using only 3x tinyLiDAR sensors. To do this, we arranged the 3 sensors equidistant in a circle as shown in the mounting plate diagram.
They kind of look like 2 eyes and a mouth if you space-out and look at them long enough ;)
Step 3: Putting It All Together
The mounting plate was made from .062" thick aluminum and all screws were M2x10mm socket head type. Aluminum is a very soft material so the .062" diameter pilot holes receive the threads of the M2 screws easily if you slowly screw them into the plate. We then affixed this mounting plate to the top (tilt) bracket using double-sided foam tape.
The complete Arduino UNO sketch is attached at the end of this article and the latest GUI Terminal code will be available once the tinyLiDARs ship out to our backers. Thank you for reading this Instructable and please be sure to support us if you like this kind of innovative geeky stuff. Our Indiegogo campaign is ending very soon...