Summary of Car datta logger Using OBD II protocol (atmega 2560+ SD card + lcd 16×2), lcd
This project is a final microprocessor course project focused on designing an embedded system to communicate with a car's ECU using the OBD-II protocol. The system uses an ELM327 microcontroller-based cable adapted for UART communication by bypassing its USB interface. Connected to an Atmega 2560 microcontroller (Arduino Mega used for convenience with programming in Atmel Studio), the system sends PIDs such as '010D' to retrieve parameters like vehicle speed. The project aims to ease learning and provide guidance for similar OBD-II data logging applications.
Parts used in the Car Data Logger Using OBD II protocol:
- ELM327 cable (microcontroller-based OBD-II interface)
- Atmega 2560 microcontroller (Arduino Mega board)
- USB cable (modified for UART communication)
- Soldering wire (for modifying USB cable connections)
- UART communication interface (for data exchange between ELM327 and Atmega 2560)
- PC with Atmel Studio software (for C programming and uploading code via ICSP)
- OBD-II connector in the car (ISO 15765-4 CAN protocol compatible)
Ok first of all this was a final project for my microprocessor course in my University, and its intended to clarify and guide to someone has a similar project or just want to do it and learn , since when i was doing this project it wasn’t so easy to find the information and examples to do it i think this could be helpful to someones out there.First i will explained how is the system going to work, this embedded system has three main components which satisfy three main functions or services, the first part is the communication part.
Step 1: Communication with the ECU (Engine Control Unit)
So after this i decided to use a ELM327 cable which totally support this protocol
this cable provides communication from usb to the ECU this is actually a PIC microcontroller whit a lot of protocol transceivers for each supported protocol, you should download the datasheet in this link , there you can get detailed info about the ELM327 , the good thing is that as the ELM327 is a microcontroller it provides direct TTL or Uart communication this means that you can easily communicate your embedded system to the ELM327 through a Uart communication , the only problem was that the cable that i bought and probably the same cable you will find, it provides USB communication so i had to do a “hack” to bypass the usb interpreter and get only TTL communication .
The “hack” is to solder wire directly to the Rx and Tx pins of the PIC controller so i dolder the data cables of the usb cable directly to the Rx and Tx pins (worth to mention that once you do this you can not use it in the PC via usb).
So once this is done we have our communication hardware ready , so we can connect now the data cables of the usb directly to our atmega 2560 Tx and Rx pins.
I used an arduino MEGA but all the programming its done in C in atmel studio so is not arduino dependent i upload the program into the arduino using ICSP . So im not going to dig into details about the code , i just started a uart communication by wrtiting some registers and i used a 38400 baud rate which is the one present in this ELM327 .
If you read the ELM327 datasheet you will find that we can send some PIDS (Parameters IDs) to it to obtained a desire parameter ad for example if we want to know the actual speed of the card we should send trough Uart communication the next PID ‘010D’ once we send this sequence to the ELM327 it will answer to us whit the actual speed of the car.
Here you can find all the PIDs avaliable keep in mind we will use mode 01.
For more detail: Car datta logger Using OBD II protocol (atmega 2560+ SD card + lcd 16×2)