Simple Chat Program With Arduino Uno




This will be my first post on Arduino projects, so instead of starting with the basics, I shall try something new. In this post, I am going to do a simple chat program using two Arduino Uno.

What you will need for the project:

1. 2 x Arduino Uno (or any other Arduino boards)

2. 2 x Jumper Wires

3. 2 x USB Cables

Step 1: Setup the Hardware

The hardware setup is actually pretty simple. Just connect pin 10 of each Arduino to pin 11 of the other using the jumper wires. The theory behind this is that pin 10 is the RX pin and pin 11 is the TX. To communicate serially, you have to connect the TX to RX and RX to TX. Once that is done, connect it to your PC.

Step 2: Programming the Arduinos

Once you had successfully connected to your PC, then you can start programming your Arduino boards. I assume that you have your Arduino IDE installed, if not, head to this link here and download it. Arduino IDE download

In your PC, you will need to open two session of Arduino IDE. Make sure they can access two different ports. It must be opened differently and you should not open the other session in the same window. This will not work. The logic is that you need to open two IDE sessions so that your computer can communicate with both your Arduino serially, and print the results in the serial monitor. Once the IDE is up, download the below sketch to both of the Arduino.

/*<br>  Simple Chat Program
 Receives from the hardware serial, sends to hardware & software serial.
 Receives from software serial, sends to hardware serial.
 The circuit: 
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)
 created 16 August 2014
 modified 16 August 2014
 by William Chang Wei Tan
 based on SoftwareSerial example
#include <SoftwareSerial.h>

SoftwareSerial chat(10, 11); // RX, TX

int text;

void setup() { // open hardware serial, TX = 1, RX = 0 Serial.begin(9600); Serial.println("Starting Chat Program..."); // set the data rate for the SoftwareSerial port chat.begin(9600); delay(1000); // delay 1s to stabilize serial ports chat.println("Hello World"); }

void loop() { if (chat.available()) Serial.write(; if (Serial.available()) { Serial.print("Me:\t"); while (Serial.available()) { text =; chat.write(text); Serial.write(text); } chat.println(); Serial.println(); } }

Step 3: Run the Program

Now you can download the sketch to your Arduino and compile it. Once it's complete, open the serial monitor and start chatting with the other Arduino!

You've just created your very first chat program!

For more awesome stuffs, please visit my blog here



    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest
    • Arduino Contest 2019

      Arduino Contest 2019

    9 Discussions


    2 years ago

    Arduino soft help


    4 years ago on Introduction

    Would this work one-way with a laser at one end and an LDR at the other? I think this would be a brilliant way to demonstrate the capabilities of fibre (fiber) optics at a school science fair.

    2 replies

    Reply 3 years ago

    let me know if you ever did it and succeeded, Im doing a similar project for two way laser communication right now. :)


    Yes, that would work, definitely! If you are interested, could you email me at and I could help in the science fair. :)


    4 years ago on Introduction

    How can I code my Bluetooth shield to become a slave? tia :)


    4 years ago on Introduction

    Great! ^^

    You could do this to work with an ethernet module and a 16x2 LCD for instance to add "distance" between the chatters! ;D



    4 years ago

    William, you should also connect the GND pins of the Arduinos together to provide a reference point. If you attempted to use two separate computers to communicate with your Arduinos they will not work properly if at all. Your solution works because the Gnd pins are connected by the USB ports being both plugged into the same PC.

    1 reply
    William TanRedfinnsdad

    Reply 4 years ago

    Hey, thanks for the feedback. Yes I know that. Perhaps i should just add this point in. This is actually just to get familiarize with arduino. Was planning to make some other projects with two PC next time. Stay tune. :)