Car datta logger Using OBD II protocol (atmega 2560+ SD card + lcd 16×2), lcd

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.
Car datta logger Using OBD II protocol

Step 1: Communication with the ECU (Engine Control Unit)

Since 1996 every car has a diagnostic system or On Board diagnostics (OBD) whic means that every car since then has an ECU and therefore has a communication protocol running on it, this is to communicate all the sensors that the car has.So our goal for this part is to be able to communicate or system whit the ECU of the car to obtained the desire information.When i did the research i found out that there are several embedded systems that can fulfill this requirement so first you need to know which protoclo is actually on your car as i was working on a Mazda 3 2005 the protocol was ISO 15765-4 (CAN 11bits/500kbps) , you can check the protocol by cheking the present pins on the OBD connector of your car.
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 .
Car datta logger Using OBD II protocol Schemeticr dattta
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)

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top