Project showcase
Ultrasonic Rangefinder with Processing

Ultrasonic Rangefinder with Processing © GPL3+

Obstacle distance is measured using ultrasonic sensor and Arduino. The data is processed using Processing and the distance is marked.

  • 10,957 views
  • 4 comments
  • 19 respects

Components and supplies

Apps and online services

About this project

This project is used to measure the distance of the obstacles.Ultrasonic range module is used to measure the distance.The video contains complete tutorial.






Code

Arduino codeArduino
upload the code into the arduino
#include <Mouse.h>
const int trigpin= 8;
const int echopin= 7;
long duration;
int distance;
void setup()
{
  pinMode(trigpin,OUTPUT);
  pinMode(echopin,INPUT);
  Serial.begin(9600);
 
}
void loop()
{
  digitalWrite(trigpin,HIGH);
  delayMicroseconds(10);
  digitalWrite(trigpin,LOW);
  duration=pulseIn(echopin,HIGH);
  distance = duration*0.034/2;
  Serial.println(distance);
}
processing codeProcessing
run this code on processing to plot the disatance
import processing.serial.*;  
Serial myPort;  
String data="" ;
PFont  myFont;  
void setup()
{
size(1366,900); // size of processing window
background(0);// setting background color to black
myPort = new Serial(this, "COM3", 9600);
myPort.bufferUntil('\n');
}
void draw()
{
  background(0);
  textAlign(CENTER);
  fill(255);
  text(data,820,400);
  textSize(100);
  fill(#4B5DCE);
  text("              Distance :        cm",450,400);
   noFill();
   stroke(#4B5DCE);
}
void serialEvent(Serial myPort)
{
 
  data=myPort.readStringUntil('\n');
}

Schematics

Circuit diagram
connect the sensor to the arduino board as shown in the picture
Untitled 2 gnxskuh4ib

Comments

TEAM DIY

Vaisakh1997
Vaisakh1997
  • 7 projects
  • 8 followers
Default
shafeeque
  • 6 projects
  • 1 follower
Default
Boniface
  • 5 projects
  • 1 follower

Additional contributors

  • Developed by Vaisakh

Published on

October 17, 2017

Members who respect this project

AdambenzDefaultDefaultPhotoDefaultDefaultProfilepic

and 12 others

See similar projects
you might like

Similar projects you might like

Ultrasonic Ranging Using Arduino and Processing (Radar)

Project showcase by Bharath Rao M

  • 28,745 views
  • 14 comments
  • 48 respects

Basic Ultrasonic Tutorial

by Damien Murtagh

  • 7,462 views
  • 4 comments
  • 35 respects

Door Alarm With Ultrasonic Sensor

Project showcase by MattG

  • 4,899 views
  • 1 comment
  • 8 respects

Real time LPG monitoring system

Project showcase by TEAM DIY

  • 2,210 views
  • 1 comment
  • 2 respects
Add projectSign up / Login