As an Amazon Associate we earn from qualifying purchases.
An earthquake alert system based on an accelerometer and an Arduino watches for sudden ground shaking and triggers a local alarm. In this project the whole circuit is built and tested in Proteus, so you can try the logic without any hardware. This guide explains how the system works, which parts you need, how to wire them, and how to structure the code.
The project files from the original post are available through this download link: https://drive.google.com/open?id=0B65qnqjcJPRFLUM4ZUV6TUJ3TG8
What this system does (and does not do)
An accelerometer measures acceleration along one or more axes. When the ground shakes, the readings change quickly compared with normal conditions. The Arduino reads those values, compares them with a threshold, and switches on a buzzer, an LED or a message when the shaking is strong enough.
It is important to be realistic about this. A single accelerometer detects shaking that is already happening. It cannot predict an earthquake. Public early-warning services rely on networks of professional seismic sensors, and a small Arduino project is a learning model of the detection and alert part only.
Components used in the simulation
- Arduino board (an Uno-style board is common for Proteus projects).
- Accelerometer, usually a 3-axis analog type such as the ADXL335, which gives one analog voltage per axis.
- Buzzer and LED for the local alarm.
- 16×2 LCD to display status or readings.
- Optional GSM module to send an SMS alert.
- Resistors and a power supply as needed by the circuit.
Depending on your Proteus version and installed libraries, an accelerometer model may not be included. If it is missing, you can add a third-party library, or use potentiometers connected to the analog pins to stand in for the X, Y and Z outputs. Moving a potentiometer then acts like tilting or shaking the sensor.
How the circuit is connected
The wiring is simple, because an analog accelerometer needs only power and three signal lines.
- Connect the accelerometer power and ground pins to the Arduino 5 V (or 3.3 V, depending on the sensor model) and GND.
- Connect the X, Y and Z outputs to three analog inputs, for example A0, A1 and A2.
- Connect the buzzer and LED to digital output pins, with a resistor in series with the LED.
- Connect the LCD data and control pins to digital pins, following the pin names set in your code.
- If you add a GSM module, connect its TX and RX lines to the Arduino serial pins and share a common ground.
How the code works
The program follows the same pattern in most versions of this project.
1. Calibrate a resting value
At startup, read each axis a few times and store the average as the "at rest" value. This avoids hard-coding numbers that differ between sensors or simulation setups.
2. Read the axes continuously
In the main loop, use analogRead() on each axis. Compare each new reading with the resting value and calculate the difference.
3. Compare with a threshold
If the change on any axis goes beyond a chosen threshold, treat it as a shake. A low threshold makes the system sensitive but prone to false alarms, while a high one may miss small movements. You will usually adjust this value while testing.
4. Trigger the alert
When the threshold is crossed, turn on the buzzer and LED and show a warning on the LCD. To avoid false alarms from a single bump, you can require the condition to hold for a few consecutive readings before alerting.
5. Reset
Once the readings return to normal for a short time, switch the alarm off and show the normal status again.
Adding wireless alerts
A local buzzer only helps people who are in the room. To notify someone elsewhere, add a GSM module and send an SMS using AT commands from the Arduino serial port. The same approach is used in the GSM power theft detection simulation, so that article is a useful reference for the messaging side. Other options include a Wi-Fi module for an IoT dashboard, but these need extra setup and cannot always be fully simulated in Proteus.
Testing in Proteus
- Load the compiled HEX file into the Arduino component in Proteus.
- Start the simulation and check that the LCD shows the normal state.
- Change the accelerometer inputs, or move the potentiometers, quickly past your threshold.
- Confirm that the buzzer, LED and LCD message respond.
- Return the inputs to normal and check that the alarm resets.
Test slow changes as well as sudden ones. A slow tilt should not trigger the alarm if your logic is meant to detect vibration rather than orientation.
Ideas for improving the project
- Combine the three axes into one magnitude value rather than checking each axis separately.
- Use a moving average to filter noise.
- Log the readings to an SD card or serial monitor to tune the threshold.
- Add a manual reset button and a test button.
Related accelerometer and Arduino projects
If you want to see other uses of the same sensor, the accelerometer-based wheelchair project uses tilt to control motion, and the automatic iron turn-off project uses movement to decide when to cut power. For another Proteus example that combines several sensors and outputs, see the building automation simulation.
FAQ
Can an accelerometer predict an earthquake?
No. It can only detect movement as it happens. Prediction is not something a simple sensor and microcontroller can do.
Why use Proteus for this project?
Proteus lets you test the circuit and code safely and cheaply before buying parts. You can fix wiring and logic mistakes in the simulation first.
What if there is no accelerometer in my Proteus library?
Add a compatible third-party library, or use potentiometers on the analog inputs to mimic the X, Y and Z outputs.
How do I reduce false alarms?
Calibrate at startup, raise the threshold slightly, average several readings, and require the shake to last for a few samples before the alarm triggers.