Height Measurement Using Ultrasonic Sensor and Dot Matrix on Maker UNO

Let's do a height measurement!

Introduction

Height is the measurement of someone or something from head to foot or from base to top. Before this, we measure our height using a scale or measuring tape or ruler. Now, let’s try to make something that can measure our height in easiest way.

Video

This video will show you how to make a height measurement using ultrasonic sensor and dot matrix on Arduino.

Hardware Preparation

This is the components needed.

Sample Code

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
#define scrollSpeed 70 // scroll speed
#define scrollPause 0 // ms of pause after finished displaying message
// Hardware SPI connection
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
// MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
// sets scrolling direction if slider in middle at start
textEffect_t scrollEffect = PA_SCROLL_LEFT;
textPosition_t scrollAlign = PA_LEFT; // how to align the text
#define BUF_SIZE 75 // Maximum of 75 characters
#define trigPin A0
#define echoPin A1
char testStr[10] = { "" };
String heightStr = "";
long duration;
int distance;
int height;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
P.begin();
}
void loop() {
measure();
if (distance > 60) {
P.displayText("TINGGI", PA_LEFT, 0, 0, PA_PRINT, PA_NO_EFFECT);
} else {
height = 180 - distance;
heightStr = String(height, DEC) + "cm";
heightStr.toCharArray(testStr, 75);
P.displayText(testStr, PA_CENTER, 0, 0, PA_PRINT, PA_NO_EFFECT);
}
P.displayAnimate();
delay(100);
}
void measure() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.017;
}
view raw Height.ino hosted with ❤ by GitHub

References :

  1. Displaying on MAX7219 Dot Matrix Using Arduino

Thank you

Thank you for reading this tutorial and we hope it helps your project development. If you have any technical inquiry, please post at Cytron Technical Forum.

8 thoughts on “Height Measurement Using Ultrasonic Sensor and Dot Matrix on Maker UNO”

  1. Hi. Very nice proyect. It only detects me if I move, I think it is related to material density. Is there a way to improve that? Thank you.

  2. Fuad Bin Samsudin

    Boleh bagi penuh code untuk height measurement. saya dah ikut contoh code yang diberi tapi tidak berfungsi.

  3. Hi 🙂 it’s very useful and amazing project …can u perhaps share the schematic diagram?thank youu in advance

  4. Do we need to connect any power source to this project?
    Others project I saw battery as require item.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Raspberry Pi Pico VS Arduino MKRZero
Raspberry Pi Pico VS Teensy LC
A New Challenger in MCU Platform – Raspberry Pi Pico
Raspberry Pi Pico VS Arduino UNO
Raspberry Pi Pico VS micro:bit V2
Scroll to Top