Project – Digital laser meter with Arduino

Project – Digital laser meter with Arduino

In this tutorial we will explain how to make a digital laser meter with an Arduino! Follow this tutorial and you will learn how to make it!

Join also our Instagram Page to know always when a new project is posted and enable notification if you want to know when we publish new post!

First of all:

What’s that project about?

In this project we will use a laser to target something and then we will measure the distance with the ultrasonic module!

We yet explained how to use some of the module that we are going to use. Let’s see what we need!

What do you need to make a Digital laser meter with Arduino?

  • Laser
  • Ultrasonic module
  • Arduino
  • I2C LCD

We yet explained how to use the Ultrasonic Module and you can read here the tutorial -> Ultrasonic Module Tutorial.

And we also yet explained how to use the I2C LCD -> I2C LCD Tutorial.

Schematics

Now that you know what you need to make this project, we have to make the circuit!

Schematic I2C LCD
Ultrasonic module schematic

For the Laser you have to do this connections:

  • the “-” -> GND
  • the “+” -> 3

Sketch

Now we have to upload the code to the Arduino Board!

//Sketch by www.gatetronics.com
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  //set the LCD address to 0x27 for a 16 chars and 2 line display


const int buttonPin = 7;
const int laserPin = 3;

// Variables will change:
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin

// the following variables are unsigned longs because the time, measured in
// milliseconds, will quickly become a bigger number than can be stored in an int.
unsigned long lastDebounceTime = 0;  // the last time the output pin was toggled
unsigned long debounceDelay = 50;    // the debounce time; increase if the output flickers


const int pinTrig = 11;
const int pinEcho = 10;

const float speedSound = 0.034;               

long lenght;
int distance;

void setup()
{  
  pinMode(laserPin,OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
  pinMode(pinTrig, OUTPUT);
  pinMode(pinEcho, INPUT);
  lcd.init();
  lcd.backlight();
}

void loop()
{
  digitalWrite(laserPin,HIGH);
  digitalWrite(pinTrig, LOW);
  delayMicroseconds(5);
  digitalWrite(pinTrig, HIGH);
  delayMicroseconds(10);
  digitalWrite(pinTrig, LOW);                 
  
  lenght = pulseIn(pinEcho, HIGH);
  distance= lenght*speedSound/2;
  
  lcd.setCursor(1,0);
  lcd.print("Distance: ");                
  lcd.print(distance);
  delay(100);
  lcd.clear();
}

Hope you liked doing this project! If you make it, please share with me on Instagram to our Instagram Page! Join us!

Davide Busco

Davide Busco is an engineering student at Federico II University of Naples. He uses his passion and studies to create his projects. He loves be a maker and spread his knowledge. Moreover he has gained the second place in a national makers-tournament between Italian's Universities.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_GBEnglish (UK)
it_ITItaliano en_GBEnglish (UK)
%d bloggers like this: