Things used in this project

Hardware components:
Esquilo%20top%20small
Esquilo Air
×1
51gzz5eu9pl. sx425
Ultrasonic Sensor - HC-SR04 (Generic)
×1
181 02
Adafruit Standard LCD - 16x2 White on Blue
×1
09939 01
Rotary potentiometer (generic)
10k pot
×1
12002 04
Breadboard (generic)
×1
Male/Male Jumper Wires
I used: 5 red, 5 black, 2 white, 3 orange, 1 yellow, 2 green, 2 blue
×20

Schematics

Esquilo HC-SR04 1602A wiring diagram
Esquilo HC-SR04 1602A wiring diagram
Wvon49hbtkthxf2qsrml
Esquilo HC-SR04 Ultrasonic library
Port of Arduino Ultrasonic library to Esquilo
Esquilo 1602A library
Port of Arduino LiquidCrystal library to Esquilo

Code

Esquilo HC-SR04 1602A example codePlain text
Esquilo HC-SR04 1602A example code
// HC-SR04 Ultrasonic Range Finder output to 1602A LCD

require("GPIO");
require("Capture");

dofile("sd:/LiquidCrystal.nut");

trigPin <- GPIO(13);  // HC-SR04 trigger pin (output)
echoPin <- Capture(1);  // HC-SR04 echo pin (input)

trigPin.output();

local duration;
local distance;

local lcd = LiquidCrystal(0x00, 12, 0, 11, 5, 4, 3, 2, 0, 0, 0, 0);

// set up the LCD's number of columns and rows: 
lcd.begin(16, 2, 0);

while (true) {
    lcd.clear();
    lcd.home();
    trigPin.low();
    delay(2);
    trigPin.high();
    delay(10);
    trigPin.low();
    echoPin.arm(0, CAPTURE_EDGE_RISING);
    duration = echoPin.read(0);
    //print("duration=" + duration);
    distance = (duration / 2) / 29.1;
    //print("distance=" + distance);
    // Print a message to the LCD.
    lcd.print("distance=" + distance);
    delay(500);
}

Credits

27eae0443d051e9e246159707c1f2203
Leeland Heins

Hardware & Software H4x0r

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

ESP8266 Temperature Monitor
Easy
  • 1,811
  • 10

Full instructions

Get an alert if your fridge's temperature rises above 40 F (very dangerous!).

Biometric-Based Student Attendance System
Easy
  • 493
  • 9

This is a fun an easy DIY project that enables you automatically capture students attendance bio-metrically via fingerprint.

An Arduino-Based TV Smart Timer
Easy
  • 131
  • 3

Full instructions

Designed to be an easy to use device, it's a possible solution for parents with children spending too much time watching TV.

tinyGlow Smart LEDs
Easy
  • 914
  • 8

Protip

Bring the ATtiny85 and NeoPixels together in affordable, addressable lights!

Using 16x2 LCD with Arduino
Easy
  • 1,249
  • 14

Protip

Learn how to use the 16x2 LCD with Arduino for various projects.

Shooting Laser to Measure Distance
Easy
  • 3,626
  • 7

Protip

Using the VL53LO and an Arduino for distance measurement.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog