Here's another interesting little sketch for robotics enthusiasts to build upon. It's called the "Follow Me" sketch for the Arduino UNO. Using 2 tinyLiDARs for its "eyes", it can rotate an analog servo to the direction of an object placed in front of it. Please check out our video above shown in real-time. Notice how quickly it responds to movements. This speed boost is primarily due to tinyLiDAR's faster response times.
Step 1: Command Terminal Sketch
Since we are using 2 tinyLiDARs in parallel for this project, we will need to program one of them to have a different I2C address.
To do this, we can use another new sketch called the "tinyLiDAR Command Terminal" that we've been crafting for a while now. It's been very helpful in the lab as a general purpose tool to allow us to quickly and easily talk to any tinyLiDAR board. With it, you can do things like take distance measurements, calibrate and set configuration details such as the I2C address of the board using only one or two letter commands. A screen shot is shown above. Note that it's a pre-release version but we included it here anyway to give you some insights on how to talk to tinyLiDAR.
Therefore, to use it we just connect one of the tinyLiDAR boards to the UNO and run the Command Terminal sketch. Then type the command "r 22" and press enter. This will set the board's address to be 0x22 in its non-volatile storage.
That's it! Now we have one board already set to the default address of 0x20 and this new board set to 0x22.
In the lab, we placed the 0x20 board on the left and 0x22 on the right. You can switch them around if you like, of course, but remember to update the code appropriately or else it will turn in the wrong direction when you place your hand in front of it ;)
Step 2: Components and Code
We can re-use most of what we had from the last Instructable called "Build This TinyLiDAR Arduino Radar". Please refer to that article for more details on making the angle bracket. We can also re-use the the same analog servo, so there are no new parts here except for another tinyLiDAR sensor board.
Next you can wire up both boards as shown in the Fritzing diagram and run the Follow Me sketch to have some fun! Thanks for reading this Instructable. Please be sure to drop by our crowdfunding page and also help spread the word about our simple to use laser sensor. We need everyone's help to bring tinyLiDAR to life. Thank you!