Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VL6180X Time of Flight Proximity Sensor #38

Open
4 tasks
Tracked by #30
Mikefly123 opened this issue Oct 21, 2024 · 0 comments
Open
4 tasks
Tracked by #30

VL6180X Time of Flight Proximity Sensor #38

Mikefly123 opened this issue Oct 21, 2024 · 0 comments
Assignees
Labels
new component Creating a new component for this task sensor Relating to a sensor implementation

Comments

@Mikefly123
Copy link
Member

Mikefly123 commented Oct 21, 2024

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
@Mikefly123 Mikefly123 mentioned this issue Oct 21, 2024
12 tasks
@Mikefly123 Mikefly123 added sensor Relating to a sensor implementation new component Creating a new component for this task labels Oct 21, 2024
@Mikefly123 Mikefly123 added this to the fprime-proves-v1.0 milestone Oct 21, 2024
@Mikefly123 Mikefly123 added the draft Currently being drafted label Oct 21, 2024
@Mikefly123 Mikefly123 removed the draft Currently being drafted label Nov 5, 2024
@TaylorGilg TaylorGilg self-assigned this Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new component Creating a new component for this task sensor Relating to a sensor implementation
Projects
None yet
Development

No branches or pull requests

2 participants