The embedded part of AutoSense Guardian is what makes it work in real-time. Here’s how we built it, step by step.
Hardware Layer (Sensors & Actuators)
The system uses sensors to gather data and actuators to respond to it.
Sensors:
Ultrasonic Sensor: Measures distance to nearby objects, like cars or obstacles.
GPS Module: Tracks the vehicle’s location (longitude , latitude).IMU Sensor: Detects motion and sudden stops with an accelerometer and gyroscope & the speed.
Magnetometer: Finds the vehicle’s direction for accurate navigation.
Actuators:
LCD Display: Shows warnings like “Slow Down!” or “Collision Ahead!”
- DC Motor: Simulates braking or other actions during tests.
Filters on the Sensors Data
Sensor data can be noisy due to vibrations or signal issues, so we apply moving average filters to ensure accuracy, as implemented in Filters.cpp. These filters smooth data by averaging multiple readings, making the system more reliable.
GPS Filter:
How It Works: Stores latitude, longitude, and speed in circular buffers (latBuffer, lngBuffer,) with a size of WINDOW_SIZE (e.g., 5 samples). The gpsFilterAdd function adds new readings, and gpsFilterGetAvgLat/Lng/Speed computes the average.
Purpose: Reduces noise from GPS signal fluctuations, ensuring stable location and speed data for features like DNPW.
Ultrasonic Filter:
How It Works: Uses a 2D buffer (buffer[SENSOR_COUNT][FILTER_SIZE], e.g., 4 sensors, 5 samples) to store distance readings. ultrasonicFilterAdd updates the buffer, and ultrasonicFilterGetAvg averages distances for each sensor (front, rear, left, right).
Purpose: Smooths out erratic distance readings caused by road vibrations, critical for FCW a
IMU & Magnetometer Filter:
How It Works: Stores accelerometer (accel_x/y/z), gyroscope (gyro_x/y/z), and heading (headingBuf) data in buffers of size FILTER_SIZE. mpuFilterAdd and qmcFilterAdd add new data, while mpuFilterGetAvg and qmcFilterGetAvg compute averages.
Purpose: Ensures accurate motion and heading data for EEBL and navigation by filtering out noise from vehicle movement.
Implementation: The filters use circular buffers to maintain recent data, updating indices with modulo operations (e.g., bufferIndex % WINDOW_SIZE). This keeps memory usage low and processing fast.
Example on the filter buffers :