Introduction
Thank you for buying our RS232 controlled Relay board.
The goal of Pencom Design is to provide top quality equipment at low cost. All of our
products are designed and tested in-house to meet our high quality standards.
Features
Low cost universal 1 or 2 channel serial relay board with heavy duty 10 Amp 240VAC/28VDC
SPDT power relays.
Easy hook up using standard modular telephone cable. A 9-pin serial to modular cable adapter
and cable is included to connect the PC with the device.
Almost any software language that is able to write to the PC serial port and concatenate the
string can communicate with this relay board – NO special drivers needed. Simple ASCII
commands to control the relays. 4800-38400 (9600 default) baud, 8 bits, no parity, 1 stop bit.
Each relay will latch ON or OFF depending on what command is sent and will maintain this
position until power is removed or changed again in software.
Two different Board design versions available, both can be mounting in the customers
enclosure, or a plastic enclosure ( P/N RLY-ENC-EXT) is available separately for the –EXT
version only.
• Circuit board with an external wall transformer. (-EXT)
• Circuit board with internal on-board mounted transformer. (-INT)
A windows based, relay testing software is available to verify operation, and program the
optional features on the boards of our 1 & 2 channel relay boards before writing your own
software program. See our website to download the software or order on disk.
Applications
• Industrial control applications • Process control systems
• Automatic test equipment (ATE) • Power switching applications
• Lighting control equipment
Specifications
Dimensions:
External transformer version: 3.04” Wide X 4.20” Length X 1.012” High
Internal transformer Version: 3.04” Wide X 4.20” Length X 1.500” High
Connections:
1 RJ-12 Modular phone jack for RS232 input to relay board from PC.
1 or 2 3 contact Terminal blocks for output connections for 14-22 AWG wire.
1 Power Jack for DC wall transformer (external transformer version)
1 120VAC or (230VAC) 3-pin Terminal Block (internal transformer version)
Power Requirements:
9 Volts DC @ 300 MA wall transformer (Model: S1 & S2, “-EXT” versions)
120 VAC 50/60 HZ internal transformer (Model: S1 & S2, “-INT” versions)
230 VAC 50/60 HZ internal transformer (Model: S1 & S2, “-INT-2” versions)
Private Static Sub ShowData(Data As String)
'Eliminate line feeds.
Do
i = InStr(Data, Chr$(10))
If i Then
Data = Left$(Data, i - 1) & Mid$(Data, i + 1)
End If
Loop While i
'Eliminate carriage returns.
Do
i = InStr(Data, Chr$(13))
If i Then
Data = Left$(Data, i - 1) & Mid$(Data, i + 1)
End If
Loop While i
'Display data in a text box
TxtData.Text = Data
End Sub
There are numerous software languages that can utilize the PC for serial communications.
Information is readily available on the internet and in books explaining how to output to the
serial ports, in other languages. We are only showing you one example using the popular
graphical language Visual Basic. It’s an easy language to learn and has many powerful
features.
Additional information is available online at www.pencomdesign.com/support
Pencom Design, Inc. 5 Pencom Design, Inc. 1
If the board command is
Send any number from 0 to 255 (it doesn’t matter it will be ignored). The relay board will
immediately respond with a decimal number from 0 to 3 representing which relays are
active in the same method as explained above.
If the board command is “M”
Send a number from 1 to 8 which represents the relay number available on the board, and it
will momentarily active (or deactivate) the individual relay specified. You may also send a
zero which will momentarily active (or deactivate) ALL relays on this board. The initial
state of the relay will determine whether it is turned ON or OFF.
If the board command is “T”:
Send a number from 1 to 8 which represents the relay number available on the board, it will
reverse the relay from it’s current position on the individual relay. Sending a zero which
will toggle ALL relays on this board.
The board command structure is explained in more detail in application note #156 available for
download from our website.
Visual Basic Example
This example transmits data out to the relay board using the MSComm function to turn ON
Relay #2.
MSComm1.Output = "A" & "H" & "2" & Chr$(13)
1. “A” = Board address
2. “H” = Board Command (relay = high)
3. “2” = Relay Number as a string (quotes required), if using it in an equation use str(2).
4. Chr$(13) = carriage return, this must be sent after each command string.
5. The ampersand “&” operator is used to force string concatenation of the expressions.
Setup the Mscomm properties as follows:
DTREnable = False InBufferSize = 1024 Rthreshold = 1
EOFEnable = False InputLength = 0 RTSEnable = False
NullDiscard = True InputMode = 1 Sthreshold = 1
HandShaking = 0 OutBufferSize = 512 Settings 9600,8,n,1
The following code receives the data from the relay board on the “R” (Read command).
Private Sub MSComm1_OnComm()
‘Receive data on the serial port
Select Case MSComm1.CommEvent
Case comEvReceive
Dim buffer As Variant
Dim Data As String
buffer = MSComm1.Input
ShowData (StrConv(buffer, vbUnicode))
End Select
End Sub
Copyright
2008, Pencom Design, Inc. 08012251 Rev D 1-14-08
Pencom Design, Inc. 6
Pencom Design, Inc. • PO Box 870 • Trumbauersville, PA 18970 • (215) 538-2932 • www.pencomdesign.com
Single/Dual Channel Serial Relay Board
Single Channel Versions:
Model: S1-RLY-EXT
Model: S1-RLY-INT
Model: S1-RLY-INT-2
Dual Channel Versions:
Model: S2-RLY-EXT (Shown)
Model: S2-RLY-INT
Model: S2-RLY-INT-2
Relay # Decimal Relays
2 1 Equivalent Active
0 0 0 Both Relays OFF
0 1 1 Relay #1 ON
1 0 2 Relay #2 ON
1 1 3 Both Relays ON
“W” command Example:
To turn ON relay 2 and leave relay 1 OFF
you would send decimal number 2.
To turn ON relay 1 and leave relay 2 OFF
you would send decimal number 1.
Table 1