https://github.com/mazen-daghari/sport-car-dashboard
obd-ii car dashboard from scratch
https://github.com/mazen-daghari/sport-car-dashboard
adafruit arduino can car dashboard nextion-display obd2
Last synced: 4 months ago
JSON representation
obd-ii car dashboard from scratch
- Host: GitHub
- URL: https://github.com/mazen-daghari/sport-car-dashboard
- Owner: mazen-daghari
- License: gpl-3.0
- Created: 2024-11-08T18:52:53.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-17T16:21:15.000Z (4 months ago)
- Last Synced: 2024-12-17T17:26:22.432Z (4 months ago)
- Topics: adafruit, arduino, can, car, dashboard, nextion-display, obd2
- Homepage:
- Size: 4.28 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sport-car-Dashboard
Here's a detailed tutorial on how to implement a project that retrieves, processes, and visualizes real-time vehicle data using the CAN protocol, Nextion, Arduino, Altium Design, and OBD-II.How to start?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Step 1: Data Retrieval
-
Objective: Acquire real-time key information from a vehicle (speed, engine RPM, coolant temperature) via the CAN protocol.Materials Needed:
OBD-II to USB adapterArduino board (e.g., Arduino Uno)
CAN Bus shield for Arduino
OBD-II cable
Vehicle with OBD-II port
Steps:
Set Up the Hardware:Connect the CAN Bus shield to the Arduino board.
Connect the OBD-II cable to the vehicle's OBD-II port and the other end to the CAN Bus shield.
Install Required Libraries:
Install the necessary libraries for CAN communication in the Arduino IDE. You can use the MCP_CAN library.
Write the Arduino Code:
Write a sketch to initialize the CAN Bus and read data from the vehicle. Here's a basic example:
cpp
#include
#includeconst int SPI_CS_PIN = 10;
MCP_CAN CAN(SPI_CS_PIN);void setup() {
Serial.begin(115200);
if (CAN.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
Serial.println("CAN Bus Initialized");
} else {
Serial.println("CAN Bus Initialization Failed");
while (1);
}
CAN.setMode(MCP_NORMAL);
}void loop() {
if (CAN_MSGAVAIL == CAN.checkReceive()) {
CAN.readMsgBuf(&len, buf);
unsigned long canId = CAN.getCanId();
Serial.print("ID: ");
Serial.print(canId, HEX);
Serial.print(" Data: ");
for (int i = 0; i < len; i++) {
Serial.print(buf[i], HEX);
Serial.print(" ");
}
Serial.println();
}
}
Upload the Code:Upload the code to the Arduino board and open the Serial Monitor to see the real-time data being retrieved from the vehicle.
-Step 2: Data Processing
-
Objective: Process the received data to make it usable.Steps:
Parse the Data:Modify the Arduino code to parse the CAN messages and extract specific information such as speed, engine RPM, and coolant temperature.
Convert Units:
Convert the raw data into human-readable units. For example, convert speed from km/h to mph if needed.
Filter the Data:
Implement filtering algorithms to smooth out the data and remove any noise.
-Step 3: Visualization
-
Objective: Display the data clearly and intuitively on a graphical interface.Materials Needed:
Nextion displayArduino board
Steps:
Set Up the Hardware:
-
Connect the Nextion display to the Arduino board using the appropriate pins (e.g., TX, RX, VCC, GND).


Design the Interface:
-
Use the Nextion Editor to design the graphical interface. Create elements such as gauges, text fields, and buttons to display the data.
### image

Write the Arduino Code:
-
Modify the Arduino code to send the processed data to the Nextion display. Here's an example:cpp
#includeNexText speedText = NexText(0, 1, "speed");
NexText rpmText = NexText(0, 2, "rpm");
NexText tempText = NexText(0, 3, "temp");void setup() {
nexInit();
// Initialize CAN Bus and other setup code
}void loop() {
// Read and process CAN data
String speed = String(parsedSpeed);
String rpm = String(parsedRPM);
String temp = String(parsedTemp);speedText.setText(speed.c_str());
rpmText.setText(rpm.c_str());
tempText.setText(temp.c_str());
}Upload the Code:
-
Upload the code to the Arduino board and observe the data being displayed on the Nextion screen.Technologies Used
CAN: Controller Area Network protocol for vehicle communication.Nextion: Display for graphical interface.
Arduino: Microcontroller for data acquisition and processing.
Altium Design: Software for designing custom PCBs if needed.
OBD-II: On-Board Diagnostics standard for vehicle data retrieval.
By following these steps, you can successfully implement a project that retrieves, processes, and visualizes real-time vehicle data using the CAN protocol and various technologies.
for further questions mail me on:[email protected]
-
Licence()
----------------------------------------------------------------------------------------------------------------------------------------------------------------------