Course: Embedded Systems (CS336) | Platform: AVR ATmega328P
Measuring dimensions in real-time industrial environments is challenging using traditional ultrasonic or IR sensors due to beam spread and slow response.
Many applications require a compact and fast height measurement system that can detect an object’s height instantly as it enters the sensing region.
Modern automated lines (like conveyor belts) move fast.
Applications like: Automatic vehicle classification at tolls, parcel dimensioning in logistics, and quality control on assembly lines all require instant, non-contact height data to function efficiently.
A laser-based system using the VL53L0X Time-of-Flight sensor mounted at a fixed angle, interfaced with an Arduino UNO.
#include <LiquidCrystal.h> // LCD PIN MAPPING // RS, E, D4, D5, D6, D7 to arduino PORT D // VL53L0X SENSOR OBJECT Adafruit_VL53L0X lox = Adafruit_VL53L0X(); // SENSOR HEIGHT FROM FLOOR IN CM const float SENSOR_HEIGHT_CM = 200.0; void setup() { // Initialize the LCD lcd.begin(16, 2); lcd.print("Height Meter"); // Initialize the VL53L0X distance sensor lox.begin(); } void loop() { // Structure to store distance measurement data VL53L0X_RangingMeasurementData_t measure; // Check if the measurement is valid from the previously returned object if (measure.RangeStatus != 4) { // DISTANCE CALCULATION float distance_mm = measure.RangeMilliMeter; float distance_cm = (distance_mm / 10.0) - 1.9; // HEIGHT CALCULATION float height_cm = (distance_cm * 0.70710678) + SENSOR_HEIGHT_CM; // Noise filtering: height should never be negative if (height_cm < 0) height_cm = 0; // CONVERSION FROM CM TO FEET & INCHES int total_inches = height_cm / 2.54; int feet = total_inches / 12; int inches = total_inches % 12; // LCD DISPLAY lcd.setCursor(0, 0); lcd.print("Dist: "); lcd.print(distance_cm, 1); lcd.print(" cm "); lcd.setCursor(0, 1); lcd.print("H:"); lcd.print(height_cm, 0); lcd.print("cm "); lcd.print(feet); lcd.print("'"); lcd.print(inches); lcd.print("\" "); } else { lcd.setCursor(0, 1); lcd.print("Out of Range "); } // Small delay to actually realize the next measurement delay(1000); }
The system uses trigonometry to derive vertical height from the angled distance reading.
Hypotenuse: Raw distance reading.
Offset: Sensor height from floor.
Height = Hypotenuse × sin(45°) + Distance_of_sensor_from_floor
Instant detection and LCD update latency under 50ms.
Seamless automated conversion between Centimeters, Feet, and Inches.
| Member | Key Responsibilities |
|---|---|
| Faisal Iqbal | Sensor integration, Trigonometry logic calibration |
| Hassan Shahid | Circuit design, Hardware assembly, LCD interfacing |
| Syed Muneeb | Embedded C++ programming, Debugging |
| Talha Shafat | Project documentation, Presentation design, Testing |
We successfully designed and implemented a non-contact height measurement system.
Thank you for your attention.