Ordinato entro le 14:00 nei giorni lavorativi = spedito in giornata 30 giorni per il recesso Garanzia di 1 anno
← Torna alla panoramica

La riproduzione carica il video da YouTube.

Schema di collegamento ed esempio di codice

Ecco come collegare il TOF050C-VL6180X Sensore di distanza Time-Of-Flight molto preciso a un Arduino UNO o ESP32, con uno sketch di esempio che puoi caricare subito.

Misurazione del sensore di distanza VL6180X

Questo progetto misura con precisione distanze ravvicinate (fino a ~200mm) usando il sensore Time-of-Flight VL6180X tramite I2C. Collega il sensore all'alimentazione e ai pin I2C, poi apri il Monitor Seriale a 115200 baud per vedere le misure di distanza in millimetri in tempo reale.

Schema di collegamento: TOF050C-VL6180X Sensore di distanza Time-Of-Flight molto preciso su un Arduino UNO
Schema di collegamento · Clicca per ingrandire
Tabella di collegamento: TOF050C-VL6180X Sensore di distanza Time-Of-Flight molto preciso su un Arduino UNO
Tabella di collegamento · Clicca per ingrandire
VL6180X_Distance_Sensor_Measurement.ino · compilato e testato
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL6180X Distance Sensor Measurement
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : TOF050C-VL6180X Distance Sensor Time-Of-Flight high precision
 *  Libraries : Adafruit_VL6180X 1.4.4
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <Adafruit_VL6180X.h>

Adafruit_VL6180X vl = Adafruit_VL6180X();

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

  Serial.println(F("Initializing VL6180X sensor..."));
  if (!vl.begin()) {
    Serial.println(F("Failed to find VL6180X sensor! Check wiring."));
    while (1);
  }
  Serial.println(F("VL6180X sensor ready!"));
}

void loop() {
  uint8_t range = vl.readRange();
  uint8_t status = vl.readRangeStatus();

  if (status == VL6180X_ERROR_NONE) {
    Serial.print(F("Distance: "));
    Serial.print(range);
    Serial.println(F(" mm"));
  } else {
    if (status >= VL6180X_ERROR_SYSERR_1 && status <= VL6180X_ERROR_SYSERR_5) {
      Serial.println(F("System error"));
    } else if (status == VL6180X_ERROR_ECEFAIL) {
      Serial.println(F("ECE failure"));
    } else if (status == VL6180X_ERROR_NOCONVERGE) {
      Serial.println(F("No convergence"));
    } else if (status == VL6180X_ERROR_RANGEIGNORE) {
      Serial.println(F("Ignoring range"));
    } else if (status == VL6180X_ERROR_SNR) {
      Serial.println(F("Signal-to-Noise Ratio error"));
    } else if (status == VL6180X_ERROR_RAWUFLOW) {
      Serial.println(F("Raw reading underflow"));
    } else if (status == VL6180X_ERROR_RAWOFLOW) {
      Serial.println(F("Raw reading overflow"));
    } else if (status == VL6180X_ERROR_RANGEUFLOW) {
      Serial.println(F("Range reading underflow"));
    } else if (status == VL6180X_ERROR_RANGEOFLOW) {
      Serial.println(F("Out of range (>200mm)"));
    }
  }

  delay(200);
}

Librerie necessarie: Adafruit_VL6180X 1.4.4

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Sensore di distanza e luce VL6180X con ESP32

Questo progetto misura la distanza a corto raggio (0–100 mm) e i livelli di luce ambientale utilizzando il sensore Time-of-Flight TOF050C VL6180X tramite I2C. Collega il sensore direttamente al 3.3V dell'ESP32 e ai pin I2C predefiniti (GPIO 21 e 22). Apri il Serial Monitor a 115200 baud per visualizzare in tempo reale le misure di distanza e di lux ambientale.

Schema di collegamento: TOF050C-VL6180X Sensore di distanza Time-Of-Flight molto preciso su un ESP32 DevKit V1
Schema di collegamento · Clicca per ingrandire
Tabella di collegamento: TOF050C-VL6180X Sensore di distanza Time-Of-Flight molto preciso su un ESP32 DevKit V1
Tabella di collegamento · Clicca per ingrandire
VL6180X_Distance_Light_Sensor_with_ESP32.ino · compilato e testato
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL6180X Distance & Light Sensor with ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : TOF050C-VL6180X Distance Sensor Time-Of-Flight high precision
 *  Libraries : Adafruit_VL6180X 1.4.4
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <Adafruit_VL6180X.h>

Adafruit_VL6180X vl = Adafruit_VL6180X();

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

  Serial.println("VL6180X Distance & Light Sensor Demo");

  Wire.begin(21, 22);

  if (!vl.begin()) {
    Serial.println("Failed to find VL6180X sensor! Check wiring.");
    while (1) delay(100);
  }

  Serial.println("VL6180X found and initialized!");
}

void loop() {
  float lux = vl.readLux(VL6180X_ALS_GAIN_5);
  uint8_t range = vl.readRange();
  uint8_t status = vl.readRangeStatus();

  Serial.print("Ambient Light: ");
  Serial.print(lux);
  Serial.print(" Lux | ");

  if (status == VL6180X_ERROR_NONE) {
    Serial.print("Distance: ");
    Serial.print(range);
    Serial.println(" mm");
  } else {
    Serial.print("Range Status Error (Code: ");
    Serial.print(status);
    Serial.println(")");
  }

  delay(200);
}

Librerie necessarie: Adafruit_VL6180X 1.4.4

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Visti di recente

Cavo connettore/terminale a 10 pin, 1 lato - maschio, 26AWG 20cm, XH2.54mm

Cavo connettore/terminale a 10 pin, 1 lato - maschio, 26AWG 20cm, XH2.54mm

€ 0,95
Connettore di alimentazione DC / Jack barrel maschio / Barrel Jack Maschio 5,5 x 2,1 mm

Connettore di alimentazione DC / Jack barrel maschio / Barrel Jack Maschio 5,5 x 2,1 mm

€ 0,75
Staffa larga per robotica - staffa servo a U PTZ - sistema di montaggio robot fai-da-te

Staffa larga per robotica - staffa servo a U PTZ - sistema di montaggio robot fai-da-te

€ 2,60