Tag Archives: VL53L1X

Porting LIDAR-based ‘Find Best Direction’ to Vision-Enhanced Robot

Posted 13 October 2026

While working on my new ‘vision-enhanced’ robot project, it became apparent the the OAK-D Lite camera was not the best tool for handling a ‘stuck’ condition where the robot has nosed into something and needs to find a better movement direction. The camera After some experimentation, I found that by moving the rear-facing VL53L1X LIDAR distance sensor to the front of the robot, I could turn the robot under manual (‘C’) control and watch the reported LIDAR distances change. Since I had already solved the ‘Find Best Direction’ problem on my older robot, I decided to port the code into the new vision-enhanced robot.

Looking back through my old code in C:\Users\Frank\Documents\Arduino\WallE3_Git\WallE3_Git\WallE3_Git.ino, I found a reference to this post. It wasn’t directly relevant as it discussed the problem of sorting multiple arrays in a synchronized fashion so as to arrive at a situation where all the distance and heading sensor arrays are sorted in lockstep with a ‘master’ array containing front distance readings. Then the ‘dependent’ array readings associated with the maximum front distance reading can be easily read off.

This isn’t really necessary for the vision-enhanced robot, as there are only two sensors of interest – the front distances and the associated headings. I believe I should be able to set up two small lists (say 10 elements; front distance readings and associated headings. As the robot rotates, each new distance reading is compared to the stored ones, and replaces the largest value that is smaller than it. The headings array value associated with the replaced heading value gets replaced by the heading value associated with the new distance value. At the end of the rotation, the distance array should contain the 10 highest distance readings, sorted in descending order, and the heading array should be synchronized to their associated distances. Then an ‘appropriate’ heading can be selected from the data (‘appropriate’ to be defined later).

It turns out UpdateIMUHdgValDeg() already manages a HEADING_HISTORY_ARRAY_SIZE array of heading values, where earlier values are bumped up (down in index) and the latest value is stored at gl_HdgHistoryArray[HEADING_HISTORY_ARRAY_SIZE – 1]. If I also have a HEADING_HISTORY_ARRAY_SIZE array of distance values that are handled in the same manner, that should be all I need. I’m pretty sure I already have that array, as that is what is used to calculate variances needed to detect ‘stuck’ conditions. Yep – its there but named ‘aRearDistCM’ instead of ‘aFrontDistCM’. I’ll let that ride until everything is working and then change ‘Rear’ to ‘Front’ everywhere. CalcBruteRearDistArrayVariance() is also there for stuck detection. bool IsStuckBehind() is missing so copied it from WallE3_Git.ino to VisionEnhancedRobot…’. ino (into MISCELLANEOUS section).

Looking back through the code and previous posts, I built up the ‘QuickSort’ algorithms to handle just this situation, so abandoning them for something simpler does not seem real smart; it’s already there, and it works.

Well, maybe not. Looking at WallE3_Git.ino, I see that the RunToDaylight() code does not appear to use QuickSort at all – it does the ‘simpler’ idea of rotating 10 deg at a time, recording both heading and distance. After the rotation I see:

which is pretty much exactly the ‘simpler’ idea I was thinking about.

Well, I may have spoken too soon. WallE3_Git.ino has *two* ‘RunToDaylight()’ functions, ‘RunToDaylight()’ and ‘RunToDaylightV2()’, and ‘RunToDaylight()’ is apparently never called and was replaced by ‘RunToDaylightV2()’ which incorporates the QuickSort algorithms. However, only RunToDaylightV2() Step5:

applies to this situation – all the other code is aimed at finding a trackable wall. Step5 is basically ‘RunToDaylight()’ with the distance and heading arrays presorted by decreasing distance with

I made the decision to port all the ‘RunToDaylightV2()’ and supporting code to the new ‘stuck-recovery’ branch, trimmed down to just the ‘Hdg’ and ‘FrontD’ arrays for now (may later want to add RearD, but not now). This is basically just the ‘Step5’ portion of ‘RunToDaylightV2()’, with the addition of all the supporting code for QuickSort operations.

I have the ‘stuck ahead’ detection running now. Here’s a sample output:

The next step is to use the ‘RunToDaylightV2()’ function and supporting QuickSort code to determine the best direction to travel *after* IsStuck() returns TRUE.

18 October 2026 Update:

After getting the stuck-recovery code working, I created a new C++ project on my PC to parse through the output generated by the 360 degree scans from ‘stuck-recovery’. Here’s the final code:

Including both 36-point (10 deg steps) and a 72-point (5 deg steps) datasets from the ‘stuck-recovery’ code. With the 72-point (5 deg steps) scan data active, the .cpp program produces the following output.

The above plot was generated using a small Python program generated by Grok, as shown below:

19 October 2026 Update:

Grok modified the ‘polar_scan.py’ script to pull the required ‘bestStart’ and ‘bestEnd’ values directly out of the raw data from the robot. With the following data

The polar_scan.py program produced the following plot:

This is a bit of an unrealistic scenario, as I deliberately started the robot scan with its front toward the open doorway, in order to excite the edge case where the ‘best direction’ lobe crosses over the +/- 0 deg boundary. In reality the ‘best direction scan will almost certainly start with the robot pointed away from the ‘best’ direction, as that condition is what triggers the ‘run to daylight’

It is also unrealistic in another way, in that this data was collected with my robot sitting on my bench, with the robot’s VL53L1X distance sensor about 90cm off the ground. In reality it will be more like 17cm off the floor in real operation.

Here is the scan from the robot sitting on the floor, starting with its nose just a few centimeters away from a simulated wall, with the open area behind it.

As the plot shows, there is a fairly wide of headings from about -135 to +135 deg, with the peak at about -170 or so. This corresponds very to the actual layout of my lab.

I attached my iPhone to the robot in the same place as the VL53L1X sensor and ran another 360 scan. The result was this video:

261019 360 deg scan in 5-deg steps, starting with the robot’s nose just a few cm from a simulated wall

The far doorway can be seen in the video at about the 8 second mark.

20 October 2026 Update:

The ‘Find Best Direction’ study is complete. the ‘polar_scan.py’ script takes the scan data from the robot and produces the polar plot shown below:

Now it’s time to integrate all this back into the mainline repo. I had a conversation with Grok about this, and I believe I am coming around to his/its way of thinking. Have the teensy handle initial ‘stuck’ detection using a variance threshold on the front-facing VL53L1X. If a stuck condition is detected, notify the Pi5. The Pi5 tells the teensy to back up 1 sec & perform a 360 deg scan and report distances and headings. The Pi5 will then run the above ‘polar_scan’ script to determine the best escape direction and tell the teensy to turn to that heading. After that the Pi5 uses the camera to validate the escape direction, and if it agrees, normal travel/navigation is resumed.

21 October 2026 Update:

I committed/pushed the ‘stuck-recovery’ branch from my PC – this is all the stuck-recovery scan code, but minus all the required integration code.

So, what to do about the big switch statement in CheckForUserInput? Right now it switches on the first character of the string. Some commands are truly single-character (C, H, U…) but some are single-alpha + numeric (Txx, Lxx, Rxx), where the ‘xx’ are arbitrary numeric characters. Now I want to add full-string commands like ‘STUCK_SCAN’, but this results in “Unknown top-level character”. I could add a ‘S’ case, but I might eventually run out of single-character commands. Maybe the way to handle this is with a ‘!’ (bang) prefix, which says “look at the full string”. A case statement like “case ‘!’: would handle all multi-alpha characters commands and would then use internal ‘if’ statements to accommodate an arbitrary number of commands

So, I started with “!STUCK_SCAN”. When this string is entered at the serial port, CheckForUserInput() runs this code:

It stops the motors and then calls RunToDaylightV2():

which repeatedly calls SpinTurn(true, 5) to scan 360 degrees.

This all works great – except – – – when RunToDaylightV2 is running a scan, it can’t be stopped – oops! The reason it can’t be stopped is because it isn’t calling CheckForUserInput() inside the ‘for’ loop. The obvious answer is to place a call to CheckForUserInput() inside the loop and then send a ‘C’ character to the teensy, which will stop the motors ….. except that it doesn’t; it stops the motors, but then the next call to SpinTurn() starts them up again – rats!

So, next we try using the bool return from CFUI() to guard the SpinTurn() calls, like so:

But, this doesn’t work either, because the call to CFUI here doesn’t have anything to do with the part of CFUID that called RunToDaylightV2 – completely separate. So, I finally decided that the only way to reliably handle this (and other similar) issues is to establish a global ‘status’ variable ‘gl_AnomalyCode’ that can be set in CFUID and read anywhere. I actually had this in my previous WallE3_git project, and even had a separate ‘enum.h’ file to house the anomaly codes and other enums. I copied just the AnomalyCode section from enum.h, as shown below:

Then I added the global variable ‘uint8_t gl_AnomalyCode = ANOMALY_NONE;’ to hold the current anomaly code, and set it to ‘ANOMALY_STUCK_AHEAD’ in the ‘!STUCK_AHEAD’ CFUI section, and back to ‘ANOMALY_NONE’ in the ‘C’ CFUI section. This fixed the problem entirely (but not necessarily elegantly). RunToDaylightV2 checks the value of gl_AnomalyCode each time through the scan loop, and terminates if it isn’t ANOMALY_STUCK_AHEAD.

After sleeping on this, I started thinking that what I really want instead of (or maybe in addition to ANOMALY_CODES is a SYSTEM_STATUS enum, with STATUS_MANUAL_CONTROL set system-wide whenever the user inputs ‘C’.

enum SystemStatus {   STATUS_MANUAL_CONTROL = 0,   STATUS_AUTO_NAV }; SystemStatus gl_SystemStatus = SystemStatus::STATUS_AUTO_NAV;

Then, in RunToDaylightV2():

    if (gl_SystemStatus == STATUS_MANUAL_CONTROL)     {       return;     }

And in CheckForUserInput() -> ‘C’ case:

gl_SystemStatus = SystemStatus::STATUS_MANUAL_CONTROL

And in CheckForUserInput() -> ‘C’ case:

And in RunToDaylightV2():

I will keep the AnomalyCode stuff around as well, but just not for this purpose:

After making these changes, I ran the Teensy program and simulated a Pi5 command to perform a stuck scan by sending “!STUCK_SCAN’ at the PC serial port, and then sent ‘C’ after the scan actually started, with the following output:

23 October 2026 Update:

So now I have the teensy RunToDaylightV2() and CheckForUserInput() code modified to handle ‘!STUCK_AHEAD’, ‘STATUS_MANUAL_CONTROL’ and ‘!STUCK_SCAN’ situations, it’s time to make the associated changes/additions to the Pi5 code.

In a ‘stuck_ahead’ situation, the teensy sends ‘!STUCK_AHEAD’ to the Pi5 via Serial1, and it is captured by the ‘telemetry_loop()’ function.

As shown in the code above, any line from the teensy of the form “[timestamp]: [body]” where ‘body’ is “DONE [cmd]”, “ACK [cmd]”, or “BUSY [cmd]” has the [body] extracted and placed in the ‘teensy_events’ queue. This queue is examined in ‘wait_for_done’ and if one of the above strings is present, does the right thing. This isn’t directly applicable to the ‘stuck’ situation, but something similar will be necessary. ‘telemetry_loop’ will have to recognize the anomaly flag from the teensy and pass it along to the main nav function

25 October 2026 Update:

I’m getting closer to the complete ‘stuck ahead’ interaction between the teensy and the pi5, but still having problems.

In order to allow the ‘manual control’ command (now ‘M’) to abort a 360-degree scan, I added

which skips all the remaining SpinTurn() invocations.

26 October 2026 Update:

I’m running into some conceptual (or maybe semantics) issues with the robot project. The Pi5 recognizes two different modes; ‘Auto’ where the Pi5 drives by sending commands to the robot via Serial1, and ‘Manual’ where the user drives by sending commands to the robot via either a direct USB cable connection (Serial) or by way of the wireless SSH connection to the robot (relayed by the Pi5 over Serial1). In ‘auto’ mode, only the Pi5 talks to the robot.

09 November 2026 Update:

The ‘stuck_ahead’ recovery project is pretty much complete. The robot will now recognize the situation, perform a ‘stuck_recovery’ process that includes using the front-facing LIDAR to measure the available ‘straight ahead’ distance every 5 degrees around a complete rotation, then turning to the ‘best’ direction and proceeding. Here’s a short video showing the recovery operation:

Once we got ‘stuck-recovery’ going, it became apparent that we had somehow managed to kill the ‘rolling turn’ behavior of the normal auto-nav mode. We finally figured out that we needed a new ‘!TWEAK command and another default argument to the SpinTurn(). function, and this got us back to the original ‘rolling turn’ behavior, as shown in the following short video:

At this point the ‘stuck-recovery’ project is pretty much complete, so I decided to merge the ‘stuck-recovery Github branch back into the ‘main’ branch. This turned out to be *much* more complicated than I thought, and I would never have gotten it done without Grok’s help. I am learning a lot about git version control and ‘history’ vs ‘code’, so that’s a win at least.

Next up ‘Too Close’ recovery: This should be identical to the ‘stuck_ahead’ case, differing (I think) only in the triggering condition.

26 November 2026

Well, as usual I spoke too soon about “the ‘stuck-recovery’ project is pretty much complete“. Grok and I kept running into additional issues, but most of them, at least, have been addressed successfully. I took the robot with me to St. Louis for Thanksgiving dinner with family, and the robot got a chance to strut its stuff. It actually did very well until it ran out of battery (and unfortunately, I forgot an essential cable for recharging the battery), so I counted that as a plus.

At this point, the ‘obstacle_ahead’ and ‘stuck_ahead’ actions are working pretty well, and so I no longer need the ‘too close’ action.

VL53L1X Distance Measurement Compensation

Posted 28 April 2023

After replacing all the VL53L0X Time-of-Flight distance sensors on WallE3 with VL53L1X versions with twice the effective range (400cm vs 200cm), I followed the procedure described in this post to derive distance correction expressions for each sensor.

First I set up a distance test range as shown in the following photo:

Distance Calibration ‘Range’

I captured the distance readings from all seven sensors at 10cm intervals from 10 to 60cm, using ‘WallE3_Complete_V2.ino’ in ‘Distances Only’ mode. For each reading I recorded a 20-point average as shown in the following table and plot:

Distance calibration Excel table and plot

This data looks exceptionally good except for the recorded values for the rear sensor. It looks like I may have made a mistake on the 40cm measurement. To investigate this, I re-ran just the rear sensor measurements, resulting in the following table and plot:

Revised plot showing corrected rear distance readings

Looking at the data I suspect I simply forgot to move the robot to the new distance for the 40cm ‘rear’ measurement. I dropped the faulty dataset and then used Excel’s ‘trendline’ feature to show a linear expression fit to the data for each sensor, as shown below:

Distance plots with linear trendline expressions

It turned out to be pretty difficult to select individual sensor plot lines to add trendlines, because (with the exception of the left front sensor) they were all almost identical. In order to add trendlines, I had to use Excel’s ‘Select Data’ feature to show only one line at time. Then when I added the associated trend line, I was able to edit the displayed expression to tag it to the associated sensor, as shown above.

As I did in my previous work with the VL53L0X sensors, I used the trendline expressions to come up with compensation expressions for each sensor, as follows:

  • LF: LFCorr = (LF-3.44)/0.8746
  • LC: LCCorr = (LC-0.7533)/0.9751
  • LR: LRCorr = (LR+0.34)/0.9961
  • RF: RFCorr = (RF+0.4133)/1.0001
  • RC: RCCorr = (RC+0.1867)/0.9877
  • RR: RRCorr = (RR+0.8)/0.9971
  • Rear: RearCorr = (Rear-0.7267)/0.9969

When I plotted the corrected values, I got the following plot:

Compensated VL53L1X sensor data

As can be seen in the above plot, the compensation is almost perfect (for that matter, most of the sensors, with the exception of the LF (Left-Front) sensor, were pretty much spot on without compensation.

With the above information, I modified all seven ‘lidar_XX_Correction()’ functions in ‘Teensy_7VL53L1X_I2C_Slave_V1.ino’ to use the new correction factors, and then made another distance measurement run, with the results shown below:

After adding compensation to WallE3 programs

At this point I believe it is time to declare victory and move on with WallE3 ‘field testing’.

Stay tuned,

Frank

Replacing VL53L0X Time-of-Flight Distance Sensors on WallE3 with VL53L1X

Posted 21 April 2023

This material was an addition to my earlier ‘More ‘WallE3_Complete_V2’ Testing‘ post, but I decided it deserved its own post.

As one result of my recent ‘field’ tests with ‘WallE3_Complete_V2’, I discovered that the maximum distance capability (approximately 120cm) of my VL53L0X sensors was marginal for some of the tracking cases. In particular, when the robot passes an open doorway on the tracking side, it attempts to switch to the ‘other’ wall, if it can find one. However, If the robot is tracking the near wall at a 40cm offset, and the other wall is more than 120cm further away (160cm total), then the robot may or may not ‘see’ the other wall during an ‘open doorway’ event. I could probably address this issue by setting the tracking offset to 50cm vs 40cm, but even that might still be marginal. This problem is exacerbated by any robot orientation changes while tracking, as even a few degrees of ‘off-perpendicular’ orientation could cause the distance to the other wall to fall outside the sensor range – bummer.

I had the thought that ST Micro’s latest brainchild, the VL53L5CX sensor (investigated in this post) might be the answer, and would radically simplify the ‘parallel find’ problem as well. Unfortunately, the reality turned out to be somewhat less than spectacular. See the ’20 March 2023′ update to the above post for details.

Noodling around the STMicro site, I ran across the VL53L1X, which appears to offer about twice the maximum range than the VL53L0X; could this be the answer to my range issue? A quick check in my ‘sensors’ drawer didn’t turn up any, so I’m now on the prowl for a source for VL53L1X units. I Found a couple of VL53L1X units on eBay that I can get in a couple of days – yay!

Then I searched for and found a source for VL53L1X units that have roughly the same form factor and pinout as my current VL53L0X units, which should allow me to use a modified form of the 3-element array (one for each side) PCB I created earlier (see this post). Then I opened up the PCB design in DipTrace, modified it as required to get the pinouts correct, and then sent the design off to JLPCB for manufacture. With any luck, the PCB and the VL53L1X sensors should get here at about the same time!

After the usual number of errors, I was able to get a 3-element array of VL53L1X units working with a Teensy 3.5 on a plugboard, and then I moved the sensors to my newly-arrived V2 PCB’s, as shown in the following photo:

3-element array of VL53L1X sensors on new PCB

As shown in the photo, the array was pointed diagonally up toward the ceiling about 2.4-2.5m away, while the test was running, I waved my hand rapidly back and forth through the ‘beam’, to see how quickly the sensors could react. As shown in the following Excel plot, the answer is “pretty darned quickly!”.

My wife and I spent last week in Gatlinburg, Tenn. For those of you who have never heard of Gatlinburg, it is a small town nestled in the Great Smoky Mountains National Park. For most people, it is known for it’s beautiful scenery, great shopping, and its colorful history. However, for us bridge buffs, it is famous as the host of a regional bridge tournament, one of the largest in the nation.

There is a fair amount of down time between games, so I brought my VL53L1X test setup along to play with. This morning I was able to test my two new 3-element VL53L1X arrays connected to a Teensy 3.5 on a plugboard as shown in the following photo:

two 3-element VL53L1X arrays, 5 of which worked fine

I used my ‘VL53L1X_Pololu_V1.ino’ (shown in it’s entirety below) to test the arrays.

This program instantiates an array of VL53L1X objects named ‘sensors’, and the user initializes this array with the pin numbers attached to the XSHUT input of each device. In its original ‘out of the box’ configuration, the program expects three sensors to be attached to the default I2C port (Wire0), with XSHUT lines connected to controller pins 4, 5, & 6. As I described earlier in my 15 April update, I first modified the program to use Teensy 3.5 pins 32, 31, & 30 and verified that all three sensors were recognized and produced good data. Then I added a second 3-element sensor array on the same I2C bus, with XSHUT pins tied to Teensy 3.5 pins 4,5, & 6. Unfortunately, the program refused to recognize any of the sensors on the second array. So, I used the ‘sensorCount’ value and the contents of the xshutPins[sensorCount] array to selectively disable individual sensors on the second array, and I was able to determine that one of the VL53L1X sensors on the second array wasn’t responding for some reason, but the other two worked find. So, now I know that the Wire1 I2C bus on the Teensy 3.5 can handle at least 5 sensors, with no external pullup resistors – yay!

The next step was to move one of the arrays to Wire2 to more closely emulate the current situation on the robot. Here is the completed code, with only two of the three elements in the second array being utilized:

Here is a short section of the output from the above program:

From the above telemetry I have picked out the following lines:

Note that in the above there are two sensors set for 0X2A and two for 0X2B. This works, because the first three sensors (0, 1, & 2) are on the Wire1 I2C bus, and the remaining two (also sensors 0 & 1) are on the Wire2 bus. This setup essentially duplicates the dual 3-element sensor arrays on WallE3.

After getting the above program working with Wire1 & Wire2, I used it to modify my previous Teensy_VL53L0X_I2C_Slave_V4.ino program to use the new VL53L1X sensors. The new program , ‘Teensy_VL53L1X_I2C_Slave_V4.ino’ is shown in it’s entirety below:

22 April 2023 Update:

We got back home from Gatlinburg last night, and so this morning I decided to verify my theory that one of my six VL53L1X distance sensors was indeed defective. I have a pretty healthy skepticism about blaming hardware failures in a hardware/software system; in fact my motto is “Hardware never fails” (it does occasionally fail, but much much less often than a software issue causing the hardware to LOOK like it fails).

So, I loaded my one-sensor VL53L1X_Demo.ino example onto the Teensy 3.5 and used Wire0 (pins 18/19) to drive just this one sensor. Naturally it worked fine, as shwon below:

Well, as I suspected, the hardware seems OK so now I have to figure out why it didn’t respond properly in my six-element setup.

I replaced the ‘XSHUT’ wire from Teensy pin 5 to the sensor, but this did not solve the problem. I also tried driving the XSHUT line HIGH instead of letting it float, but no joy. Next I tried switching the suspect sensor with the one right next to it, to see if the problem follows the sensor. After several iterations, it now appears that the problem stays with the sensor associated with whatever sensor’s XSHUT pin is connected to Teensy 3.5 pin 5, or possibly with the 3-element array PCB itself.

I moved the XSHUT wire on T3.5 pin 5 to T3.5 pin 9, and re-ran the program. Same problem. Replaced the jumper wire from T3.5 pin 9 to the sensor; no change.

So now it is looking more likely that there is a problem on the PCB associated with the sensor socket closest to the T3.5-to-PCB cable. A glance at the back of the sensor socket revealed the problem – some idiot (whose name is being withheld to protect the author) had failed to solder three of the four socket pins to the PCB – oops!

How to waste a week of work – forget to solder three out of four socket pins to the PCB!

After fixing my solder (or lack thereof) screwup, everything started working – yay! Just as an aside, I claim credit for starting this troubleshooting effort with the statement “Hardware Never Fails”, which turned out to indeed be the case. Small comfort, but I’ll take it!

After confirming that both 3-element arrays were working properly, I added the rear sensor VL53L1X as a fourth sensor on Wire2, with XSHUT connected to pin 8. This mimics the hardware arrangement implemented on WallE3. Here’s a photo showing the plugboard setup:

In the above image, the ‘rear’ sensor is show standing upright on the right side of the plugboard.

And some typical output:

At this point I have the above ‘VL53L1X_Pololu_V1.ino’ program doing exactly what I want – handling seven different VL53L1X sensors on two different I2C busses. Now I need to port the necessary changes into my ‘Teensy_7VL53L1X_I2C_Slave_V1.ino’ program, which itself is a clone of ‘Teensy_7VL53L0X_I2C_Slave_V4.ino’, the program currently running on WallE3.

After a few minor missteps, I believe I now have ‘Teensy_7VL53L1X_I2C_Slave_V1.ino’ working with all seven VL53L1X sensors. Here’s the complete program:

And a sample of the output:

At this point the only remaining step is to physically swap out the sensors currently on WallE3 with the new ones, and reprogram the 2nd deck Teensy 3.5 with the new ‘Teensy_7VL53L1X_I2C_Slave_V1.ino’. With any luck at all, WallE3 won’t even notice anything has changed, except he will now be getting valid side/rear distance values from much farther away. We’ll see!

26 April 2023 Update:

After carefully installing all seven sensors (two 3-element arrays plus a rear-facing one) on WallE3’s second deck, and running the same Pololu example program on the second-deck Teensy 3.5, I discovered that one of the sensors was initializing properly, but was reporting ‘0 TIMEOUT’ for the distance – major bummer! After removing the left-hand sensor array from WallE3 and re-attaching it to my free-standing test Teensy 3.5, I eventually found that the problem was a broken connection INSIDE one of the 4-pin female headers on the PCB – yikes!

Anyway, got that fixed, re-attached the left-hand array to WallE3, and ran the Pololu program to verify proper operation, and now all seven element report believable distances, as shown below. In the output below, I used my hand to block the right, left, and rear sensors to verify proper performance.

Next, I loaded my new ‘Teensy_7VL53L1X_I2C_Slave_V1.ino’ program on WallE3’s second-deck Teensy 3.5 and verified that all seven sensors were operating properly, as shown in the output below:

The photo below shows both 3-element arrays mounted on WallE3. The rear sensor is hidden behind the red support tower:

The next step was to load ‘WallE3_Complete_V2.ino’ onto the Teensy 3.5 main controller and verify that it could indeed get distance information from the second-deck Teensy 3.5 VL53L1X array controller. Here’s some output from WallE3_Complete_V2.ino in ‘DISTANCES_ONLY’ mode. Again I used my hand to block the left, right, and rear sensors to verify proper operation.

The next step is to re-implement the distance compensation algorithms for each sensor. For the VL53L0X sensors, this was done using the procedure described in this post. The procedure involves taking sensor readings at several known distances, and using the data to develop a correction expression for each sensor.

To make this happen, I had to first disable the current compensation scheme for all the sensors. Then I ran ‘WallE3_Complete_V2.ino’ again in Distances Only mode to get the data needed to develop the compensation expressions.

Stay tuned,

Frank