Relays - How to control through USB

Oct 24
08:02

2011

Jayprakash Shet

Jayprakash Shet

  • Share this article on Facebook
  • Share this article on Twitter
  • Share this article on Linkedin

Universal Serial Bus (USB) has become the latest defecto standard for latest Laptops & Desktop computers. Though some desktop still carry legendar...

mediaimage
Universal Serial Bus (USB) has become the latest defecto standard for latest Laptops & Desktop computers. Though some desktop still carry legendary RS232 ports,Relays - How to control through USB Articles serial port is slowly losing ground. USB is having more advantages compared to traditional RS232 port at lesser pin count - 9 to 4. At 4 pins not only the size of USB connector becomes slick but is also able to provide current to the connected device if need arises. Also it is much speedier than RS232. This is the reason why all the instruments that can be connected to computer are having USB port as a standard fitment.
There are mainly 6 types of USB connectors Type A, Mini-A, Micro-A, Type B, Mini-B, Micro-B. While Type-A and Type-B has 4 pins, other connectors have 5 pins each.
The 4 pins have connections as under -
1. Pin 1 -Vcc - +5V
2. Pin 2 - D- - Data-
3. Pin 3 - D+ - Data+
4. Pin 4 - Gnd- Ground

The 5 pins have connections as under -
1. Pin 1 -Vcc - +5V
2. Pin 2 - D- - Data-
3. Pin 3 - D+ - Data+
4. Pin 4 - ID - Decides if it is plug A or Plug B
4. Pin 4 - Gnd- Ground
As this USB port from computer also supplies power, it has become very easy for the devices not only to connect but also to draw power from it.
The relay board having 4, 6, 8 or more relays, consists of a microcontroller, DC power supply, USB port connector, relay connectors and of course relays. This board is connected to computer through USB cable. This cable connects to USB port of Relay board at one end & at other end to the USB port of computer.

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 USB 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 to 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 USB 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.   


Article "tagged" as:

Categories: