Quake Ready App with IoT and 3-Axis Accelerometer (Python STEM Board)

Vishnu
I am an 11th grader from Dubai, and I love playing cricket and coding..

About  The Project:

Quake-Ready is a smart application that uses an IoT device (Python STEM Board)  with a 3-axis accelerometer to detect ground vibrations and sound sensors to find trapped individuals. It provides real-time alerts with visual and sound notifications. The app also shows resource data (hospitals, camps, population) to help with response planning and coordination

Components Needed

  1. Python STEM Board (ESP-WROOM-32)
  2. 3-Axis Accelerometer (for detecting ground vibrations)
  3. Sound Sensors (for detecting trapped individuals)
  4. OLED Screen (for displaying alerts)
  5. RGB LEDs (for visual notifications)
  6. Buzzer (for sound notifications)
  7. Wi-Fi Module (for internet connectivity)
  8. MQTTX (for real-time data communication)
  9. USB Cable (for connecting the board to the computer)
Bash
STEM Python Board 
Initialize mPython, Wi-Fi, MQTT, sensors
Display message on OLED
While True:
    Read and publish sound and accelerometer data
    If sound > threshold:
        Display "ALERT: High sound" and trigger notifications
    If acceleration > threshold:
        Display "ALERT: Earthquake" and trigger notifications
    Plot sound and acceleration data with color-coded severity
    Wait for a few  seconds
End loop

APPLICATION LOGIC

Initialize MQTT client and connect to broker
Subscribe to sound and accelerometer topics
Define thresholds for sound and acceleration
Set up data storage (sound_data, acceleration_data)
Define on_connect callback to subscribe to topics
Define on_message callback to process incoming data and store in respective queues
Define function to plot sound data:
    Plot sound as bar chart with color based on severity (green, yellow, red)
Define function to plot accelerometer data:
    Plot acceleration as bar chart with color based on severity (yellow, orange, red)
Run a loop (e.g., 10 times):
    Plot sound and accelerometer data
    Pause for 5 seconds before repeating