Nano - TTL and serial ?

i have just bought one of these

http://arduinodev.com/hardware/obd-kit/

it connects to pins 0 and 1 for TTL tx/rx

does the nano only have the capability to run one serial port ?

can i read the device and also transmit the found data to the serial port ?

I also have a leonardo or mega i could use

any suggestions ?

The Nano has one hardware serial port. You can use software serial to an extent for other ports. Why do you need more than one (if you do)?

The Mega has 4 hardware serial ports.

the obd device needs a port
and i want to transmit the data to a pc using serial

so 2 ports needed

i will try the leonardo / mega

do you just name the serial to Serial1 etc ?

Gadget999:
the obd device needs a port
and i want to transmit the data to a pc using serial

so 2 ports needed

i will try the leonardo / mega

do you just name the serial to Serial1 etc ?

no need, just use SoftwareSerial library the pro mini is quite capable of handling it, what’s the UART baud rate? there’s a limit to high softSerial can handle.

#include <NewSoftSerial.h>
//
NewSoftSerial mySerial(2, 3);
/
 //void setup()
 {
   mySerial.begin(9600);  //replace 9600 with baud rate of the UART.
 }

void loop()
{
  char c;
    if (mySerial.available()) 
  {
    c = (char)mySerial.read(); // get the UART OBDC data
    Serial.println(c); //spit it out to the pc.
  }
}
code]

infact, i just compiled it, not tested though.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()  
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
  mySerial.begin(9600);
}  

void loop() // run over and over
{
   char c;
    if (mySerial.available())
     {
      c=mySerial.read();
      mySerial.print(c);
     }
}

Stick the UART of the ODBC into pins 2&3 remember to change the Serial baud rate to match or it will be garbage you’ll get back and send.

I also have a leonardo or mega i could use

Yes these will be better to use than the nano. The Leonardo can emulate a USB serial device back to the computer leaving the hardware UART free. Or as nick said the Mega has four serial ports.
Using software serial on a nano is a poor choice given the resources you have.

cjdelphi:
infact, i just compiled it, not tested though.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()  
{
// Open serial communications and wait for port to open:
 Serial.begin(9600);
 mySerial.begin(9600);
}

void loop() // run over and over
{
  char c;
   if (mySerial.available())
    {
     c=mySerial.read();
     mySerial.print(c);
    }
}




Stick the UART of the ODBC into pins 2&3 remember to change the Serial baud rate to match or it will be garbage you'll get back and send.

thanks for the info - the uart runs at 3840 will the softwareserial port work ok ?

can you run this libary on any arduino to get extra ports ?

3840 should be fine....

3840 should be fine....

You sure of that, it is either a typo or a very non standard baud rate.

i did think the speed was unusual - i guess it is an automotive baud rate

Gadget999:
i did think the speed was unusual - i guess it is an automotive baud rate

If you have trouble, you might want to try 38400.

Gadget999:
i did think the speed was unusual - i guess it is an automotive baud rate

Yes a quick google revels that is correct.