Body Height Measure with VL53L0X Distance Sensor

Introduction

In this Project, we are going to make a Body Height Measure with VL53L0X Distance Sensor. that Measuring the height of a person can be a useful task in various fields, from healthcare to sports. Here we present a body height measuring system using the VL53L0X distance sensor. The VL53L0X is a Time-of-Flight (ToF) laser-ranging module that can accurately measure the distance between the sensor and the target. By measuring the distance from the ground to the top of a person’s head, we can calculate their height. The measured height is displayed on a MAX7219 LED matrix and can be reset using push buttons.

Hardware Required

Components#Buy From Amazon
Arduino Nano1Buy Now
VL53L0X distance sensor1Buy Now
MAX7219 LED Matrix2Buy Now
Push Button3Buy Now
Resistors 1KΩ3Buy Now
9v DC Adapter (Optional)1Buy Now
Jumper WiresFewBuy Now
Breadboard1Buy Now

What is VL53L0X Distance Sensor?

The VL53L0X Distance Sensor is a module that integrates the VL53L0X ToF sensor with a microcontroller, power management unit, and communication interface. The module provides accurate distance measurements, ambient light sensing, and programmable interrupt output.

Pinout

VL53L0X-Laser-Distance-Sensor-Pinout

Pin Configuration

Pin NamePin Type
VCCIt is the voltage supply pin.
GNDIt is Ground Pin
SCLIt is the digital serial clock input pin.
SDAIt is a serial data digital input/output pin for communication.
GPIO1It is the programmable interrupt output pin.
XSHUTIt is an active-low shutdown input pin.

Specifications

  1. Operating voltage: 2.8V to 5V
  2. Range: up to 2 meters
  3. Accuracy: ±3%
  4. Measurement rate: up to 60Hz
  5. Ambient light sensing range: 0.1 to 100,000 lux
  6. Communication interface: I2C

Features

  1. Integrated laser emitter and detector
  2. Low power consumption
  3. Small form factor
  4. Interrupt output for range detection and ambient light sensing
  5. Programmable I2C address

Circuit Construction

The circuit consists of an Arduino Nano board, a VL53L0X distance sensor, a MAX7219 LED matrix, and three push buttons. The VL53L0X sensor connects to the Arduino Nano through the I2C interface. The MAX7219 LED matrix connects to the Arduino Nano using the SPI interface. Three push buttons are using to reset the measurement, switch between centimeters and inches, and start the measurement.

Circuit Diagram

Body-Height-Measure-using-VL53L0X-Distance-Sensor-Arduino-circuit

Working Explanations

The system works by measuring the distance from the sensor to the ground and the distance from the sensor to the top of the person’s head. By subtracting the two distances, we can calculate the height of the person. The measured height is displayed on the MAX7219 LED matrix. The push buttons are used to reset the measurement, switch between centimeters and inches, and start the measurement.

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow

Code

//For more Projects: www.arduinocircuit.com

#include <MaxMatrix.h> //include matrix library
#include <EEPROM.h>
const PROGMEM prog_uchar CH[] = {
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // ”
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // ‘
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // –
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
2, 8, B00100100, B00000000, B00000000, B00000000, B00000000, // :
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // <
3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // =
3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
};
int pinIncrease = 2;
int pinDecrease = 3;
int pinSetting = 4;
int SetPoint = 0;
byte height;
int data = 12; // DIN pin of MAX7219 module
int load = 10; // CS pin of MAX7219 module
int clock = 11; // CLK pin of MAX7219 module
int maxInUse = 2; //change this variable to set how many MAX7219’s you’ll use
MaxMatrix m(data, load, clock, maxInUse); // define module
byte buffer[10];
#include <Wire.h>
#include <VL53L0X.h>
int a;
VL53L0X sensor;
void setup(){
pinMode(pinIncrease, INPUT);
pinMode(pinDecrease, INPUT);
pinMode(pinSetting, INPUT);
Wire.begin();
sensor.init();
m.init(); // module initialize
m.setIntensity(1); // dot matix intensity 0-15
Serial.begin(9600); // serial communication initialize
sensor.startContinuous();
}
void loop(){
if(digitalRead(pinSetting) == HIGH){
SetPoint = constrain(SetPoint, 0, 255);
EEPROM.write(1, SetPoint);
height = EEPROM.read(1);
m.init();
m.setIntensity(1);
a=height-(sensor.readRangeContinuousMillimeters()/10);
char sens[4];
itoa(a,sens,10); //convert int to char!!!!
printString(sens);
setting();
delay(100);
}

else if(digitalRead(pinSetting) == LOW){
height = EEPROM.read(1);
m.init();
m.setIntensity(1);
a=height-(sensor.readRangeContinuousMillimeters()/10);
char sens[4];
itoa(a,sens,10); //convert int to char!!!!
printString(sens);
delay(500);

}

}

void printCharWithShift(char c, int shift_speed){
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(maxInUse*8, 0, buffer);
m.setColumn(maxInUse*8 + buffer[0], 0);

for (int i=0; i<buffer[0]+1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}

void printStringWithShift(char* s, int shift_speed){
while (*s != 0){
printCharWithShift(*s, shift_speed);
s++;
}
}

void printString(char* s)
{
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s – 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}

void setting(){
if(digitalRead(pinIncrease) == HIGH){
SetPoint++;
}else if(digitalRead(pinDecrease) == HIGH){
SetPoint–;
}
}

/*
for video this project see https://www.youtube.com/watch?v=uKtUyaZt9Uo
*/

Applications

  1. Healthcare: The system uses in healthcare to measure the height of patients accurately.
  2. Sports: The system uses in sports to measure the height of athletes.
  3. Anthropometry: The system uses in anthropometry to measure the height of people for research purposes.
  4. Home: The system uses in homes to measure the height of family members.
  5. Education: The system can be used in educational institutions to teach students about distance measurement and height calculation.

Conclusion

The body height measuring system using the VL53L0X distance sensor is an accurate and useful system that operates in various fields, from healthcare to sports. The construction of this Project is easy to make and use. we also customize this Project for use for different applications.

Leave a Comment


error: