Project showcase
Digital Level

Digital Level © GPL3+

In this project I created a pretty simple digital level using a LCD screen and a gyro sensor.

  • 1,254 views
  • 0 comments
  • 5 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

What inspired me to make this is that on most levels it is hard to tell if the level is even there for, I built the level. The project is actually really simple. All you have to do is conect the gyro sensors SCL and SDA to the boards SCL and SDA then you connect the LCD screen how you normally would.

Code

digital levelC/C++
first, it sets up the LCD and the gyro, than it takes the reading and displays it.
#include<Wire.h>
const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // put your setup code here, to run once:
Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  Serial.begin(9600);
lcd.begin(16, 2);
}


void loop() {
  
Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
  AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)    
  AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L#
  
   lcd.print(" | X = "); lcd.print(GyX);
   lcd.setCursor(0,1)
;   lcd.print(" | Y = "); lcd.print(GyY);
delay(500)
;lcd.clear()

;}

Schematics

digital_level_lVaCw37Frw.fzz
digital_level_lVaCw37Frw.fzz

Comments

Similar projects you might like

Digital Level

Project tutorial by 4D Makers

  • 2,338 views
  • 3 comments
  • 8 respects

Digital 3D Printer Filament Counter Using PS/2 Mouse

Project in progress by ArtSuzhou

  • 8,440 views
  • 11 comments
  • 32 respects

Digital Clock

Project in progress by Team SharKode

  • 6,847 views
  • 4 comments
  • 25 respects

Simple Arduino Digital Clock Without RTC

Project in progress by Annlee Fores

  • 101,623 views
  • 25 comments
  • 93 respects

Level Platform Using Accelerometer

Project tutorial by Mark Tashiro

  • 18,943 views
  • 16 comments
  • 33 respects
Add projectSign up / Login