Relays- How to control through RS232
RS232 is a very old output port available in computers. In earlier days all the computers were having RS232 port as a standard. But with the introduct...
RS232 is a very old output port available in computers. In earlier days all the computers were having RS232 port as a standard. But with the introduction of Universal Serial Bus (USB),
which is having more advanced functions & having less pins ( 4 instead of 9) than RS232, the age old Serial port (other popular name of RS232 port) is slowly replaced by USB. Though serial port has been completely removed in modern laptops, desktops still carry serial port as a standard fitment.
Serial port generally consists of 9 pins D type connector. The pin number along with their signal names are as under -
1. NC - Not connected.
2. RXD -Data Receive.
3. TXD - Data Transmit.
4. NC - Not connected.
5. GND - Ground.
6. NC - Not connected.
7. RTS - Request To Send.
8. CTS - Clear To Send.
9. NC - Not connected.
The relay board having 4, 6, 8 or more relays, consists of a microcontroller, DC power supply, serial port connector, relay connectors and of course relays. This board is connected to computer through RS232 cable. This cable connects to serial port of Relay board at one end & at other end to the serial port of computer. The wires of serial cable are cross connected. That is RXD of computer port is connected to TXD of Relay board port. Likewise TXD is connected to RXD. Ground signal is connected to Ground signal of computer. As most of the communication between computer & relay board is not that fast, RTS & CTS signals are not generally used.
Software is developed by using computer languages like Visual Basic (VB), Delphi or C++. Through this software we can send & receive data to relay board via RS232 port. The software provides front end side of controlling system. Some codes defining various commands are defined and inbuilt into software and into firmware of microcontroller so that both can understand same thing while communicating with each other. For example, when we want ot make Relay1 on the board to be operated, we communicate the command to the computer by clicking the appropriate box. This command is then transmitted to relay board through serial port. Microcontroller on relay board is always ready to listen to any communication from computer. As soon as it receives the command, it is deciphered as per the agreed codes and appropriate action is taken. In our example, if BF ( in HEX - Hex is number system) is the code for making Relay1 on, as soon as computer sends the code BF, the microcontroller after receiving the code BF, interprets the command & turns on Relay1. The successful turning on of the Relay1 is communicated back to computer as a feedback.
Though now the RS232 port is slowly replaced by USB port all over the world, there are still millions of computers out there which are having this serial port. They can use this kind of controls. That is why, this serial port control is still relevant and products are being developed based on this port