Serial communication is the standard USB connection between the Arduino and a computer with a standard USB A to B cable or through the TX/RX pins using a USB to serial converter. It can also refer to the serial library.

Serial communication is the standard USB connection between the Arduino and a computer with a standard USB A to B cable or through the TX/RX pins using a USB to serial converter. It can also refer to the serial library.

[Serial is] used for communication between the Arduino board and a computer or other devices. 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. You can use the Arduino environment's built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin().

Excerpt from the Arduino Page about Serial.

Most boards have only one serial port. Exceptions:

  • Leonardo has two: one connected to USB and the other connected to pins 0 and 1 for connection to UART items.
  • The Mega/Mega2560 has 4 serial ports, one connected to a UART to USB converter.
  • The DUE also has 4 serial ports, one connected to a UART to USB converter.

The serial is outputted through UART. Then, for the primary serial connection on pins 0 and 1*, the data goes to a UART to serial chip** and then transferred to/from the computer.

*On some boards, such as the Leonardo, it doesn't use the pins 0 and 1.

**On some boards, such as the Leonardo, there is no USB chip because it is built into the chip itself, or it has no USB connection.


The serial library:

Arduino includes a library for inferencing with the serial ports. Here is some example code:

void setup() {
  // open the serial port at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  Serial.println("Hello World!");
  delay(1000);
}
history | excerpt history