Pages: [1] 2 3   Go Down
Author Topic: Can the Uno handle two serial port functions ?  (Read 3865 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Ardunio Uno that I would like to connect the rxd (d0) and txd (d1) lines
to a serial device to send and receive data with that device.

I also want to echo data to the USB port to a PC to display the data in a Labview application.

Can the Uno handle these two serial port functions with d0/d1 and the USB port?

Thanks
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Ardunio Uno that I would like to connect the rxd (d0) and txd (d1) lines
to a serial device to send and receive data with that device.

I also want to echo data to the USB port to a PC to display the data in a Labview application.

Can the Uno handle these two serial port functions with d0/d1 and the USB port?

Thanks

No. However you could run a software serial library for the serial device and utilize pins 0 and 1 serial for the PC. The mega board does have four build in hardware serial ports if you wanted to go that way.

Lefty
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As Lefty stated. Uno no; mega yes.
But the leonardo should be able to do this as well and is cheaper than the mega.
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the info...

The Leonardo might work for me if it has 2 serial ports as you say...

Does the Leonardo have the same footprint & pinout as the Uno?

From pictures that I have seen they look the same except for the USB connector
as the Leonardo has a mini, is this correct? 

What other differences are there between the Uno and Leonardo?
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


The Leonardo might work for me if it has 2 serial ports as you say...

And it might not as the Leonardo can bring its own limitations to the table, and I understand the software serial library Lefty mentions is written with exactly this in mind, for the Uno you already have, and it is free.
« Last Edit: April 09, 2013, 03:31:56 am by Nick_Pyner » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Quote
The Leonardo might work for me if it has 2 serial ports as you say...
Quote

And it might not as the Leonardo can bring its own limitations to the table, and I understand the software serial library Lefty mentions is written with exactly this in mind, for the Uno you already have, and it is free.

What limitations?
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2302
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If I ever knew, I've forgotten. When I looked at the options it was pretty clear that there are essentially two types of Arduino. There is the Uno, Mega, and those of that ilk in the mainstream, and there is the rest in the peripheral niches. On looking at the options, the niches very peripheral and the mainstreamis unsurprisingly where you find the bang for the buck. Most pointedly, you would need to see something pretty convincing to pass up the Uno you already have if that can be persuaded to do what you want at no cost. 
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does anyone know if the Uno or the Leonardo can be used as a Serial to USB adapter?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does anyone know if the Uno or the Leonardo can be used as a Serial to USB adapter?

The Leonardo can be used as this, the UNO includes an ATmega16U2 for this purpose, so theoretically it can be used too. But I guess you question is too general to be of value for your purpose.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



Quote
Does anyone know if the Uno or the Leonardo can be used as a Serial to USB adapter?


Quote
The Leonardo can be used as this, the UNO includes an ATmega16U2 for this purpose, so theoretically it can be used too.


Thanks, 

I will scour the web looking for some example code of using the Leonardo as a Serial to USB converter...
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does anyone know if a Uno be used as a Serial to USB converter with the use of
the SoftwareSerial library or is this only for Leonardo & Mega arduinos?

thanks
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Does anyone know if a Uno be used as a Serial to USB converter with the use of
the SoftwareSerial library or is this only for Leonardo & Mega arduinos?

You don't need the SoftwareSerial library just for a Serial2USB converter because the UNO has one onboard. Just connect the USB and put the serial device on pins 0 and 1 and you have a USB2Serial device.
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1926
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As you have a uno your best option is to try the software serial. It is just downloading the lib and try.
I have used software serial before and the quality is OK.
One of the differences between UNO and leonardo is that the USB on the UNO is serviced by a chip which is actually connected to pin 0 and 1.
On the Leonardo that is not the case. This means that the serial port on pin 0 and 1 is free for other usages. In other words with the Leonardo you have 2 hardware serial ports.

Leonardo does have some drawbacks as well. Basically it is not as mainstream as the UNO so there were/are libraries that do not support the Leonardo. It changes all the time so if you want a project with the leonardo it is better to check at that time whether all shields/libraries needed support the Leonardo.

Adding this all up: try with your uno and the software serial lib http://arduino.cc/en/Reference/SoftwareSerial.
The comment on the code states
Code:
Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.
Sounds like what you are looking for.
Best regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 74
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You don't need the SoftwareSerial library just for a Serial2USB converter because the UNO has one onboard. Just connect the USB and put the serial device on pins 0 and 1 and you have a USB2Serial device.



Quote
As you have a uno your best option is to try the software serial. It is just downloading the lib and try.
I have used software serial before and the quality is OK.
One of the differences between UNO and leonardo is that the USB on the UNO is serviced by a chip which is actually connected to pin 0 and 1.

Thanks for the ideas...

Has anyone successfully made a Serial2USB converter with a Uno with its shared pins 0 & 1?
 
I will try the SoftwareSerial library which should allow me to use pins (other than 0 & 1)  because I am concerned about communication issues if pin 0 & 1 are shared for both my serial device and the USB to the PC unless I can see some example code that works...

I appreciate the help !
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 111
Posts: 5242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I will try the SoftwareSerial library which should allow me to use pins (other than 0 & 1)  because I am concerned about communication issues if pin 0 & 1 are shared for both my serial device and the USB to the PC unless I can see some example code that works...

What do you want to do? If you want your UNO to be a USB2Serial device you can just connect it via USB to your PC and connect the TTL serial device to pins 0 and 1. Voilà, you have your USB2Serial. You don't need any software to be run on the UNO, it acts as a USB2Serial converter.
If you need something else than a USB2Serial converter, tell us what you want to achieve!

The SoftwareSerial class works OK for baud rates up to 9600, with some devices even up to 38400. I personally never got beyond that limit.
Logged

Pages: [1] 2 3   Go Up
Jump to: