Send live earthquake data to hardware over serial
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples/earthquake-light
src
tests
.dockerignore
.gitignore
.resin-sync.yml
Dockerfile
LICENSE
README.md
package.json

README.md

Earthquake Converter

Pulls live earthquake data from the US Geological Survey site and sends information about each event to connected serial devices.

:)

Installation on Raspberry Pi B+

With ResinOS:

ResinOS offers a stripped down operating system which starts up quickly, restarts the app when it fails, and is more robust to filesystem corruption.

  1. Download ResinOS for Raspberry Pi 1
  2. Extract and install ResinOS image on micro SD card. Etcher is a really good tool for this.
  3. Connect Raspberry Pi to network and power
  4. Install the resin device toolbox (npm install -g resin-device-toolbox)
  5. Run rdt push in the root of this repo and select your Raspberry Pi when prompted

On Top of Raspbian:

Dependencies:

  • Node.js (v5 or greater)

    • On Raspberry Pi B+ running Raspbian you can install with curl https://nodejs.org/dist/v6.9.0/node-v6.9.0-linux-armv7l.tar.gz | tar --strip-components 1 -xvz -C /usr/local --exclude='CHANGELOG.md' --exclude='LICENSE' --exclude='README.md'
    • On Raspberry Pi 3 running Raspbian you can install with curl https://nodejs.org/dist/v6.9.0/node-v6.9.0-linux-arm64.tar.gz | tar --strip-components 1 -xvz -C /usr/local --exclude='CHANGELOG.md' --exclude='LICENSE' --exclude='README.md'
  1. Clone the repo (git clone https://github.com/jmptable/earthquake-converter)
  2. cd earthquake-converter
  3. npm install
  4. node src

Serial Protocol

When earthquakes occur the time, magnitude, latitude, and longitude will be written to the first serial port found, in that order. The values will be floats separated by a single space and terminated with a newline. Time is given as seconds since 00:00:00 UTC (Unix Time). Magnitude is measured on the Richter scale.

There is a newline sent at the start of the program to make it easier to reset state in the hardware.

For an example of parsing this data with an Arduino take a look at the earthquake-light firmware in the examples directory.

Using With Raspberry Pi Hardware Serial

First make sure that the serial port is not configured to be connected to the kernel message buffer. To accomplish that you can run sudo raspi-config and then select "Advanced Options" -> "Serial Enable/Disable shell...". After a reboot the hardware serial port should be free to use. Find the path to the port and then run the earthquake converter with node src --port /dev/your-port.