kblox Neo+ Robotics Kit
About Lesson

Distance Measuring Device

Introduction

In this project, we are going to make a distance measuring device. For making this project we are going to use an ultrasonic sensor, Kblox Neo, LCD 16*2, Jumper wires for connection, and 1K resistors. All the components are connected with the Kblox Neo. Data pins of LCD are connected to digital pins (D6,5,3 and 2) of the board. The trigger and echo pin of the ultrasonic sensor is connected to D9 and D8 respectively. The ultrasonic sensor measures the distance of any object in its range, it uses ultrasonic waves for measuring distance. The trigger (transmitter) pin transmits the ultrasonic waves and the waves are received by the echo (receiver) pin and distance is calculated and the Kblox Neo board prints it on the LCD.

 

 

Components required

  • Kblox Neo
  • Ultrasonic sensor
  • LCD 16×2
  • Resistors 1K [Qty-1]
  • Jumper wires

Code

#include"kblox.h"

kblox kit;
kblox_lcd lcd(12,11,6,5,3,2);  // define lcd pins

void setup() {
  // put your setup code here, to run once:
kit.ultrasonic_begin(8,9);
lcd.begin(16,2);
lcd.print("Ultrasonic");
lcd.setCursor(0,1);
lcd.print("Distance Meter");
delay(2000);
lcd.clear();
}

void loop() {
  // put your main code here, to run repeatedly:
float d = kit.ultrasonic_read();
lcd.clear();
lcd.print("Distance");
lcd.print(d);
lcd.print("cm");
lcd.setCursor(0,1);
lcd.print(d/100);
lcd.print("m");
delay(1000);

}

Applications

  • Ultrasonic sensors can be used for making radar.
  • Can be used for making Blind Stick.
  • Can be used to make an obstacle avoiding rover.