Forum >How to use softwareSerial with OBD-II Adapter?
Telematics General

How to use softwareSerial with OBD-II Adapter?

userHead wahmalik85 2014-01-25 22:26:08 4999 Views2 Replies
I have an Arduino Uno, and I already use Serial with GSM/GPRS/GPS shield and I'd like to add softwareSerial that connect with OBD-II Adapter, how can I make OBD RX goes to Arduino softwareSerial TX on pin 12?

:)
2014-01-30 02:36:42 ammm, Thank you for your replay.
userHeadPic wahmalik85
2014-01-28 00:42:15 Hi all,

I included the library of SoftwareSerial.h in OBD.cpp file:

[code]#include <Arduino.h>
#include <avr/pgmspace.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

#include "OBD.h"[/code]

and modified the original serial of uno to software serial in OBD.h file in the line 17

[code]#ifndef OBDUART
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega644P__)
#define OBDUART Serial1
#else
#define OBDUART mySerial
#endif
#endif[/code]

and it complied successfully.
But when I attach the OBD adapter to software serial, the communication between OBD adapter and Arduino is faild and stuck on  this loop:

[code]// initiate OBD-II connection until success
    while (!obd.init()); [/code]

is there any solution for this?

thank you.
userHeadPic wahmalik85