Product | Arduino Shields | RS485 Module -Let Your Arduino Talk With Each Other
RS485 Module -Let Your Arduino Talk With Each Other
RS485 Module -Let Your Arduino Talk With Each Other
42231
 
US$9.98 Loading ...
 
Share/Save/Bookmark


RS485 Module -Let Your Arduino Talk With Each Other




In your project, is there any requirement to achieve communication or data transmission among your Arduino? Or do you want to make your Arduino talk with each other ?

The RS485 can help you to make it come true, RS485 serial bus interface standard transmiss signal through difference balance, have very strong resistance ability to common mode interference, allows one transmitter to drive multiple load equipments on a pair of twisted pair. In theory, the communication distance is 1200 meters, the rate speed can be as fast as 20 Mbps, and it can keep normal work in strong noise environment.

The biggest advantages of RS485 is the simple programming, because you only need to use Arduino own Serial library, that is enough.

RS485 in essence is a kind of serial protocol, so when RS485 electronic module is used to connect Arduino, it need to take Arduino serial interface. Arduino sensor module has COM interface which is specifical for electronic Module with serial interface , so we just only need to use a 4 pin cable to connect RS485 module with Arudino sensor module.

There are two green terminal "+" and "-" on the top of RS485 module which is used for 5V power supply, when multiple RS485 module cascade, you can join all of  green terminal "+" and "-" of RS485 module together, so that, on the whole, only need to give one of the grafted in 5 v power supply is ok.

Just said to cascade power supply, there are two green terminal "A" and "B" at the buttom of RS485 module which is used to realize cascade connection function. You can use any of the connecting cable to connect the first "A" and "B" interface of RS485 module respectively with the second "A" and "B" interface of RS485 module.

On the left of RS485 module, there are two black terminal "OUTPUT" and "INPUT" , it is the telephone wire connection interface. When RS485 module need cascade function, we only need to connect one OUTPUT interface of RS485 module with another OUTPUT interface of RS485 module, then it will be ok.





On RS485 serial interface module, another switch need to cause our attention is marked as "TR" switch, it is used to control terminal resistance, the purpose is to absorb reflected signal from RS485 network, in order to protect the normal transmission signal from interference. But this resistance can only be used on the final equipment module of RS485 bus, this is the reason why we call it as terminal resistance. In the connection, only need to set the "TR" switch of final equipment RS485 module to "ON" position. While other RS485 module are going to be set to the opposite position from "ON" .

Below TR switch, there are another two switch which are called "O +" and "O -". When several RS485 modules cascade with power supply, while there are modules cascade too many to cause undervoltage of the RS485 module. But when we use telephone lines to achieve RS485 module cascade, because the telephone line four line is "bound" together, so we can't like use on the top of the green terminal, as long as we connected or disconnected the corresponding port, then it will be alright.

"O +" and "O -" switch is designed to solve this problem. Only when the "O +" and "O -" switch is at the "ON" position, cascade power supply can take effect.

In other words, when the "O +" and "O -" switch is set to the opposite position from "ON" , cascade power supply can not take effect, then it need to insert external power supply at the position of  "+" and "-" of this RS485 module. Thus it can achieve several RS485 modules cascade with power supply.

In the lower right corner of RS485 there is a "L1" lamp. This small LED connect with an automatic transceiver detection circuit, when there is data transmission, it will light up,so it is used as indicator for data transmission.

 

Example :

For example, we can use with three Arduino and three RS485 module to make them connection experiment.

Using RS485 module to build a RS485 network, the network includes a Arduino (S) as the master host and two Arduino as the slave equipment (CA and CB). For Arduino in this network, when hardware connection, we need an Arduino sensor module and one COM interface cable, and connect RS485 module with Arduino sensor module through the COM cable.

In this experiments, we use telephone line for RS485 in cascade. In the diagram, from left to right is master host S、slave equipment CA and slave equipment CB.

We set a three node network as the example to explain how to use this RS485 module to build a RS485 network,  the network includes a Arduino (S) as the master host and two Arduino as the slave equipment (CA and CB).

 


 

First: Connect the Arduino with Arduino sensor module.

Second: Connect a Arduino (master host S) with RS485 module through the COM connecting cable, and in the RS485 module supply 5V power to green terminal "+" and "-" on the top of RS485 module.

Third: Connect the other two slave Arduino (CA and CB)  with RS485 module through the COM connecting cable, but does not need to supply power.

Fourth: Connect one RS485 module (that have already been connected with Arduino) with another RS485 module through the telephone line cable: connect OUTPUT of RS485 module of the master equipment S with INTPUT of RS485 module of the slave equipment CA, and then connect OUTPUT of RS485 module of the slave equipment CA with INTPUT of RS485 module of the slave equipment CB.

Fifth: Set all the "O + switch and O - switch" of RS485 module to "ON position", this is to supply power to all of RS485 module at the same time.

Sixth: Then dial the " TR switch"  (of RS485 module from the master equipment S and slave equipment CA) to the opposite position from "ON". And dial the " TR switch"  (of finial RS485 module from the slave equipment CB) to the position "ON". it is used to control terminal resistance, the purpose  is to absorb reflected signal from RS485 network, in order to protect the normal transmission signal from interference. But this resistance can only be used  on the final equipment module of RS485 bus, this is the reason why we call it as terminal resistance.
 

 


Test Code for Arduino Master Host S :

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

void loop()
{
  // send data
  Serial.print('A');
  Serial.print('B');
  delay(1000);
}


Although this adopt RS485 serial protocol, but when programming, we use common and ordinary serial operation statement


Test Code for Arduino Slave Equipment CA :

int EN = 2;

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

void loop()
{
  // send data
  Serial.print('A');
  Serial.print('B');
  delay(1000);
}
void setup()
{
  Serial.begin(19200);
}

void loop()
{
  // send data
  Serial.print('A');
  Serial.print('B');
  delay(1000);
}
int ledPin = 13;
int val;

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

void loop()
{
  // receive data
 val = Serial.read();
  if (-1 != val) {
    if ('A' == val) {
      digitalWrite(ledPin, HIGH);
      delay(500);
      digitalWrite(ledPin, LOW);
      delay(500);
    }
 }
}


Test Code for Arduino Slave Equipment CB :

int ledPin = 13;
int val;

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

void loop()
{
  // receive data
 val = Serial.read();
  if (-1 != val) {
    if ('B' == val) {
      digitalWrite(ledPin, HIGH);
      delay(500);
      digitalWrite(ledPin, LOW);
      delay(500);
    }
 }
}


Test Result :

Slave equipment CA and CB response letter A or B from master host S, then make the corresponding reaction: light one LED lamp.

After three Arduino power on, then you can see that the slave equipment CA and CB respectively make corresponding lighting action after receiving command from master host S.
 

Click to download the schematic diagram (pdf format)


Click to download the schematic diagram (sch format)

下载pdf文档资料.pdf

Write a review
*Review title
Please enter subject.
*Your review
Please enter review.
*Rating
(Click star icon to comment)
 
Display name
*Enter security code

CAPTCHA

Please enter code
Loading ...

Best Sellers