Arduino Project: Software Serial Communication

Home / Arduino Project: Software Serial Communication

Arduino Project: Software Serial Communication

December 11, 2015 | Article | No Comments

In most case, our device are stand-alone application, which means we don’t involve any additional computer for operation. However, we can still make Arduino interact with our computer in such nice way. We use serial communication to achieve this.

Most possible reason for communication is debugging purpose. We analyze Arduino state for various input and condition given, by reading output shown by Arduino. The serial communication can also be used for communication of two devices.

Arduino have built-in support for serial communication on pin 0 and 1, but what if we need more serial ports? Here come SoftwareSerial Library to rescue. This library has been developed to allow serial communication to take place on the other digital pins of our Arduino board, using software to replicate the functionality of the hardwired RX and TX lines. This can be extremely helpful when the need arises to communicate with two serial enabled devices, or to talk with just one device while leaving the main serial port open for debugging purpose.


  • Use pin 10 and 11 as virtual RX and TX serial lines.
  • Echo data received from main RX serial line to virtual TX line.
  • Echo data received from virtual RX line to main TX serial line.



Following is all materials I use for this tutorial.

  • Arduino Uno R3

You can change the Arduino board to higher specification if you like.

You also need an USB A to B cable for upload our program to our Arduino and also for serial communication.


Here is the circuit image, created using Fritzing.


We don’t need any extra component to do this project.



Let’s see what code we use for this project and discuss it later.

#include <SoftwareSerial.h>

SoftwareSerial EuSerial(10, 11);        // Bind RX and TX to pin 10 and 11

void setup() {
  // Open serial communications and wait for port to open
  // Wait for serial port to connect. Needed for Leonardo only

  Serial.println("Arduino SoftwareSerial Demo");

  // Set the data rate for the SoftwareSerial port
  EuSerial.println("Hello, world?");

void loop() {
  // Echo data from virtual RX to main TX
  if (EuSerial.available())
  // Echo data from main RX to virtual TX
  if (Serial.available())

Here we have two serial line: Arduino serial and virtual serial by SoftwareSerial. Both have difference baud rate, the main lines have baud rate 57600 while the virtual lines have baud rate 4800.

The initialization of both lines are similar. We use begin() function to set the baud rate of both lines.

In loop(), we will echo every input we got. To do that, we should check the availability first. This is done by executing available(). To read data, Arduino use read() function. To send data to other end, Arduino provide print() and println() function. These functions are slight different where println() send extra new line character at the end of transmission.


You need two serial lines connected to your PC. The result should be similar to Simple Serial Communication project. It is strongly recommended to use PuTTY and connect to both port recognized by your computer.

Why it Works

We have demonstrate serial communication in this project. The word serial means “one after the other”. Serial data transfer is a transmission method where data is transferred one bit at a time, one right after the other.

Information is passed back & forth between the computer and Arduino, by essentially, setting a pin high or low.

There are two condition of logic in circuit, HIGH and LOW. Some microcontrollers might define HIGH and LOW difference, but in Arduino Uno we have HIGH logic as 5V and LOW logic as 0V. If you know boolean value, yes this is boolean value with HIGH is true and LOW is false.


About Author

about author


A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social Share Buttons and Icons powered by Ultimatelysocial