Build a sensor with Raspberry Pi

Requirements:

  • Raspberry PI (any version) with Ethernet
  • SD card (Raspberry PI 1) or MicroSD (Raspberry PI 2)
  • ADXL345 sensor
  • 3 LEDs (Yellow, Red, Green), 3 resistors (330 Ohm) and a bunch of jumper cables

Let’s start!

  • Link each led with a resistor by using jumper cables or with soldering
  • Link the sensor and leds to Raspberry PI as described in this schema:

(sensor -> Raspberry)

3v3 : 3v3
GND : GND
SDA : SDA
SCL : SCL
Green LED : GPIO-17
Yellow LED : GPIO-18
Red LED : GPIO-21 (GPIO-27 if you have Raspberry PI 2 or 3)

For futher details about RPi pinout you can see here:

Now the software!

  • Install Raspbian Jessie over the SD Card (you can download it here: https://www.raspberrypi.org/downloads/raspbian/ )
  • Physically place the Raspberry Pi with the sensor in horizontal position
  • Link network and power supply
  • After boot, log-in into Raspberry PI with SSH, or by using keyboard and mouse install SeismoCloud and its dependencies:
  • # apt-get update
    # apt-get install ntp curl wiringpi bash
    # curl -o galileo-terremoti_2.15_armhf.deb https://www.seismocloud.com/downloads/galileo-terremoti_2.15_armhf.deb
    # dpkg -i galileo-terremoti_2.15_armhf.deb
  • Done!

Activate the sensor

In order to activate the sensor, you need to open SeismoCloud app with a phone that is in the same Wi-Fi network of the Raspberry Pi.

Now your device is reachable, and you can use the app to see its state. Thanks 🙂

Network requirements

If you have a strict network policy, you may want to open these port (outgoing: from sensor to internet):

  • TCP: 80, 443, 1883, 8883
  • UDP: 123

Also, DHCP should be present in LAN