This is the D7S Seismic Earthquake Sensor. D7S sensor uses 3-AXIS acceleration sensor developed by OMRON’s unique SI (Spectral Intensity) value calculation algorithm which it has a high correlation with SIS Seismic Intensity Scale that indicates the magnitude of an earthquake that provides higher precision of seismic intensity. This sensor has two opendrain output in pin INT1 and INT2 that turns active into LOW when it’s off condition and collapse detection condition when detected at intensity 5 or higher, the INT2 goes active LOW during earthquake calculation for offset acquisition and self-diagnostic handling. This device use i2C for communication with the sensor for settings and tracking down earthquake related information. The sensor is useful on fire prevention, secondary disaster after an earthquake hits.
Required Component to Test
- Arduino Microcontroller, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, ATMEGA250 16 MHz, ATSAM3x8E, ATSAM21D, ATTINY85 16/8 MHz (Note: The Diagram below is using NANO. (please refer to the respective pin-outs)
- D7S Seismic Sensor
- 10uf Capacitors (Optional)
- 10k Resistors
- Jumper Wires / DuPont Wires
- Prototyping PCB board (for soldering manually)
Wiring Guide
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <Wire.h> const int addr = 0x55; //i2C Address const int addr = 55; //i2C Address void setup(){ Serial.begin(9600); Serial.println("14CORE | D7S Sensor Test") Serial.println("Initializing............") delay(5000); Serial.println("Starting Sensor........."); Wire.begin(); delay(10); } /* Set to read strongest Spectral Intensity value during current vibration */ void loop(){ Wire.beginTransmission(addr); int spectralIntensity = Wire.receive(); Wire.send(0); //Wire.send(32); Wire.endTransmission(); Wire.requestFrom(addr); Serial.print("Spectral Intensity Data > "); Serial.println(spectralIntensity); delay(500); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
void main(){ system_init (); eq_init(0x55); while (1) { UART_Write_Text( "rn Status: " ); si_value = eq_read_status (); IntToStr( si_value, uart_text ); UART_Write_Text(uart_text); UART_Write( 32 ); /*reads strongest SI value detected during current quake */ UART_Write_Text( " Current SI value: " ); si_value = eq_si_rs (); IntToStr( si_value, uart_text ); UART_Write_Text(uart_text); UART_Write( 32 ); Delay_ms (5000); } } |
i2C/TWI Scanner
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
#include <Wire.h> void setup() { Serial.begin(9600); Serial.println("14CORE | i2C SCANNER"); Serial.println("Starting...."); Serial.pirntln("--------------------"); delay(3000); Wire.begin(); while (!Serial); // Scan i2C Address Serial.println("Initializing I2C Scanner"); Serial.println("Please wait.............."); delay(3000); } void loop() { byte error, address; int indevice; Serial.println("14CORE | Scanning please wait..."); indevice = 0; for(address = 1; address < 127; address++ ) { Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("14CORE | I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); indevice++; } else if (error==4) { Serial.println("14CORE | Unknow error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); } } if (indevice == 0) Serial.println("14CORE | No I2C devices found\n"); else Serial.println("14CORE | Scanning Done\n"); delay(5000); // wait 5 seconds for next scan } |
Downloads
- Download D7S Vibration Sensor Datasheet | PDF
I just wired my D7S completely wrong because your wiring diagaram neither shows pin numbers nor does it state that the wiring diagram is showing the sensor from the bottom side! Fortunately the sensor is still working after wiring it correctly.
You also have to connect VCC pin9 to 3.3V or 5V. So both GND on pins 6 and 10 and both VCC on pins 1 and 9 should be used and not be left hanging. Otherwise I2C is not working. Took me a while to get it.
My sensor is not working although I have connected the same to the scheme? Can you give me a solution?
Connect pin 1 and 9 to vcc…
Can I use the D7S seismic sensor with esp 32 thank you for your help?
Just use my previous library which is i posted, see below link.
https://www.14core.com/wiring-d7s-seismic-earthquake-detection-mapping-intensity-vibration-sensor-on-microcontroller/