Introduction: Mega 2560 Compact LCD Ultrasonic
This Instructable uses the DFRobot LCD Keypad Shield to give real time measurements in centimeters from the HC-SR04 ultrasonic sensor using the Arduino Mega 2560. I didn't verify accuracy using a ruler but it appears to be reasonably accurate.
This Instructable created with inspiration from Giedow. What a brilliant idea. Thank you for sharing.
New Ping Library for Arduino library Author Tim Eckel. Thank You Tim.
Step 1: Items Needed
Arduino Mega 2560 or Arduino Compatible Mega 2560
DFRobot Keypad LCD Shield
HC-SR04 Ultrasonic sensor
Step 2: Assemble
Stack the DFRobot Keypad LCD Shield on top of the Arduino 2560 ensuring you align the pins correctly.
Place the HC-SR04 Ultrasonic Sensor at the end of the Mega 2660 ensuring you align the pins as follows
VCC to pin 41
Trig or Trigger to pin 39
Echo to Pin 37
Gnd or Ground to pin 35
Step 3: The Code
Download the ping_lcd_shield.ino file and open it in the Arduino IDE and try it out.
Prior to uploading make sure the Arduino IDE is set to Arduino Mega 2560 under: Tools> Board.
You may have to select the proper com port as well. Tools> Port