PC Serial RS232 Interface With Arduino

Description

It is serial RS232 Port interface example with Arduino. Serial Port is a channel for communication with microcontroller/arduino.

Circuit Diagram

Circuit diagram is simple and there is no need of extra component. All hardware interface between arduino microcontroller and PC is already provided in arduino board. Here is simple diagram in proteus to use with serial terminal in proteus.

Detail

Serial port is used to communicate with other devices like microcontrollers and PCs. It is most commonly used method for communication between arduino and computer. In serial RS232 interface all data bits are transmitted and received one bit at a time in a stream. So there is series of bits on single wire/pin. In arduino serial port is implemented over USB. There is USB to serial converter device required between arduino microcontroller and PC that is already implemented in arduino board. So, there is no need to add it additionally. This project is the base for so many other projects.

Software


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.write("Started...");

}

void loop() {
  // put your main code here, to run repeatedly:
  if(Serial.available())
  {
    Serial.write(Serial.read() + 2);
  }

}

In software setup() function we first initialize serial channel at 9600 bits/sec. Then we send “Started…” string towards PC. You can see how this “Started…” string is received in terminal in proteus shown in above diagram. You will also see next in video that how this string “Started…” is received in PC. In loop() function we check that if any received character is available? then read this character add 2 to it and send back towards PC.
Here is video for further clarification.

20170601_161518 from Rashid Mehmood on Vimeo.