OBD II_Adapter_for_Arduino_SKU_TEL0066 - jimaobian/DFRobotWiki GitHub Wiki

Getting Started

The adapter stays plugged into the OBD port usually located under the steering column or slightly to the left of it.

image:TEL0066_1.jpg| image:TEL0066_2.jpg| image:TEL0066_3.jpg|

A cable coming out from the adapter splits into two 2-pin Dupont connectors with one for power (VCC/GND) and one for data (Rx/Tx). They are connected to Arduino to provide both power supply and data connection. Your Arduino setup will look tidy in car with only one cord.

Power Lines: Red: VCC (connecting to Arduino's 5V/VCC) Black: GND (connecting to Arduino's GND)

Data Lines:

White: Rx (connecting to Arduino's serial Tx) Yellow: Tx (connecting to Arduino's serial Rx)

The Library

A dedicated Arduino library is developed and maintained regularly, providing a set of easy-to-use APIs to retrieve realtime data from a vehicle.

Here is an example code of a simplest engine RPM indicator, which uses the pin 13 LED (built in every Arduino board) to indicate whether the engine is above 5000rpm.

#include <Wire.h>
#include <OBD.h>

COBD obd;

void setup()
{
  // we'll use the debug LED as output
  pinMode(13, OUTPUT);
  // start communication with OBD-II adapter
  obd.begin();
  // initiate OBD-II connection until success
  while (!obd.init());
}

void loop()
{
  int value;
  // save engine RPM in variable 'value', return true on success
  if (obd.read(PID_RPM, value)) {
    // light on LED on Arduino board when the RPM exceeds 3000
    digitalWrite(13, value > 3000 ? HIGH : LOW);
  }
}

FAQ

'''Q: What is this product used for? '''

'''A: The most straight-forward use of this product is for making Arduino possible to access vehicle data easily. The OBD-II data, together with other data from GPS or all kinds sensors, can be logged and stored on SD/TF card with Arduino and that makes an open-source vehicle data logger (check out the Data logger kits). More extensively, many interesting interaction applications requiring car data can be made. '''

chec

'''Q: How is the adapter powered? '''

A: The adapter gets power from the 12V DC output from the OBD-II port. And please be noted that the 2A/10W version works with both 12V and 24V input.

'''Q: Does my Arduino needs power from somewhere in the car? '''

'''A: The adapter provides regulated 5V output for powering Arduino and other devices, so no extra power cord is needed. '''

Q: Do I need a CAN bus shield to use with the adapter?

A: Definitely no. The adapter retrieves data from CAN bus, like a CAN bus shield does and convert the more complicated CAN bus interface to simple serial UART interface which Arduino and most embedded systems are easy to access. The data connection is provided by adapter’s data connector (Rx and Tx).

'''Q: How do I connect the adapter with my Arduino? '''

'''A: The adapter works with all models of Arduino with the dedicated Arduino library and is connected with Arduino by connecting adapter’s Tx to Arduino’s Rx (D0) and adapter’s Rx to Arduino’s Tx (D1). If you want to connect and disconnect the adapter with your Arduino effortlessly, it’s recommended to use a common I/O breakout shield or use an Arduino board with breakout pins for Rx/Tx/VCC/GND. '''

'''Q: Is the power provided by the adapter always available in car? '''

A: This depends on whether the OBD-II port of your car still has power after ignition is off. Actually it is so with most cars.

Q: What’s the maximum frequency of data polling?

'''A: The OBD-II PIDs are polled one after another. The time for a polling depends on the speed of car’s ECU computer and how busy the computer is in different status. With a typical modern car with CAN bus, the time can be as low as 20ms. In other word, up to 50 times of data polling can be done in one second. '''

More

link=http://www.dfrobot.com/ get it from dfrobot store or dfrobot distributor.

⚠️ **GitHub.com Fallback** ⚠️