Alarm Project Idea Help

Hi All,
I have joined the forum to seek help from the talented crew here.

I want to create a mini alarm using a processor and an MPU6050.
I have looked at a lot of the published projects and they seem to make sense, but I want to add a feature.
Ideally, I want the alarm module to have a "warning" level that operates a buzzer momenterally and then if movement increases it activates the full alarm, i assume via a relay and a piezo siren.

I cant seem to find anything that explains or shows the 2 step process.

Any help appreciated.

What code have you got already that you want to change ?

I was planning on using something from the example library from the mpu6050 or something based on this if i can shrink it down.

Why not start the other way and build up your project instead of trying to slim down an existing project that you do not fully understand ?

The library for the MPU6050 will have some examples with it. Pick the simplest one and get it running. All you want to start with is to print the raw values from the sensor

Something like this


#include <MPU6050_tockn.h>
#include <Wire.h>

MPU6050 mpu6050(Wire);

long timer = 0;

void setup()
{
  Serial.begin(9600);
  Wire.begin();
  mpu6050.begin();
  mpu6050.calcGyroOffsets(true);
}

void loop()
{
  mpu6050.update();
  if (millis() - timer > 1000)
  {
    Serial.println("=======================================================");
    Serial.print("temp : ");
    Serial.println(mpu6050.getTemp());
    Serial.print("accX : ");
    Serial.print(mpu6050.getAccX());
    Serial.print("\taccY : ");
    Serial.print(mpu6050.getAccY());
    Serial.print("\taccZ : ");
    Serial.println(mpu6050.getAccZ());
    Serial.print("gyroX : ");
    Serial.print(mpu6050.getGyroX());
    Serial.print("\tgyroY : ");
    Serial.print(mpu6050.getGyroY());
    Serial.print("\tgyroZ : ");
    Serial.println(mpu6050.getGyroZ());
    Serial.print("accAngleX : ");
    Serial.print(mpu6050.getAccAngleX());
    Serial.print("\taccAngleY : ");
    Serial.println(mpu6050.getAccAngleY());
    Serial.print("gyroAngleX : ");
    Serial.print(mpu6050.getGyroAngleX());
    Serial.print("\tgyroAngleY : ");
    Serial.print(mpu6050.getGyroAngleY());
    Serial.print("\tgyroAngleZ : ");
    Serial.println(mpu6050.getGyroAngleZ());
    Serial.print("angleX : ");
    Serial.print(mpu6050.getAngleX());
    Serial.print("\tangleY : ");
    Serial.print(mpu6050.getAngleY());
    Serial.print("\tangleZ : ");
    Serial.println(mpu6050.getAngleZ());
    Serial.println("=======================================================\n");
    timer = millis();
  }
}

NOYE the library that it comes from. It will need to be installed

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.