Pages: [1]   Go Down
Author Topic: Serial Port Question  (Read 1656 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am in the initial planning stages of a controller for my aquarium, and am currently trying to map out all my pins in Excel before starting to code and wire things up.

I have 4 probes (Atlas Scientific SDS kit) that I would like to use which all connect to a 'stamp' that requires a serial connection to Arduino.  I see that the Due has pins RX0-3 and TX0-3, but have read that RX0 and TX0 are used for the USB communication.

From http://arduino.cc/en/reference/serial:
Quote
All Arduino boards have at least one serial port (also known as a UART or USART): Serial. It communicates on digital pins 0 (RX) and 1 (TX) as well as with the computer via USB. Thus, if you use these functions, you cannot also use pins 0 and 1 for digital input or output.
This leads me to believe that I can use pins 0 and 1 for serial communication with for example a probe.

Quote
The Arduino Due has three additional 3.3V TTL serial ports: Serial1 on pins 19 (RX) and 18 (TX); Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip, which is connected to the USB debug port. Additionally, there is a native USB-serial port on the SAM3X chip, SerialUSB'.
But then this quote muddies it for me, and I can't tell if I can use pins 0 and 1 or if they are reserved.

So my question is, if I am not using the USB port for anything aside from uploading my code (ie once the controller is complete and attached to the aquarium) can I use all 4 serial ports for my probes?

I do also have a Mega that I will likely be using as a slave device for additional pins, but would prefer to have all of the probes handled through 1 board.


Sorry for the thin details, I really don't have much else at this point.  Hope my question makes sense.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As far as pinouts, you might like this...



Source:
http://forum.arduino.cc/index.php/topic,132130.0.html

I don't think you can use the UART0 port, given is already connected to another UART device which does the USB to UART conversion.

I don't think SoftwareSerial is supported by the Due yet, otherwise you could add more Serial inputs.

May I ask what is your ultimate goal? I have a feeling there may be an easier way than to plug all these devices to one Arduino...
Logged

No trees were harmed by the transmission of this message. However a few million electrons were temporarily inconvenienced.

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.  I have been studying that pinout diagram.

My ultimate goal is to utilize 4 probes for reading and graphing the salinity, pH, ORP and DO in my saltwater aquarium.  Each of the 4 probes came with a small circuit called a "stamp" which has both a TX and RX pin for connecting to an Arduino.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 112
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In other words, all you want to do is log this data so you can later graph it?
If this is the case then I would use the Arduino mega you have available and use softwareserial for the extra UART. Log the data to an SD card etc. An even easier way would be to use USB to TTL adapters, all four to a PC, log all streams from terminal windows to text files, no programing required.
Logged

No trees were harmed by the transmission of this message. However a few million electrons were temporarily inconvenienced.

US
Offline Offline
Full Member
***
Karma: 4
Posts: 183
Electronics are the new Legos
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do your devices have more than the TX/RX serial pins?  Using other RS232 signals like clear to send, data set ready, etc. you could use a small external circuit to tell each device to wait and you'd poll each serial device in turn, using only one serial port and a control lines.

Of course someone completing a SoftwareSerial library would be the best solution.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8530
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The SAM3X actually has 5 serial ports, the UART used for programming and 4 USARTs, for some reason the Arduino team decided not to support USART2, but it's there and the pins are available on D52 and D62(A11).

_____
Rob
« Last Edit: June 07, 2013, 10:10:21 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So my question is, if I am not using the USB port for anything aside from uploading my code (ie once the controller is complete and attached to the aquarium) can I use all 4 serial ports for my probes?

I believe you can.  Use Serial1, Serial2, Serial3 for pins 14-19, and Serial for 0,1.  Pins 0,1 will still drive the USART, but thats Ok as long as you are not connected to the USB.

And why not use SerialUSB as the 4th one?  Answer: Because its too flaky for two way comms!  See other posts in this forum...

Ugly workaround that worked for me: Program/debug via the Native port, and use the programming port for comms.
« Last Edit: September 07, 2013, 12:35:11 am by peebee » Logged

Pages: [1]   Go Up
Jump to: