- Overview
- Components
- Dependencies
- Setup
- Operation
- Data Visualization
- Power Management
- Additional Notes
- Flowchar
This project utilizes an ESP32 microcontroller, a GPS module, and a 6-axis accelerometer (GY-521) to monitor and publish real-time data about a moving vehicle. The data includes GPS coordinates, vehicle speed, and filtered accelerometer information.
- ESP32 DevKit v1: Microcontroller for processing and communication.
- GPS Module: Provides latitude, longitude, and speed data.
- GY-521 6-Axis Accelerometer: Measures acceleration and orientation.
Ensure that these libraries are installed in your Arduino IDE.
-
- Connect the GPS module and GY-521 accelerometer to the ESP32 using appropriate pins.
- Refer to the comments in the code for pin configurations.
-
- Update the
WIFI_SSID
andWIFI_PASS
variables in the code with your WiFi credentials.
- Update the
-
- Create an account on Adafruit IO.
- Set up feeds for GPS, Speed, and Acceleration.
- Update the MQTT configuration variables (
MQTT_SERVER
,MQTT_PORT
,MQTT_USERNAME
,MQTT_KEY
) with your Adafruit IO information.
-
- Upload the modified code to your ESP32 using the Arduino IDE.
- The ESP32 reads GPS data, including latitude, longitude, and speed.
- Accelerometer data is filtered using a complementary filter to obtain accurate pitch and roll.
- The filtered data (GPS, speed, and accelerometer) is published to Adafruit IO via MQTT.
- Monitor your vehicle's data in real-time on the Adafruit IO dashboard.
- View GPS coordinates, speed, and filtered accelerometer information.
- The code includes a deep sleep mode to minimize power consumption during idle periods.
- Adjust the sleep duration based on your application's requirements.
- This code is a foundation for vehicle monitoring. Customize it based on your specific needs.
- Refer to the comments in the code for detailed explanations of configurations and adjustments.
graph TD
subgraph Initialization
A[Initialize ESP32] -->|Setup WiFi| B[Connect to WiFi]
B -->|Setup GPS| C[Initialize GPS Module]
C -->|Setup Accelerometer| D[Initialize MPU6050]
end
subgraph Main Loop
D -->|Read GPS Data| E[Parse GPS Data]
E -->|Valid GPS Fix| F[Calculate Speed]
F -->|Read Accelerometer| G[Filter Accelerometer Data]
G -->|Publish Data| H[Publish to Adafruit IO]
H -->|Deep Sleep| I[Enter Deep Sleep Mode]
end
B -->|Reconnect if Disconnected| B
style A fill:#86B300
style B fill:#86B300
style C fill:#86B300
style D fill:#86B300
style E fill:#5DADE2
style F fill:#5DADE2
style G fill:#5DADE2
style H fill:#5DADE2
style I fill:#EC7063