Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Dual TF LUNA LIDAR Distance Measurement System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Dual TF LUNA LIDAR Distance Measurement System

Circuit Documentation

Summary

This circuit integrates two TF LUNA LIDAR sensors with an Arduino UNO microcontroller and is powered by a 5V battery. The Arduino UNO serves as the central processing unit, interfacing with the LIDAR sensors via I2C communication protocol to collect distance measurements. The 5V battery provides power to the Arduino, which in turn powers the LIDAR sensors. The circuit is designed to measure distances and output the data through the Arduino's serial interface.

Component List

Arduino UNO

TF LUNA LIDAR (x2)

5V Battery

Wiring Details

Arduino UNO

TF LUNA LIDAR

5V Battery

Documented Code

Arduino UNO Code

#include <Arduino.h>
#include <Wire.h>        // Instantiate the Wire library
#include <TFLI2C.h>      // TFLuna-I2C Library v.0.1.1

TFLI2C tflI2C;

int16_t  tfDist;    // distance in centimeters
int16_t  tfAddr = TFL_DEF_ADR;  // Use this default I2C address

void setup(){
    Serial.begin(115200);  // Initialize serial port
    Wire.begin();           // Initialize Wire library
}

void loop(){
  
    if(tflI2C.getData(tfDist, tfAddr)){
        Serial.println(String(tfDist)+" cm / " + String(tfDist/2.54)+" inches");
    }
    delay(50);
}

File Name: sketch.ino

Description: This code initializes the I2C communication and serial communication at a baud rate of 115200. In the loop, it reads distance measurements from the TF LUNA LIDAR sensors and prints the distance in centimeters and inches to the serial monitor.

TF LUNA LIDAR Code

Both TF LUNA LIDAR sensors are controlled by the Arduino UNO and do not have separate code provided for them.

Note: The provided code snippets are associated with the Arduino UNO and are intended to be uploaded to the Arduino IDE for execution. The TF LUNA LIDAR sensors are interfaced with the Arduino using the I2C protocol, and their operation is managed by the Arduino's code.