The microcontrollers’ capabilities can be extended to communicate with other devices such as sensors, motors, switches, memories, etc., with proprietary circuits, but the circuit complexity and power consumption will be increased.
In order to overcome this problem, the protocol concept comes into the picture for reducing the circuit complexity. There are various types of serial communications that exist such as RS-232, I2C, SPI, RS-485 protocol, and so on. Among these, the RS-485 serial protocol is mostly used for high-speed and long- distance data transmission.
RS-485 Protocol Wiring
The serial communication provides a signal path for wired or wireless transmission of data. parallel communication is still used in some applications but, nowadays, most commonly, serial communication is used for high-speed and long-distance data transmission for example SCADA data acquisition system.
The Rs-485 is one of the serial communication protocol that is used to send and receive data bit-by-bit sequentially through a serial cable. It consists offour wires: Tx+,Tx_, Rx+ and Rx- as a twisted pair cable. The RS-485 protocol allows multiple slave devices (EEPROM, ADC) to communicate at a time with a master device (microcontroller or any other controller).
The RS-485 device consist of 32 drivers that allow 32 devices to communicate at a time. It is used to communicate high-speed data rates (1Mbps) and long-distance (1KM). The operating voltage of the RS -485 device is -7 to 12v. The RS-485 protocol configured in two ways: “two-wire” or “four wire”.
Two-Wired Configuration: In two-wired configurations, the transmitter and receiver of each device are connected to a twisted-pair cable. In two-wired configurations, all slave devices communicate with each other through the address. It allows the half-duplex operation. The advantage of two wire configuration is that the cable cost is reduced as it consists of two wires and ground.
Four-Wired Configuration: The four-wired configuration is the master and slave communication. This network has one master (microcontroller) with the transmitter connected to the each receiver of the slave devices (EEPROM, ADC, etc.). On one twisted-pair cable all slave transmitters are connected to the receiver of the master device; on the second twisted-pair cable each device communicate independently by the address of it.
In this configuration, only one device can drive the line at a time; therefore, the driver must be put into the high-impedance mode (tri-state). The four wire configurations allow the full duplex operations, but slave nodes can not communicate with each other. Four wire communication have consist four wires and ground.
Intelligent communication of Ethernet to Serial of RS-485
The RS-485 is used as a multi-point communication wherein more devices can connect to a single cable. It is possible to use as an Ethernet communication for increasing the number of nodes; each node has a unique address that represents the node. Multiple RS-485 devices can be communicated at the same time across the network using ethernet as shown in the figure. A number of slave devices like sensors, surveillance camera, memory, etc., can be connected to the server with the help of the Ethernet cable.
The slave devices are monitored in that particular area and the data is send to the server computer by the serial port.The RS485 data sent and received on serial ports on the RS485 to Ethernet adapter is encapsulated in Ethernet packets in a manner that best fits the type of data being transported. The advantage of Ethernet communication is that it connects a number of node devices with different topologies, such as printers, modems, sensors, etc., based on the application.
RS-485 Interface with 8051 microcontroller
The RS-485 protocol is most commonly used in master to slave or slave to slave communication wherein the master can be any type controller like 8051 microcontroller, and the slave devices can be various peripherals like ADC, EEPROM, DAC and other similar devices in the embedded system. A number of slave devices are connected to the master device with the help of the RS-485 serial bus, wherein each slave consists of a unique address to communicate with it. The following steps are used to communicate the master device to the slave:
Step1: First, the master device issues a start condition to inform all the slave devices so that they listen on the serial data line.
Step2: The master device sends the address of the target slave device which is compared with all the slave devices addresses as connected to the Tx+ and RX- lines. If any of the address matches, that device is selected.
Step3: The slave device is matched with the received address from the master, and thereafter the communication is established between both the master and slave devices on the data bus.
Step4: Both the master and slave receive and transmit the data depending on whether the communication is read or write.Then, the master can transmit 8-bit of data to the receiver.
A slave-to-slave communication like a master to slave communication, but master slave communication has slave nodes that cannot communicate with each other. In the slave-to-slave communication, each node can communicate to all other salves devices through an address.
Master to Slave Write operation:
The master and slave devices are interchange the packets of information serially by the RS-485 communication. Each packet contains the synchronization of bytes: address bytes and data bytes. Each slave has a unique address to receive the packets of data. The communication always initiates from the master device.
Serial Device Server with RS-485
RS485 transceiver IP is used for applications in real-time industries wherein many devices communicate with each other using physical layer of RS485. This IP address consists of both transmitter and receiver parts. The Transmitter part converts parallel data into serial bits and transmits the same. The receiver part receives the serial data and converts them to parallel data. The block diagram of RS485 IP is shown in the Fig.
Difference Between RS-232, RS-485, RS-422 Communications:
Difference Between RS-485 and I2C Protocol :
Advantages of RS-485 Communication
- The RS-485 supports long distance up to 1200 meters. The speed of the communication is 1Mbp/s
- It is protected from noise due to differential voltages
- It is widely used in industrial automation and other wireless sensor networks
- It has higher speed beyond 115200 baud rate
- It allows 32 slave devices to communicate at a time on the same data line
- It is more suitable for system-to-system communication
This is about the RS-485 communication and its interfacing with 8051 microcontroller. If you want any information on routing, configuring and interfacing procedures of the RS485 to controllers, you can reach us by commenting below.