Week 9 - Input Devices

Fab Academy Week 9 documentation futuring Time of Flight Sensor.

Assignment

Group assignment: Probe an input device(s)’s analog levels and digital signals (As a minimum, you should demonstrate the use of a multimeter and an oscilloscope.) Document your work on the group work page and reflect on your individual page what you learned

Link to the Group Assignment Individual assignment:

  • Measure something: add a sensor to a microcontroller board that you have designed and read it.

Time of Flight

For this assignment I will be using the PCB I made in the Electronics Production Weekly Assignemnt to power and read the distance data of the TOC200c VL53L0X time of flight sensor I used the Adafruit_VL53L0X library which I downloaded from aruidono library manager. And since my board used I2C for communucation I used Wire.

#include <Wire.h>
#include <Adafruit_VL53L0X.h>

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);
  while (!Serial) delay(1);

  Wire.begin();

  if (!lox.begin()) {
    Serial.println("Failed to boot VL53L0X");
    while (1);
  }
}

void loop() {
  VL53L0X_RangingMeasurementData_t measure;

  lox.rangingTest(&measure, false);

  if (measure.RangeStatus != 4) {  // 4 = out of range
    float distance_cm = measure.RangeMilliMeter / 10.0;
    Serial.print(distance_cm);
    Serial.println(" cm");
  } else {
    Serial.println("Out of range");
  }

  delay(100);
}

so the code gets the data as mm diveds it by 10 to get cm and then prints it on the serial so I can plot it or read it through the serial monitor.

Here is the video of me trying out the sensor.

This week I learned how to get data through a Sensor and reading it using the serial monitor on my Xiao Esp32-C6 based PCB.

Built with Hugo
Theme Stack designed by Jimmy