Introduction

his RS232 Shield For Arduino is designed for the Arduino controller,and it can easily convert UART to RS232 interface.

The RS232 shield integrates DB9 connectors (female) that provide connection to various devices with RS232 interface. Also the RS232 shield headers will facilitate your connections and commissioning. It provides the welding areas to make full use of extra space on it, which is highly convenient for prototyping. It provides a run / program mode switch. When switched OFF, you'll be able to programme the Arduino controller; When switched ON, you can use the shield normally. Gold immersion PCB. Long pins on the back that are compatible with most Arduino controllers such as arduino Uno, arduino Mega, Leonardo.

Specification

Application

Board Overview

Board Overview

DB9 Female Pin Definition
P2 TXD
P3 RXD
P5 GND
Run/Program Mode Switch
OFF Download programs for Arduino
ON Convert Arduino Microcontroller's UART to RS232 Interface

Tutorial

Plug the RS232 shield onto a Arduino microcontroller, connect the DB9 pin male of USB-RS232 converter to RS232 shield's DB9 pin female. Then download the sample code.

Connection Diagram

Connection Diagram.png

Sample Code

# This sample codes is for testing the RS232 shiled.
# Editor : YouYou
# Date   : 2013.9.25
# Ver    : 0.1
# Product: RS232 shield
# SKU    : DFR0259
*/
int led = 13;    //define the LED pin 
void setup()
{
  Serial.begin(9600);    //init serial
  pinMode(led,OUTPUT);
}
void loop()
{
  int temp;    //serial data temporary cache 
  if(Serial.available())    //if serial receives data
  {
    temp=Serial.read();    //store the received data temporarily
     if(temp=='V'){
      digitalWrite(led,1-digitalRead(led));    //change the LED statu if receiving the char "V".
    Serial.println("OK");    //reply OK to show that the char "V" has been received and the LED statu also has been changed 
     }
  }
}

Expected Results

Result

Open the Serial debugger, find the COM related with USB-RS232, send a char "V", then the LED statu will be changed and it will reply "OK".

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum

More Documents

DFshopping_car1.png Get RS232 Shield for Arduino from DFRobot Store or DFRobot Distributor.

Turn to the Top