Course Content
📘 MODULE 11 – Edge Avoiding Robot
📦 MODULE 12 – Smart Multi-Function Robot (Mega Project)
Arduino Hands-On Programming and Robotics Course

📘 Lesson F6 – Serial Monitor Basics

🎯 Learning Objectives

After completing this lesson, students will be able to:

✅ Understand what Serial Communication is

✅ Understand the purpose of Serial Monitor

✅ Send data from Arduino to Computer

✅ Read sensor values using Serial Monitor

✅ Understand baud rate

✅ Use Serial.begin(), Serial.print(), and Serial.println()

✅ Debug Arduino programs effectively

✅ Troubleshoot communication issues


1. Introduction to Serial Communication

Before learning Serial Monitor, we must first understand:

What is Communication?

Communication means transferring information from one device to another.

Examples:

  • Mobile phone communicating with another phone
  • Computer communicating with printer
  • Arduino communicating with computer

In Arduino projects, communication is very important because it allows us to see what is happening inside the microcontroller.


2. What is Serial Communication?

Serial Communication is a method of sending data one bit at a time between devices.

Instead of sending all bits simultaneously, data is transmitted in sequence.

Example:

Suppose Arduino wants to send:

 
HELLO
 

Characters are transmitted one after another.

H → E → L → L → O

This process is called Serial Communication.


3. Why Do We Need Serial Communication?

Imagine you have connected:

  • Temperature Sensor
  • LDR Sensor
  • Ultrasonic Sensor

How will you know what values Arduino is reading?

Without Serial Communication:

You cannot see sensor values.

You cannot check if your program is working correctly.

You cannot easily find errors.

Therefore Serial Communication is one of the most important debugging tools in Arduino programming.


4. What is Serial Monitor?

Serial Monitor is a tool inside Arduino IDE that displays data sent by Arduino.

Think of it as a chat window between:

Computer ↔ Arduino

Arduino can send:

  • Sensor Values
  • Messages
  • Status Information
  • Error Messages

And the computer displays them through Serial Monitor.


5. Real-Life Example

Suppose an ultrasonic sensor measures distance.

Arduino reads:

 
25 cm
 

Arduino can send this value to Serial Monitor.

The computer displays:

 
Distance = 25 cm
 

Now the user knows the sensor is working correctly.


6. Serial Communication Hardware

Arduino Uno uses:

UART (Universal Asynchronous Receiver Transmitter)

Pins used:

Pin Function
D0 RX (Receive)
D1 TX (Transmit)

These pins handle serial communication.


RX and TX Explained

RX

Receive Pin

Used to receive data.


TX

Transmit Pin

Used to send data.


Communication Flow

Arduino

TX Pin

USB-to-Serial Converter

Computer

Serial Monitor


7. Opening Serial Monitor

There are two methods.

Method 1

Arduino IDE

Tools

Serial Monitor


Method 2

Press:

 
Ctrl + Shift + M
 

Serial Monitor window opens.


8. First Serial Program

 
void setup()
{
Serial.begin(9600);
}

void loop()
{

}
 

Understanding the Code

Serial.begin()

Starts serial communication.


9600

Represents communication speed.

This is called:

Baud Rate


9. What is Baud Rate?

Baud Rate represents how fast data is transmitted.

Common baud rates:

Baud Rate
9600
19200
38400
57600
115200

Most beginner projects use:

 
9600
 

Important Rule

The baud rate in code and Serial Monitor must be the same.

Example:

Program:

 
Serial.begin(9600);
 

Serial Monitor:

 
9600
 

If they are different, garbage characters will appear.


10. Sending Messages to Serial Monitor

Example:

 
void setup()
{
Serial.begin(9600);

Serial.println("Hello Students");
}

void loop()
{

}
 

Output:

 
Hello Students
 

11. Serial.print()

Used to display data.

Example:

 
Serial.print("Arduino");
 

Output:

 
Arduino
 

Cursor remains on the same line.


12. Serial.println()

Used to display data and move to the next line.

Example:

 
Serial.println("Arduino");
Serial.println("Programming");
 

Output:

 
Arduino
Programming
 

Difference Between print() and println()

Serial.print()

Output:

 
ArduinoProgramming
 

No line break.


Serial.println()

Output:

 
Arduino
Programming
 

Line break added automatically.


13. Displaying Numbers

Example:

 
int age = 22;

void setup()
{
Serial.begin(9600);

Serial.println(age);
}

void loop()
{

}
 

Output:

 
22
 

14. Displaying Text and Variables Together

Example:

 
int temperature = 30;

void setup()
{
Serial.begin(9600);

Serial.print("Temperature = ");
Serial.println(temperature);
}

void loop()
{

}
 

Output:

 
Temperature = 30
 

15. Continuous Data Display

Example:

 
void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.println("Arduino Running");

delay(1000);
}
 

Output:

 
Arduino Running
Arduino Running
Arduino Running
 

Every second.


16. Reading Sensor Values

Suppose a potentiometer is connected.

 
int sensorValue;

void setup()
{
Serial.begin(9600);
}

void loop()
{
sensorValue = analogRead(A0);

Serial.println(sensorValue);

delay(500);
}
 

Output:

 
320
450
512
700
 

Values change as the potentiometer rotates.


17. Why Serial Monitor is Important for Sensors

Serial Monitor helps:

Verify Sensor Working

Check Sensor Values

Calibrate Sensors

Troubleshoot Problems

Understand Sensor Behavior

Without Serial Monitor debugging becomes difficult.


18. Serial Monitor Controls

At the bottom of Serial Monitor:

No Line Ending

Sends data without special characters.


Newline

Adds line break.


Carriage Return

Moves cursor to start.


Both NL & CR

Adds newline and carriage return.


19. Sending Data from Computer to Arduino

Serial communication is two-way.

Computer can also send data.

Example:

User types:

 
ON
 

Arduino receives:

 
ON
 

This concept is used in:

  • Bluetooth Projects
  • WiFi Projects
  • Automation Systems

20. Common Serial Monitor Applications

Sensor Monitoring

Temperature

Humidity

Distance

Gas Levels


Robot Debugging

Movement Status

Motor Testing

Sensor Testing


Communication Systems

Bluetooth

WiFi

IoT


Project Testing

Before final deployment.


21. Common Beginner Mistakes

Mistake 1

Forgetting:

 
Serial.begin(9600);
 

Result:

No output.


Mistake 2

Wrong Baud Rate

Result:

Garbage characters.


Mistake 3

Serial Monitor Closed

Result:

No visible output.


Mistake 4

Typing Serial.print incorrectly

Example:

 
serial.print();
 

Incorrect because:

C++ is case-sensitive.

Correct:

 
Serial.print();
 

22. Best Practices

Always Start Communication in setup()

 
Serial.begin(9600);
 

Use Meaningful Messages

Example:

 
Serial.print("Distance = ");
 

Instead of:

 
Serial.println(value);
 

Use Serial Monitor for Debugging

Before checking hardware.


Keep Baud Rates Consistent

Always match program and monitor.


23. Real-World Example

Smart Water Dispenser

Sensor detects hand.

Arduino checks sensor.

Serial Monitor displays:

 
Hand Detected
Pump ON
 

This helps verify correct operation.


📊 Summary

In this lesson, we learned:

✅ What Serial Communication is

✅ What Serial Monitor is

✅ UART communication

✅ RX and TX pins

✅ Baud Rate

✅ Serial.begin()

✅ Serial.print()

✅ Serial.println()

✅ Sensor monitoring

✅ Debugging techniques

Serial Monitor is one of the most powerful tools in Arduino programming because it allows us to see what is happening inside the microcontroller in real time.


📖 Key Terms

Serial Communication

Data transfer one bit at a time.

UART

Universal Asynchronous Receiver Transmitter.

RX

Receive Pin.

TX

Transmit Pin.

Baud Rate

Communication speed.

Serial Monitor

Tool used to display communication data.

Debugging

Finding and fixing program errors.


🎯 Quiz

1. What function starts serial communication?

A. Serial.print()

B. Serial.begin() ✅

C. Serial.read()

D. Serial.start()


2. What is the most common baud rate?

A. 4800

B. 9600 ✅

C. 2000

D. 500


3. Which pin transmits data?

A. RX

B. TX ✅

C. GND

D. A0


4. What does Serial.println() do?

A. Deletes Data

B. Displays Data and Moves to New Line ✅

C. Uploads Program

D. Reads Sensor


5. Why is Serial Monitor useful?

A. Debugging ✅

B. Sensor Testing ✅

C. Monitoring Values ✅

D. All of the Above ✅


🏠 Assignment

Task 1

Write a program that displays your name every second in Serial Monitor.

Task 2

Write a program that displays your age using a variable.

Task 3

Display both text and a number together using Serial.print() and Serial.println().

Task 4

Connect a potentiometer (or any analog sensor) and display its values in Serial Monitor.

Task 5

Experiment with different baud rates and observe the results.

Scroll to Top