Distance Measurement With 2.4 Ftf and Ultrasonic Sensor

Introduction: Distance Measurement With 2.4 Ftf and Ultrasonic Sensor

this is very simple arduino circuit with HC-SR04 ultrasonic sensor and 2.4 inch tft display, powered by arduino uno.
the arduino uno calculate the distance and update the display every 1 second.

watch this video to see how it works.

Step 1: Tools and Parts

the only tool we need is a pc with arduino IDE.

in this example we use the Adafruit_GFX library to use the tft display.

required parts:
1 ARDUINO UNO + 2.4 TFT (you can use any arduino you want..)

1 ultrasonic sensor

20 jumper cable wires

1 6v battery or power supply

Step 2: Conecting and Coding

the tft shield can fit to the arduino but the ultrasonic need some wires.

connect the ultrasonic sensor trigger pin to the arduino pin 11

connect the ultrasonic sensor echo pin to the arduino pin 10

connect the ultrasonic sensor vcc to 5v

connect the ultrasonic sensor gnd to the gnd

upload the code and make a test

Three Ingredient Challenge

Participated in the
Three Ingredient Challenge

Robotics Contest

Participated in the
Robotics Contest

Tech Contest

Participated in the
Tech Contest

1 Person Made This Project!

Recommendations

  • Make it Glow Contest

    Make it Glow Contest
  • First Time Author Contest

    First Time Author Contest
  • PCB Challenge

    PCB Challenge

20 Discussions

0
Pierrot1610
Pierrot1610

1 year ago

Bonjour très bon projet. N'aillent pas trouvé les librairies j'ai légèrement modifier le programme. J'ai mis une photo avec mes modifications (1et 2 ligne et le début de la ligne au dessus de void setup. De plus je me suis rendu compte que le pin 3v3 n'était pas utiles. Bon bricolage

DSC_0002.JPG15524121066721517739993.jpg
0
jnh123
jnh123

3 years ago

Adafruit_ILI9341_8bit_AS.h is not on this planet. can't find it any where...............

1
zeesh1979
zeesh1979

4 years ago

where are the libraries you used? i downloaded the code but cmpilation gives error for your libraries not found.

0
lokeshch007
lokeshch007

4 years ago

I got everything done, but that flashing of display is not looking good for eyes. can't we make display static like other LCD displays?

0
trAns__EI Capitian

I need help in connections as m new to it....my code is ready but i am getting stuck i middle of circuit connections please help

0
jorish1
jorish1

4 years ago

hello,

i cant find the correct library's, i found the adafruit gfx library but i can't find the library "Adafruit_ILI9341_8bit_AS.h" anywhere on the internet,

could u help me please?

thanks

joris

0
Ritam_pramanik
Ritam_pramanik

Reply 4 years ago

https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test

0
gunturp2
gunturp2

4 years ago

can you give me this library?

Adafruit_ILI9341_8bit_AS.h

and Adafruit_GFX_AS.h

please send at cs.gpinstrument@gmail.com

0
Ritam_pramanik
Ritam_pramanik

Reply 4 years ago

https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test

0
JacobT52
JacobT52

4 years ago

Could you send over the necessary Adafruit libraries to jatr7044@colorado.edu

0
Ritam_pramanik
Ritam_pramanik

Reply 4 years ago

https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test

0
momo-zhuo
momo-zhuo

4 years ago

Could you send over the necessary #include <Adafruit_GFX_AS.h>

#include <Adafruit_ILI9341_8bit_AS.h> to rzhuo@risd.edu

0
Ritam_pramanik
Ritam_pramanik

Reply 4 years ago

https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test

0
mcornberg
mcornberg

4 years ago

Could you please also send the libraries for this project to michael.kornberg@sdjaschool.com

0
Ritam_pramanik
Ritam_pramanik

Reply 4 years ago

https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test

0
Zjarna
Zjarna

4 years ago

Could u plz send me a code for spfd5408 with arduino

0
ffssfurkan
ffssfurkan

5 years ago

////////////////////////////////

/* Maybe like this */

////////////////////////////////

void setup(void) {

pinMode(triggerPin, OUTPUT);

pinMode(echoPin, INPUT);

tft.reset();

delay(10);

tft.begin(0x9341);

tft.setRotation(1);

tft.fillScreen(BLACK);

tft.setCursor(15, 20);

tft.setTextColor(GREEN);

tft.setTextSize(6);

tft.println("Distance");

tft.setCursor(150,90);

tft.println("CM");

tft.setCursor(150,150);

tft.println("Inch");

}

void loop(void) {

getdistance();

delay(1000);

}

void getdistance() {

int duration, distance, distanceinch;

digitalWrite(triggerPin, HIGH);

delay(10);

digitalWrite(triggerPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;

tft.setTextSize(6);

tft.setTextColor(CYAN);

tft.setCursor(30, 90);

tft.println(distance);

tft.setTextColor(YELLOW);

distanceinch= distance*0.3937;

tft.setCursor(30, 150);

tft.println(distanceinch);

}

0
TheOverclocker
TheOverclocker

Reply 5 years ago

thank you for your suggestion.

the code can be much better, this is just a "first working demo".

0
ffssfurkan
ffssfurkan

5 years ago

nice beginning but it would be better if you only reflesh the read data except distance, cm and inch.

0
skumar231
skumar231

5 years ago

really very good for beginner....