Giter Club home page Giter Club logo

seismometer's Introduction

Seismometer

by Yair Elbaum & Idan Alperin

In this project we have an MPU6050 accelerometer communicating with our MCU over I2C. Whenever A noise is detected above a programmable threshold, an interrupt is raised and the mcu starts sending accelerometer data.


Calibration

The calibration takes a predefined number of samples (1024) and computes an average for each of the axis (denoted as E[x], E[y], E[z]). In order to make sure the samples are good, we make sure the variance of the samples is below a certain threshold. After sampling, we take the vector (E[x], E[y], E[z]) and consider it our true Z vector. In order to compute our true X & Y vectors we need to compute 2 orthogonal vectors to Z. The X vector can be achieved easily via taking the vector (E[y], -E[x], 0).

The Y vector can be computed as the cross product of Z & X, which is (E[x] * E[z], E[y] * E[y], -(E[x]^2 + E[y]^2)).

Now all that is left to do is create a basis change matrix and multiply any reading we have with this matrix.

Earthquake handling

On register 0x1F of MPU6050, we can define a threshold for the MPU's interrupt pin to turn high, subsequently causing an interrupt in the MCU. once the interrupt is received, the MCU takes samples in a predefined interval, processes them, and batches them up using collector.h. Once a batch is full, it is sent via mqtt to a broker.

Once the samples variance falls below a threshold, the event is over, the MPU's interrupt is cleared and the MCU goes idle.

Remote configuration

The MCU is subscribed to a certain topic (tonto2/set), and upon receiving a message will update MPU6050's threshold register (0x1F) to the specified value. Thus, the sensitivity can be remotely adjusted.

Pinging

Every 30 seconds of inactivity, a ping is sent to the server in order to keep the connection alive. This is implemented using a timer & an interrupt.

Buttons

Pressing BTN0 will force a calibration event. Pressing BTN1 will make the cat mewo.

seismometer's People

Contributors

idan511 avatar

Stargazers

Ido avatar Alon avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.