loading

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

<p>where are the libraries you used? i downloaded the code but cmpilation gives error for your libraries not found.</p>
<p>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?</p>
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
<p>hello,</p><p>i cant find the correct library's, i found the adafruit gfx library but i can't find the library &quot;Adafruit_ILI9341_8bit_AS.h&quot; anywhere on the internet,</p><p>could u help me please?</p><p>thanks</p><p>joris</p>
<p>https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test</p>
<p>can you give me this library?</p><p>Adafruit_ILI9341_8bit_AS.h</p><p>and Adafruit_GFX_AS.h</p><p>please send at cs.gpinstrument@gmail.com</p>
<p>https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test</p>
<p>Could you send over the necessary Adafruit libraries to jatr7044@colorado.edu</p>
<p>https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test</p>
<p>Could you send over the necessary #include &lt;Adafruit_GFX_AS.h&gt;</p><p>#include &lt;Adafruit_ILI9341_8bit_AS.h&gt; to rzhuo@risd.edu</p>
<p>https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test</p>
<p>Could you please also send the libraries for this project to michael.kornberg@sdjaschool.com </p>
<p>https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2/graphics-test</p>
Could u plz send me a code for spfd5408 with arduino
<p>Very good project. Thanks. </p>
<p>////////////////////////////////</p><p>/* Maybe like this */</p><p>////////////////////////////////</p><p>void setup(void) {</p><p> pinMode(triggerPin, OUTPUT);</p><p> pinMode(echoPin, INPUT);</p><p> tft.reset();</p><p> delay(10);</p><p> tft.begin(0x9341);</p><p> tft.setRotation(1);</p><p> tft.fillScreen(BLACK);</p><p> tft.setCursor(15, 20);</p><p> tft.setTextColor(GREEN);</p><p> tft.setTextSize(6);</p><p> tft.println(&quot;Distance&quot;);</p><p> tft.setCursor(150,90);</p><p> tft.println(&quot;CM&quot;);</p><p> tft.setCursor(150,150);</p><p> tft.println(&quot;Inch&quot;);</p><p>}</p><p>void loop(void) {</p><p> getdistance();</p><p>delay(1000);</p><p>}</p><p>void getdistance() {</p><p> int duration, distance, distanceinch;</p><p> digitalWrite(triggerPin, HIGH);</p><p> delay(10);</p><p> digitalWrite(triggerPin, LOW);</p><p> duration = pulseIn(echoPin, HIGH);</p><p> distance = (duration/2) / 29.1;</p><p> tft.setTextSize(6);</p><p> tft.setTextColor(CYAN);</p><p> tft.setCursor(30, 90);</p><p> tft.println(distance);</p><p> tft.setTextColor(YELLOW);</p><p> distanceinch= distance*0.3937;</p><p> tft.setCursor(30, 150);</p><p> tft.println(distanceinch);</p><p>}<br><br></p>
<p>thank you for your suggestion.</p><p>the code can be much better, this is just a &quot;first working demo&quot;.</p>
<p>nice beginning but it would be better if you only reflesh the read data except distance, cm and inch.</p>
<p>really very good for beginner....</p>

About This Instructable

18,497views

26favorites

License:

More by TheOverclocker:Sanding and Painting furniture with a spray gun QAV250 Racing FPV Quadcopter F450 Flame Wheel smart quadcoper for carrying more than 1 kg 
Add instructable to: