You get the alert on your phone before an earthquake occurs, a project with only 4 electrical connections!
Things used in this project
Hardware components
Software apps and online services
Story
The two characteristic waves of an earthquake: the harmless P wave and the S wave, the one that causes the greatest destruction. The difference in propagation speed is noticeable.
The greater the distance from the epicenter of the earthquake, the more time the alert can be sent. Practically, those few tens of seconds can save human lives!
Communication via the Internet is done using the RemoteXY online application, which is free of charge up to a maximum of 5 graphic components on the screen, in our case there are 4, so the application and the created project are free.
The application can be installed on Android or Ios.
THE CODE:
*Since the password and SSID of the Internet network differ from the user's device, I recommend you to install Visuino and edit the two fields, password and SSID, following the instructions in the video.
The code is compiled using the Visuino program, a software that allows programming a controller with just a few drag&drop operations. In the attachment you can find the code in both Arduino IDE and Visuino format.
Schematics
SCHEMATIC DIAGRAM
Only 4 electrical connections!
Code
code
C/C++
{
"Config": {
"Build": {
"Board": "esp32:esp32:lolin32:FlashFreq=80,PartitionScheme=default,CPUFreq=240,UploadSpeed=921600"
}
},
"Version": "2",
"Product": "Visuino Pro - Visual Arduino Programming",
"Content": "OpenWire Diagram",
"Units": [
{
"Type": "Diagram",
"Name": "__OpenWireRootUnit__",
"*": [
{
"X": 1072,
"Name": "Arduino",
"Instance": {
"Serial": {
"*": [
{
"InputPin": {
"SourcePins": [
{
"ID": "__OpenWireRootUnit__.AnalogMultiMerger1.OutputPin"
}
]
},
"+": "TArduinoHardwareSerial"
},
{
"+": "TArduinoESP32DefinedPinsSerial1"
},
{
"+": "TArduinoESP32DefinedPinsSerial2"
}
]
},
"+": "TArduinoBoard",
"Modules": {
"*": [
{
"AccessPoint": {
"SSID": "",
"Password": ""
},
"HostName": "",
"+": "TArduinoESP32WiFiModule",
"AccessPoints": {
"*": [
{
"Password": "xxxxxxx",
"SSID": "xxxxxx",
"+": "TArduinoESP32WiFiModuleRemoteAccessPoint"
}
]
},
"Sockets": {
"*": [
{
"Name": "TCP Client1",
"InputPin": {
"SourcePins": [
{
"Name": "__OpenWireRootUnit__.RemoteXY1.Protocols.Cloud1.OutputPin",
"ID": "__OpenWireRootUnit__.RemoteXY1.Protocols._Item0.OutputPin"
}
]
},
"+": "TArduinoESP32WiFiTCPClientSocket"
}
]
}
},
{
"+": "TArduinoEEPROMModule"
},
{
"+": "TArduinoESP32ProcessorModule"
},
{
"+": "TArduinoESP32HallSensorModule"
},
{
"+": "TArduinoESP32BluetoothLEModule"
}
]
},
"I2CChannels": {
"*": [
{
"InputPin": {
"SourcePins": [
{
"ID": "__OpenWireRootUnit__.AccelerometerGyroscope1.OutputPin"
}
]
},
"+": "TArduinoESP32_Generic_I2C"
},
{
"+": "TArduinoESP32_Generic_I2C_2"
}
]
},
"Digital": {
"*": [
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalSerial0Channel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalSerial0Channel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedPullDownAnalogDigitalChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoESP32CombinedPullDownAnalogDigitalDACChannel"
},
{
"+": "TArduinoESP32CombinedPullDownAnalogDigitalDACChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoCombinedTouchPullDownAnalogDigitalInterruptChannel"
},
{
"+": "TArduinoPullDownTouchAnalogInputOnlyChannel"
},
{
"+": "TArduinoPullDownTouchAnalogInputOnlyChannel"
},
{
"+": "TArduinoPullDownTouchAnalogInputOnlyChannel"
},
{
"+": "TArduinoPullDownTouchAnalogInputOnlyChannel"
},
{
"+": "TArduinoPullDownTouchAnalogInputOnlyChannel"
},
{
"+": "TArduinoPullDownTouchAnalogInputOnlyChannel"
}
]
},
"SPIChannels": {
"*": [
{
"+": "TArduinoESP32_Generic_SPI"
},
{
"+": "TArduinoESP32_Generic_SPI1"
}
]
},
"BoardType": "Generic ESP32"
},
"Type": "Component",
"Y": 336
},
{
"X": 800,
"Name": "RemoteXY1",
"Instance": {
"+": "TArduinoRemoteXY",
"Protocols": {
"*": [
{
"Name": "Cloud1",
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.Arduino.Modules.WiFi.Sockets.TCP Client.InputPin",
"ID": "__OpenWireRootUnit__.Arduino.Modules._Item0.Sockets._Item0.InputPin"
}
]
},
"+": "TArduinoRemoteXYProtocolCloud",
"Token": "d4378c457561b775db1a3910deb1d252"
}
]
},
"Config": "255,0,0,17,0,46,0,16,1,0,68,1,0,27,100,36,95,24,69,0,\r\n5,2,10,10,6,67,4,4,13,95,14,139,1,11,129,0,23,2,59,8,\r\n136,83,69,73,83,77,79,71,82,65,80,72,0",
"Elements": {
"*": [
{
"InputPins": {
"Form": "__OpenWireRootUnit__",
"Pins": [
{
"Type": "ptSink",
"SourcePin": {
"ID": "__OpenWireRootUnit__.MapRange1.OutputPin"
}
}
]
},
"Name": "onlineGraph_1",
"+": "TArduinoRemoteXYGraphElement"
},
{
"Name": "sound_1",
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.Timer1.OutputPin"
}
},
"+": "TArduinoRemoteXYSoundElement",
"Sound": 2005
},
{
"Name": "text_1",
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.TextValue1.OutputPin"
}
},
"+": "TArduinoRemoteXYTextElement"
}
]
}
},
"Type": "Component",
"Y": 368
},
{
"X": 256,
"Name": "AccelerometerGyroscope1",
"Instance": {
"Gyroscope": {
"OutputPins": {
"Form": "__OpenWireRootUnit__",
"Pins": [
{
"Type": "ptSource",
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.AnalogMultiMerger1.InputPins.Pin [0]",
"ID": "__OpenWireRootUnit__.AnalogMultiMerger1.InputPins._Pin0"
}
]
},
{
"Type": "ptSource",
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.AnalogMultiMerger1.InputPins.Pin [1]",
"ID": "__OpenWireRootUnit__.AnalogMultiMerger1.InputPins._Pin1"
}
]
},
{
"Type": "ptSource",
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.AnalogMultiMerger1.InputPins.Pin [2]",
"ID": "__OpenWireRootUnit__.AnalogMultiMerger1.InputPins._Pin2"
}
]
}
]
}
},
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.Arduino.I2CChannels.Item[ 0 ].InputPin",
"ID": "__OpenWireRootUnit__.Arduino.I2CChannels._Item0.InputPin"
}
]
},
"+": "TArduinoMPU6050I2C"
},
"Type": "Component",
"Y": 496
},
{
"X": 528,
"Name": "AnalogMultiMerger1",
"Instance": {
"InputPins": {
"Pins": [
{
"Type": "ptSink",
"SourcePin": {
"Name": "__OpenWireRootUnit__.AccelerometerGyroscope1.Gyroscope.OutputPins.X",
"ID": "__OpenWireRootUnit__.AccelerometerGyroscope1.Gyroscope.OutputPins._Pin0"
}
},
{
"Type": "ptSink",
"SourcePin": {
"Name": "__OpenWireRootUnit__.AccelerometerGyroscope1.Gyroscope.OutputPins.Y",
"ID": "__OpenWireRootUnit__.AccelerometerGyroscope1.Gyroscope.OutputPins._Pin1"
}
},
{
"Type": "ptSink",
"SourcePin": {
"Name": "__OpenWireRootUnit__.AccelerometerGyroscope1.Gyroscope.OutputPins.Z",
"ID": "__OpenWireRootUnit__.AccelerometerGyroscope1.Gyroscope.OutputPins._Pin2"
}
}
],
"Count": 3,
"Form": "__OpenWireRootUnit__"
},
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.Arduino.Serial.Item[ 0 ] (9600).InputPin",
"ID": "__OpenWireRootUnit__.Arduino.Serial._Item0.InputPin"
},
{
"ID": "__OpenWireRootUnit__.MapRange1.InputPin"
}
]
},
"+": "TArduinoAnalogMultiMerger"
},
"Type": "Component",
"Y": 288
},
{
"X": 736,
"Name": "MapRange1",
"Instance": {
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.RemoteXY1.Elements.onlineGraph_1.InputPins.Pin [0]",
"ID": "__OpenWireRootUnit__.RemoteXY1.Elements._Item0.InputPins._Pin0"
},
{
"ID": "__OpenWireRootUnit__.CompareValue1.InputPin"
},
{
"ID": "__OpenWireRootUnit__.CompareValue2.InputPin"
}
]
},
"InputRange": {
"Max": 10,
"Min": -10
},
"+": "TArduinoMapRange",
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.AnalogMultiMerger1.OutputPin"
}
},
"OutputRange": {
"Min": 0
}
},
"Type": "Component",
"Y": 256
},
{
"X": 544,
"Name": "CompareValue1",
"Instance": {
"Value": 0.150000005960464,
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.MapRange1.OutputPin"
}
},
"+": "TArduinoCompareValue",
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.Or1.InputPins.Pin [0]",
"ID": "__OpenWireRootUnit__.Or1.InputPins._Pin0"
}
]
}
},
"Type": "Component",
"Y": 528
},
{
"X": 544,
"Name": "CompareValue2",
"Instance": {
"Value": -0.150000005960464,
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.MapRange1.OutputPin"
}
},
"+": "TArduinoCompareValue",
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.Or1.InputPins.Pin [1]",
"ID": "__OpenWireRootUnit__.Or1.InputPins._Pin1"
}
]
},
"CompareType": "ctBigger"
},
"Type": "Component",
"Y": 576
},
{
"X": 576,
"Name": "Or1",
"Instance": {
"InputPins": {
"Form": "__OpenWireRootUnit__",
"Pins": [
{
"Type": "ptSink",
"SourcePin": {
"ID": "__OpenWireRootUnit__.CompareValue1.OutputPin"
}
},
{
"Type": "ptSink",
"SourcePin": {
"ID": "__OpenWireRootUnit__.CompareValue2.OutputPin"
}
}
]
},
"OutputPin": {
"SinkPins": [
{
"ID": "__OpenWireRootUnit__.Timer1.StartInputPin"
}
]
},
"+": "TArduinoBooleanOr"
},
"Type": "Component",
"Y": 672
},
{
"X": 576,
"Name": "Timer1",
"Instance": {
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.RemoteXY1.Elements.sound_1.InputPin",
"ID": "__OpenWireRootUnit__.RemoteXY1.Elements._Item1.InputPin"
},
{
"Name": "__OpenWireRootUnit__.PulseGenerator1.Enabled",
"ID": "__OpenWireRootUnit__.PulseGenerator1.EnabledInputPin"
},
{
"ID": "__OpenWireRootUnit__.Inverter1.InputPin"
}
]
},
"StartInputPin": {
"SourcePins": [
{
"ID": "__OpenWireRootUnit__.Or1.OutputPin"
}
]
},
"+": "TArduinoTimer",
"Interval": 5000000
},
"Type": "Component",
"Y": 800
},
{
"X": 800,
"Name": "TextValue1",
"Instance": {
"Value": "",
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.RemoteXY1.Elements.text_1.InputPin",
"ID": "__OpenWireRootUnit__.RemoteXY1.Elements._Item2.InputPin"
}
]
},
"+": "TArduinoTextValue",
"Elements": {
"*": [
{
"Value": "EARTHQUAKE!!!",
"Name": "Set Value State1",
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.PulseGenerator1.OutputPin"
}
},
"+": "TArduinoTextStateSetValueElement"
}
]
}
},
"Type": "Component",
"Y": 656
},
{
"X": 816,
"Name": "PulseGenerator1",
"Instance": {
"Frequency": 1.5,
"OutputPin": {
"SinkPins": [
{
"Name": "__OpenWireRootUnit__.TextValue1.Elements.Set Value State.InputPin",
"ID": "__OpenWireRootUnit__.TextValue1.Elements._Item0.InputPin"
}
]
},
"+": "TArduinoPulseGenerator",
"@": [
{
"PinName": "Enabled",
"@": "Enabled",
"+": "TOWBooleanSinkPinBinding",
"SourcePin": {
"ID": "__OpenWireRootUnit__.Timer1.OutputPin"
},
"Component": "PulseGenerator1"
}
],
"ResetInputPin": {
"SourcePins": [
{
"ID": "__OpenWireRootUnit__.Inverter1.OutputPin"
}
]
},
"Phase": 0,
"Asymmetry": 0
},
"Type": "Component",
"Y": 832
},
{
"X": 704,
"Name": "Inverter1",
"Instance": {
"InputPin": {
"SourcePin": {
"ID": "__OpenWireRootUnit__.Timer1.OutputPin"
}
},
"OutputPin": {
"SinkPins": [
{
"ID": "__OpenWireRootUnit__.PulseGenerator1.ResetInputPin"
}
]
},
"+": "TArduinoBooleanInverter"
},
"Type": "Component",
"Y": 880
}
]
}
]
}
The article was first published in hackster, May 15, 2023
cr: https://www.hackster.io/cristinepotu7171/internet-earthquake-alert-only-4-electrical-connections-0aeb5e
author: Toparceanu Cristian