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.


  • Input/Output from and to Arduino.
  • Doing simple math operation and output the result.
  • Echoing the user inputs.


  • none


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.

In the first line we declare a constant, BAUD_RATE, which has value 9600. Baud rate is the rate of character transferred every second. Notice that 1 character is equal to 1 byte or 8 bit. Both party who communicate using serial communication must agree on same baud rate before transmission began. If baud rate is not equal, data can’t be transferred correctly.

Here we introduce a object called Serial. This object handles input output in serial communication. To use this object we should initialize which baud rate we use. In this case we use 9600, which is common baud rate used.

We declare three variables for our math operation: a, b, and c with their respective value. In setup() we do some basic math operation over these three variables. The result will be presented every time we initiate serial connection.

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.


Once the program is uploaded, open “Serial Monitor” window in Arduino IDE. It is our tool to do serial communication using Arduino IDE. You can open it by navigate to Tool > Serial Monitor. Another way to do it is press CTRL + SHIFT + M at once.


Here we will be presented with the result of our math operation.

To give input to Arduino, type in to the text box and click on “Send” button. You will see nice similar message you type. Here is the result after I type “Satria Ady Pradana”:


Alternatively, you can use puTTY in Windows or Linux terminal in Linux. However we won’t cover this subject.

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.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">