This project is a real-time accident detection and alert system designed for vehicle safety. It utilizes the MPU6050 motion sensor to detect unusual acceleration or impacts that might indicate a crash. Upon detection, it fetches the GPS location using the A9G module and sends an SMS alert with location data to predefined emergency contacts.
AT+LOCATION=2.ATD+91XXXXXXXXXX; command.Purpose: To validate GPS functionality and fetch real-time location data from the A9G module using AT+LOCATION=2.
// Initialize UART
Serial1.begin(115200);
// Enable GPS
Serial1.println("AT+GPS=1");
// Request location repeatedly
Serial1.println("AT+LOCATION=2");
Serial1AT+GPS=1 to enable GPS trackingAT+LOCATION=2Use Case: Standalone script to test GPS signal lock before deploying in main code.
Purpose: To test SIM communication, send SMS, and place calls through the A9G module.
// Set SMS to text mode
Serial1.println("AT+CMGF=1");
// Send test SMS
Serial1.print("AT+CMGS=\"+91XXXXXXXXXX\"\r");
Serial1.print("Hi Test Message From Ai Thinker A9 Module");
Serial1.write(0x1A); // End message (CTRL+Z)
// Make a call
Serial1.print("ATD+91XXXXXXXXXX;\r");
Hi Test Message From Ai Thinker A9 ModuleAT+CMGD=4,4ATD+91XXXXXXXXXX;AT+CMGF=1 and SIM storage with AT+CPMSReply() function for sending dynamic textsUpdateSerial() to mirror Serial1 output for debuggingUse Case: Verify GSM-side functionality — calling, texting, and SIM readiness before full integration.