Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

4. Examples of Relays

The diagrams below are used to explain how relays work.

The relay itself is just a switch as seen in the diagram below:

relay power off                        relay power on

       |3                                    |3
       |                                     |
       |                                     |
       o                                     o
        \                                    |
       o \                                   o
       |                                     |
       |                                     |
       |                                     |
       |4                                    |4

The diagram below demonstrates the setup of a 4 pin relay.


      ____________________________
      |                          |
  1   |                          |  3
 -----|---------s     o----------|-------
      |  coil   s      \switch   |
  2   |         s       \        |  4
 -----|---------s     o- \-------|-------
      |                          |
      |                          |
      |                          |
      |__________________________|

In the diagram above, pin 3 and pin 4 are disconnected by default. When you send +12V between pin 1 and pin 2, it will turn on a switch, and pin 3 and 4 are now connected.

The following is a 5 pin relay:


           _______________________________
           |                             |
     1     |                             |       5
  ---------|---+            o------------|----------------
           |   |-----------/---- s       |
           |              /      s       |
     3     |             /       s       |
  ---------|-----------o/   coil s       |       4
           |                 o---s-------|----------------
           |                     |       |
           |                     |       |
     2     |                     |       |
 ----------|---------------------+       |
           |_____________________________|

In the above diagram pin 3 is connected to pin 5, by default. By sending +12V between pin 1 and pin 2, you will will turn on a switch. Pin 1 and pin 2 will disconnect, and pin 5 and pin 4 will connect.

 relay power off                 relay power on

     |5                                  |5
     |                                   |
     |                                   |
     o                                   o
      \                                  |
     o \                                 o  o
     |  o                                |  |
     |  |                                |  |
     |  |                                |  |
    4|  |3                              4|  |3

Some relays may have more that 5 pins. More pins just means there are more switches.

I wrote a simple program that can control 8 relays. The program is available at the following location and will need g++ in order to be able to use this program. http://edc.sourceforge.net/paralle.tar.gz

A complete circuit can control up to eight relays, that means that a complete circuit can control eight different devices. You will need a DB25 connector. Using a parallel switch cable, connect this relay board to your computer. I put the relay board in a box and use a parallel switch cable to connect it to my Linux box:

Panel: LED, Switch             Back:  DB25 connector

Below is an example of how a relay board would connect with your electrical device:

                       CONNECTED RELAY BOARD
                        

                         +-----+ power outlet
       1 _______3        |   __|________             ||   ||
       --|     |---------+  |  |       |             ||   ||
       2 |relay|4           | (o) (o)  |            _||___||__
       --|_____|----+       |------|---|            |        |
                    |              |                |        | 
                    | +------------+                |        | plug
            ground  | | hot                         |        |
                    | |                             |        |
                  __|_|__                           |        |
                  | | | |                           |________|
                  | | | | plug 
                  | | | |
                  |_|_|_| (i know it doesn't look like a plug, but it's a plug :-) )
                   || ||
                   || ||

To connect the system, just connect your home electrical device to the power outlet. That is it! You don't need to make any change on the electrical device. And you can connect any kind of device to that power outlet. Plug this power outlet into any wall outlet.

To see photos of what the finished product looks like, go to the following sites:

The following URL shows a complete electronic circuit (control 8 devices): http://edc.sourceforge.net/01.png