Simple Arduino Earthquake Detector with GY-61 ADXL335 3-Axis Analog Accelerometer

preview_player
Показать описание
GY-61 ADXL335 3-Axis Analog Accelerometer
LCD 1602 Module

Simple Arduino #earthquake #detector with #accelerometer #sensor #arduino #esp32 #robot #robotics #engineering #education #educational #school #college #learning #code #coading #diy
Please Subscribe my Channel. ThankYou!
Рекомендации по теме
Комментарии
Автор

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#define buzzer 12
#define led 13

#define x A0
#define y A1
#define z A2


int xsample=0;
int ysample=0;
int zsample=0;
long start;
int buz=0;

/*Macros*/
#define samples 9
#define maxVal 3
#define minVal -3
#define buzTime 2000

void setup()
{
lcd.begin(16, 2);
Serial.begin(9600);
delay(1000);
lcd.print("EarthQuake ");
lcd.setCursor(0, 1);
lcd.print("Detector ");
delay(2000);
lcd.clear();

lcd.setCursor(0, 1);
lcd.print("Please wait...");
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
buz=0;
digitalWrite(buzzer, buz);
digitalWrite(led, buz);
for(int i=0;i<samples;i++)
{
xsample+=analogRead(x);
ysample+=analogRead(y);
zsample+=analogRead(z);
}

xsample/=samples;
ysample/=samples;
zsample/=samples;

delay(3000);
lcd.clear();
lcd.print("Calibrated");
delay(1000);
lcd.clear();
lcd.print("Device Ready");
delay(1000);
lcd.clear();
lcd.print(" X Y Z ");
}

void loop()
{
int value1=analogRead(x);
int value2=analogRead(y);
int value3=analogRead(z);

int xValue=xsample-value1;
int yValue=ysample-value2;
int zValue=zsample-value3;


lcd.setCursor(0, 1);
lcd.print(xValue);
lcd.setCursor(6, 1);
lcd.print(yValue);
lcd.setCursor(12, 1);
lcd.print(zValue);
delay(100);


if(xValue < minVal || xValue > maxVal || yValue < minVal || yValue > maxVal || zValue < minVal || zValue > maxVal)
{
if(buz == 0)
start=millis();
buz=1;
}

else if(buz == 1)
{
lcd.setCursor(0, 0);
lcd.print("Earthquake Alert ");
if(millis()>= start+buzTime)
buz=0;
}

else
{
lcd.clear();
lcd.print(" X Y Z ");
}

digitalWrite(buzzer, buz);
digitalWrite(led, buz);


Serial.print("x=");
Serial.println(xValue);
Serial.print("y=");
Serial.println(yValue);
Serial.print("z=");
Serial.println(zValue);
Serial.println(" $");
}

doit.
Автор

I have some problems with the lcd and I have the whole code and everything
The problem is my lcd is not showing me anything on the screen
Can you help me how to fix it?
I wanna see the 3 axes and the numbers

laserro
Автор

Bro im only having an 16×2 lcd display, i dont have a iic/i2c interface. Will it work without that if i give connection to main head

Vighnesh
Автор

What are the cables? M-M? F-F? M-F? And how long? 10CM? 20CM? 30CM?

aldrinaquino
Автор

what resistor value are u using can u give a circuit diagram

Vighnesh
Автор

Please provide components in description

durgabhavani
Автор

code in description is not opening pls give new

VisheshAtl
Автор

what does this numbers on LCD represents?

eeceesuj