Skip to content

VL6180X Time of Flight Proximity Sensor #38

@Mikefly123

Description

@Mikefly123

What Does This Component Do?

The VL6180X acts as our antenna's deployment sensor. By comparing the distance detected when the antennas are stowed vs when they are deployed, we can provide a feedback input to our burn wire command and tell it to stop once the antennas are free!

Click on this image for an example of the deployment!
Watch the Video

This component should:

  • Recognize the I2C Device on the Selected Bus
  • Call the distance (aka range) value from the sensor in mm
  • Call the ambient light value from the sensor
  • Allow for writing a calibration value to the sensor

Design Notes

VL6180 Datasheet
Adafruit VL6180X Library
Adafruit VL6180X Library Reference

This component might make more sense just being completely integrated into a burnwire component rather than a standalone, but we'll keep them separate for now just to make development a little easier. Although we don't currently use the VL6180 for anything after detecting a successful antenna deployment, we might be able to retrofit it as a sun sensor.

Note that the VL6180 is connected to the Battery Board through its debug connector to the top cap, which carries the I2C1 bus up to connect with the sensors on that top cap.

One of the most common hiccups with using the VL6180 is having to properly set a calibration value that is unique to each sensor. This calibration value basically sets a zero and you'll find many sensors that will report wildly different numbers if it is not set correctly.

Example CircuitPython Implementation

In pysquared.py

import adafruit_vl6180x  # LiDAR Distance Sensor for Antenna
...
class Satellite:
...
    def __init__(self):
        ...
        # Initialize LiDAR
        try:
            self.LiDAR = adafruit_vl6180x.VL6180X(self.i2c1, offset=0)
            self.hardware["LiDAR"] = True
        except Exception as e:
            self.debug_print("[ERROR][LiDAR]" + "".join(traceback.format_exception(e)))
        ...
        def distance(self):
        if self.hardware["LiDAR"]:
            try:
                distance_mm = 0
                for _ in range(10):
                    distance_mm += self.LiDAR.range
                    time.sleep(0.01)
                self.debug_print("distance measured = {0}mm".format(distance_mm / 10))
                return distance_mm / 10
            except Exception as e:
                self.debug_print(
                    "LiDAR error: " + "".join(traceback.format_exception(e))
                )
        else:
            self.debug_print("[WARNING] LiDAR not initialized")
        return 0

Reference Schematic

Screenshot 2024-11-04 at 10 22 51 PM

Required Hardware for Testing

  • V3b/c Battery Board
  • V2 Antenna Board

Metadata

Metadata

Assignees

Labels

new componentCreating a new component for this tasksensorRelating to a sensor implementation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions