Difference between revisions of "F16: OBD2 Reader"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Project Video)
(Project Video)
Line 250: Line 250:
  
 
=== Project Video ===
 
=== Project Video ===
Upload a video of your project and post the link here.
+
* [https://www.youtube.com/watch?v=XCZJhFQx6W0&feature=youtu.be OBD2 Project]
[[https://www.youtube.com/watch?v=XCZJhFQx6W0&feature=youtu.be OBD2 Project
 
  
 
=== Project Source Code ===
 
=== Project Source Code ===

Revision as of 04:11, 20 December 2016

Grading Criteria

  • How well is Software & Hardware Design described?
  • How well can this report be used to reproduce this project?
  • Code Quality
  • Overall Report Quality:
    • Software Block Diagrams
    • Hardware Block Diagrams
      Schematic Quality
    • Quality of technical challenges and solutions adopted.

Abstract

The OBD2 reader system connects a microcontroller to the ECU of a vehicle using a transceiver and OBDII protocol. OBD2 codes from the vehicle are compared to the microcontroller's database. If there is a match, a corresponding message is displayed to the user via an LCD screen. The message alerts the user of problems diagnosed and suggestions for further steps.

OBD2 Reader

On-board vehicle diagnostics (OBD) refers to an interface that connects to a vehicle's computer and allows the vehicle to self-diagnose problems and report them. OBD-II or OBD2 is an OBD standard which the type of connector, messaging format, electrical signaling, and a list of other vehicle parameters.

The OBD2 reader is an on board diagnostic device that translates the diagnostic code from a vehicle's engine control unit (ECU) to comprehensible data for the user. This device employed several protocols from CMPE 146 lab and techniques taken from the Socialledge Wiki to implement the design. The cars onboard ECU takes all the sensory data from several sensors and units and translates it into hexadecimal numbers that it then outputs its OBD2 port. Our OBD2 ready device links with the car’s ECU and reads diagnostic information from it, which it then transmits to the microcontroller which in turn compares the information to its database codes and print a message that explains what the code means. If the codes from the ECU match the code stored on our board, the board will display the result on Hercules and an LCD device that was configured with out system. The LCD device was implemented on top of our board using the I2C protocol; it display the error message corresponding to the vehicle's obd code as well as diagnostic suggestions and further steps to take.

CAN Bus

Controlled Area Network (CAN Bus) Bus is a message-based protocol used by all vehicles. CAN bus allows devices and microcontrollers to communicate without a host machine. Several different devices can be interfaced to CAN Bus, such as the control unit for the airbags, an anti-lock braking system, the power steering system, a proximity sensor, and the OBD connector.


File:CAN H L.png

Figure 1. CAN Bus wiring

The CAN Bus is made up of two wires, CAN-H (CAN High) and CAN-L (CAN Low). Both wires connect to all devices on the bus. A signal is transmitted as a differential pair of signals on its own wire. When the CAN-H wire receives a signal, the CAN-L wire also receives the same signal but with an opposite amplitude. The reason for this is to reduce the chance of data corruption by making it less vulnerable to noise. The CAN-H wire can go from 2.5V to 3.75V and the CAN-L wire can go from 2.5V down to 1.25V.

CAN Bus Wiring.png

Figure 2. CAN Bus Communication


When the CAN Bus is implemented on a vehicle, both CAN-H and CAN-L wires must be twisted together with two 120 Ohm terminating resistors. By having the wires twisted together, they are able to eliminate any noise. The two terminating resistors are connected to both ends of the bus to eliminate any signals from reflecting. In Figure 2, Device 1 denotes the LPC1758 microcontroller and Device n denotes a transceiver. Device n is required as the RX and Tx pins from the microcontroller send out logical signals that need to be converted to a sigle differential pair which connects to the OBD2 port.

File:CAN Frame.png

Figure 3. CAN Bus Frame

The CAN bus system has two different formats for the message frame, 2.0A and 2.0B. The difference is that 2.0A is the standard and uses 11 bits in the arbitration field, and 2.0B is the extended version and uses 29 bits in the arbitration field.

The CAN Bus data message frame is composed of a Starting Frame, an Arbitration Field, a Control Field, Data Field, Cyclic Redundancy Check, Acknowledge Field, and an End of Frame. The Starting Frame is used to indicate the start of a message when bit is zero. The Arbitration Field is used to define the message priority. The Control Field is used to describe the length of the data being sent. The Data Field is used to send the actual payload to the other CAN nodes. The Cyclic Redundancy Check is used to detect any errors in the data. The Acknowledge Field is used to let the transmitter know that they successfully received the data. The End of Frame is used to indicate the end of the data.


In the CAN system, there is no control host. When a CAN node is about to send data into the bus it first checks to see if the bus is busy. If the bus is not busy, the CAN node will send a message frame to the bus. The message frame does not contain a destination address so the message frame will be received by all nodes on the bus. Depending on the Arbitration Field, each CAN node will decide if they should ignore or accept the frame. When more than one CAN node tries to send a frame to the BUS at the same time, the node with the lower Arbitration ID will have the higher priority to the bus. The lower priority nodes will have to wait until the higher priority one is done.

Objectives & Introduction

This project aims to design an OBD2 reader using the SJOne LPC 1758 board. The reader will display a vehicle's Engine Control Unit (ECU) information via an LCD screen.

Objectives:

  • Interface the SJOne board with the OBD2 reader
  • Store and read external memory module through SJOne board
  • Interfacing SJOne to external LCD or OLED display

Sensors and Peripherals Used:

  • ECU (information source device)
  • SJOne (for processing information)
  • External Memory and Memory Interface
  • LCD or OLED (display vehicle diagnostics)

Team Members & Responsibilities

  • R Nikfar
    • Electrical Engineering Advising, Can Bus protocol Design, Eagle PCB design, Electrical Components, Firmware Coding, and Mechanical Engineering sensor and Component Debugging.
  • Samira Oliva
    • CAN Driver Programming and Setting up the memory unit.
  • Samuel Palomino
    • CAN Driver Programming, OLED Display Driver Programming and Component Debugging.
  • Erik Sanchez
    • Setting up the memory unit.

Schedule

Week # Start Date End Date Planned Tasks Status Actual Outcome
1 10/30/16 11/05/16
  • Project proposal
  • Research parts
  • Order basic parts
  • Rough design
Completed
  • Proposal approved.
  • Purchased OBD2 to DB9 adapter.
  • Ordered OLED Display.
  • Finalized group logistics.
2 11/06/16 11/12/16
  • Order remaining parts
  • Finalize design
  • Generate schematic
In Progress TBA
3 11/13/16 11/19/16
  • Set up interface OBD2 to SJOne
  • Set up interface SJOne to external memory
  • Set up interface SJOne to OLED display module
Incomplete TBA
4 11/20/16 11/26/16
  • Decode OBD2 outputs using external memory
  • Fetch & store procedures with external memory
  • Implement display module driver software
Incomplete TBA
5 11/27/16 12/03/16
  • Finalize fetch & store procedures
  • Integrate display module driver with fetched data
Incomplete TBA
6 12/04/16 12/10/16
  • Finalize software interface
  • Debugging & testing
  • Create housing/enclosure box for system
Incomplete TBA
7 12/11/16 12/17/16
  • Debugging & testing
  • Write Report
Incomplete TBA
8 12/18/16 12/20/16
  • Finish report
  • Demo Presentation
Incomplete TBA

Parts List & Cost

Give a simple list of the cost of your project broken down by components. Do not write long stories here.

Item Qty. Price (Total) Description
SJOne Board 1 $80.00 SJOne board
OBD2 to DB9 Adapter 1 $6.99 Connects the vehicle's ECU to SJOne board
OLED Display 1 $9.99 I2C 128x64 Display Module
TBA X $X TBA

Design & Implementation

The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

  • Communication Protocols
    • Controller Area Network (CAN)
    • I2C

Implementation

This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.

Testing & Technical Challenges

Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.

Include sub-sections that list out a problem and solution, such as:

My Issue #1

Discuss the issue and resolution.

The first issue that was encountered involved the memory unit. For this project, we planned to use an AT45 IC FLASH 64MBIT 85MHZ memory. After connecting the memory module to the LPC1758, we created a text file containing the DTCs (Diagnostic Trouble Code) and tried to open the file using Eclipse and transfer the data onto the AT45. After spending days trying to that, we seeked advise from the lab assistant, Praveen. We were informed that we would not be able to open the file and transfer the data to the AT45. If we wanted to transfer data, we would have to type the code and every DTC on the Eclipse IDE, which would take too much time to do because there is about 76 pages of DTCs. Instead, we transferred the text file with the DTCs on the micro SD card and inserted the card on the LPC1758. We later learned that we did not need all the DTCs. We only chose a few DTCs which were able to be stored on the LPC1758's onboard memory.

Conclusion

Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?

Project Video

Project Source Code

References

Acknowledgement

Any acknowledgement that you may wish to provide can be included here.

References Used

List any references used in project.

Appendix

You can list the references you used.