Project – Digital Meter with Arduino

Project – Digital Meter with Arduino

Hi! Welcome to this new project! In this tutorial you will learn how to make a digital meter with an Arduino board. Easy project, good for beginners!

The project is about making a digital meter using an Ultrasonic module and an LCD. The Ultrasonic module will be used to calculate the distance between objects, and the LCD to print the distance on it.

What do you need?

To make a Digital Meter with Arduino we will use:

  • Ultrasonic Module -> read the tutorial here
  • I2C LCD -> read the tutorial here
  • Arduino board
  • Some jumpers

That’s all! few things, easy and cool project!

If you don’t know how to use this module, read the tutorial for each of it, (Link in list) and then follow this tutorial! In that way you will learn all about this 2 modules.

Schematics

Follow the schematics:

I2C LCD:

  • SDA -> A4
  • SCL -> A5
  • VCC -> 5V
  • GND -> GND
Schematic I2C LCD

Ultrasonic Module:

  • GND -> GND
  • VCC -> 5V
  • Trig -> D11
  • Echo -> D10
Ultrasonic module schematic

Sketch

Now we have to upload the sketch to make our Digital Meter with Arduino. NOTE that if you never used an I2C LCD you have to add the library to Arduino IDE! Here the link for the library Arduino-LiquidCrystal-I2C-library.

//Sketch by www.gatetronics.com

#include <LiquidCrystal_I2C.h>

#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 pinTrig = 11;
const int pinEcho = 10;

const float speedSound = 0.034;               

long lenght;
int distance;

void setup()
{
  pinMode(pinTrig, OUTPUT);
  pinMode(pinEcho, INPUT);
  lcd.begin();
  lcd.backlight();
}

void loop()
{
  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();
}

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: