Lab set Program-10

UART Protocol – Sending a String Using Arduino


Objective

To set up UART (Universal Asynchronous Receiver & Transmitter) communication in Arduino and transmit a string message through the protocol.


Learning Outcomes

After completing this experiment, students will be able to:

  • Understand the basics of UART serial communication.

  • Configure Arduino for UART transmission using Serial.begin().

  • Send strings using UART protocol.

  • View transmitted data using the Serial Monitor in Tinkercad.


Components (from Tinkercad Palette)

  • Arduino Uno board

  • USB connection (built-in for simulation)

  • No external components required


Circuit Wiring (Exact)

No external wiring is required in Tinkercad because UART communication uses the built-in TX (pin 1) and RX (pin 0) lines internally.

  • TX → Transmit pin

  • RX → Receive pin

You will view the transmitted string using the Serial Monitor.


Arduino Sketch

// Lab Program 10: UART – Send a String

void setup() {
  Serial.begin(9600);           // Start UART at 9600 baud rate
}

void loop() {
  Serial.println("Hello, UART Communication!");   // Transmit string
  delay(1000);                                    // Wait 1 second
}

How It Works

  • UART is a serial communication protocol that transmits data one bit at a time using TX and RX lines.

  • Serial.begin(9600) initializes the UART driver with a baud rate of 9600 bits per second.

  • Serial.println() sends the string out through the TX pin.

  • In Tinkercad, the transmitted data appears in the Serial Monitor, simulating how UART behaves in real hardware.


Common Mistakes & Quick Fixes

Issue Cause Fix
No output in Serial Monitor Simulation not running Click Start Simulation first
Garbled characters Wrong baud rate Ensure Serial Monitor is set to 9600
No data visible Forgot Serial.begin() Add in setup()

Viva / Check-Your-Understanding

  1. What do TX and RX stand for in UART?

  2. Why do we specify a baud rate in Serial.begin()?

  3. What is the difference between Serial.print() and Serial.println()?

  4. Which Arduino pins are used for hardware UART?

  5. How is UART different from I2C or SPI communication?


Extensions (Mini-Tasks)

  • Modify program to send your name and USN every 2 seconds.

  • Send multiple sensor values in one formatted string.

  • Write a program where Arduino receives a character and echoes it back.

  • Display UART output on an LCD instead of Serial Monitor.


Lab Record (Suggested Headings)

  • Title

  • Objective

  • Components Required

  • Arduino Code

  • Output Screenshot (Serial Monitor)

  • Explanation

  • Viva Questions

  • Result



Comments

Popular posts from this blog