Car Hacks Using Arduino
This documentation presents simple and cost effective way of hacking car's OBD stream. In this I am trying to show the general way to get the OBD informations.
Here I am using Arduino UNO, CAN-Bus shield(1.2), DB9 cable for connecting to OBD port and for programming Arduino IDE(which helps to burn the code to uno with ease).
I started this project for establishing door auto lock when vehicle is getting speed of 20KM and auto roll up of all windows when car locked from outside.
For finding the data which produced from the OBD port need to analyse and understand the data before starting this project.(Need more patience and continuous through put).
Here the story begins.(I'm trying on Hyundai Grand i10, Magna, 2019 - Make in India , Data will vary according to manufactures / variants etc).
Hardaware Purchasing Links
- CAN-bus arduino shield - CAN-bus shield
- Arduino UNO - Arduino UNO
- OBD Port to DB9 Cable - DB9 Cable
Organize Hardware, IDE and Other Necessary Things
Before starting project, we have to ensure that all hardware using for this project should check and make the working as expected. So we have to connect the hardware to OBD port and need to ensure there is no smoke or unnecessary heat produced from the hardware, then we have to burn sample code to ensure the hardware can read the data stream from OBD.
First step begins here, Set up Arduino IDE in machine and make sure that necessary libraries are installed on it. On after connecting arduino uno to computer, then we have select the connected serial port and board type in Arduino IDE.
Sample code should download from git repository and burn code to Arduino Uno, then we have connect the shield to OBD port then begins the data stream reading.
Git Repository -
https://github.com/JijovarghesePunalur/CarHacks.git
You can get Sample code and library for connecting and extracting Can-bus data stream. After cloning the project, you can copy the library files inside the arduino file folder and execute compile and burn process in arduino IDE.
Before burning the code to Arduino Uno, you have to connect the arduino to computer then need to select the Serial Port and board type in Arduino IDE.
In example folder you can see Read operation, write operation and Serial-Message files, basically contents made by using common library files. Serial-Message differs with Read program on the basis of output format, that is in this project I tried to use can-utils in linux for sorting out the recurring messages.
Usage and execution of can-utils, you can find it on Readme.md file of CarHaks .
Video Link
This video will give you exact idea about CAN-bus data stream (OBD port). It might be simple because I included only essential informations.
Do It Yourself and Surprise
Write back to CAN-bus using the extracted data using Serial Message, this will really surprise you.(You can find writing program in the repository, try it now).
You can control everything connected with ECU / BCM , only need to analyse the data then write back.
Next Project will be based on this study - Controlling Car using Smart phone.