599 Menlo Drive, Suite 100
Rocklin, California 95765, USA
Office: (916) 624-8333
Fax: (916) 624-8003
General: info@parallax.com
Technical: support@parallax.com
Web Site: www.parallax.com
EFX Products: www.parallaxefx.com
RC-4 Relay Board (#31204)
Solid-State Relay Controller
General Description
Whether you build props or design small-scale industrial controls, there will likely come a time when you
need to control high voltage AC devices from a digital controller (like the Prop-1). The RC-4 is designed
just for this purpose, giving the engineer the ability to control up to four AC loads (per board). Outputs
may be controlled directly (with a mat switch, for example) or remotely through a simple serial interface
that allows the host microcontroller to control up to four RC-4 relay boards.
Applications
Props and holiday displays
Small-scale industrial control
Features
Controls up to four Crydom D2W series solid-state relays
LED on each channel indicates relay status
Serial control for connection to host microcontroller
User-configured baud rate (2400 or 38.4k) for serial control
User-configured address allows up to four RC-4 boards on one serial connection
Direct control with simple N.O. switch input on any channel
Current consumption: 13 mA @ 5 vdc (no relays active)
Compact size: 2.5” x 3”
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
1
Mounting the RC-4
NOTE: The RC-4 is designed to switch high-voltage AC circuits which can be very dangerous, even lethal, if mishandled. The RC-4 should be mounted before installing relays and
connecting control and switched AC wiring.
Mount the RC-4 on a non-conductive surface using ½” (12 mm) stand-offs and appropriate hardware.
Mounting the RC-4 above a conductive (metal) surface could lead to the possibility of a hazardous
condition.
Installing Relays
The RC-4 is designed for Crydom D2W series (and compatible) solid-state relays. If using product from
another relay manufacturer, it is the user’s responsibility to ensure the mechanical and electrical
specifications match the Crydom D2W series.
Nominal Input Impedance
Typical Input Current @ 5vdc
Must Turn On Voltage
Must Turn Off Voltage
1500 ohms
3.0 mA
3.0 vdc
1.0 vdc
Trim the relay legs to ¼” (6 mm) with diagonal cutters before installing – this ensures the best mechanical
performance of the RC-4 relay sockets. The relays may be installed in any order and in any position,
though when installing fewer than four relays starting at position K1 is recommended.
Connections – Switched AC Power
DANGER: The RC-4 is capable of switching voltages that can be lethal if mishandled. High
voltage AC wiring should be installed by a qualified electrician. Before making any high-voltage connections to the RC-4, ensure that all power has been removed.
2
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
Each relay output has two connections; this connection acts as a switch to control the hot side of the AC
circuit, as shown in the illustration below.
Connections – Serial Control
For most applications the RC-4 will be connected to a host microcontroller like the Prop-1 or a BASIC
®
®
Stamp 2 model in a Board of Education (BoE). To make the connection between the host controller
and the RC-4 use a 3-wire servo extender cable (e.g., Parallax #805-00001 or #805-00002). When
making the connection it is important to note the color-coded polarity of the extender cable: W = white,
R = red, B = black.
NOTE: When using the BoE as the host controller platform the servo voltage jumper must be
set to Vdd (+5 vdc) – if this jumper is set to Vin the RC-4 will be damaged.
Baud Rate Selection
The RC-4 supports two baud rates: 2400 baud for the Prop-1 (BS1 family) and 38.4k baud for the BS2family and other microcontrollers. Baud rate is set with a jumper on the Baud header.
Jumper
Out
In
Baud Rate
2400 (Prop-1, BS1, and compatible controllers)
38.4k (BS2 and compatible controllers)
Address Selection
Using a serial connection allows the host controller to connect to up to four RC-4 boards; to do this,
however, each must have a unique address. The RC-4 board address is set with jumpers on the A0 and
A1 headers.
A1
Out
Out
In
In
A0
Out
In
Out
In
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
Address
0 (%00)
1 (%01)
2 (%10)
3 (%11)
3
The illustration below shows the RC-4 configured for 2400 baud, set to address 2 (%10).
RC-4 Serial Protocol
The RC-4 serial connection conforms to the Parallax AppMod bi-directional communications protocol,
which operates at TTL (0 – 5v) using “open-true” baud mode to enable daisy-chaining devices. All
exchanges are initiated by the host controller. The format of host communications to the RC-4 is as
follows:
"!RC4", address, command { , data }
… where “!RC4” is the preamble that allows the RC-4 to exist on the same communications line as other
devices (e.g., PSC), address is the board address set with jumpers on A0 and A1, command is a single
character command designator, and data is any value that may be required by command. The following
section details valid commands (“V”, “S”, “R”, “X”, and “G”) for the RC-4.
“V” – Get RC-4 Version number
Syntax:
Replay:
“!RC4”, address, “V”
3-byte (ASCII) version string
Prop-1 Example:
SEROUT Sio, OT2400, ("!RC4", %00, "V")
SERIN Sio, OT2400, id0, id1, id2
DEBUG "RC-4 Version ", #@id0, #@id1, #@id2, CR
“S” – Setup All Relays
Syntax:
Reply:
“!RC4”, address, “S”, newStatus
– newStatus is new relay status: %0000..%1111
none
Prop-1 Example:
SEROUT Sio, OT2400, ("!RC4", %00, "S", %0001)
In this example, relay K1 will be activated, while K2, K3, and K4 will be deactivated.
4
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
“R” – Set/Reset Individual Relay
Syntax:
Reply:
“!RC4”, address, “R”, rlyNum, newState
– rlyNum is output: 1..4
– newState is new state of relay: 1 = On, 0 = Off
none
Prop-1 Example:
SEROUT Sio, OT2400, ("!RC4", %00, "R", 4, 1)
In this example, relay #4 (K4) is activated.
“X” – Reset All Relays
Syntax:
Reply:
“!RC4”, address, “X”
none
Prop-1 Example:
SEROUT Sio, OT2400, ("!RC4", %00, "X")
In this example, all relays (K1..K4) are deactivated.
“G” – Get Relay Status
Syntax:
Reply:
“!RC4”, address, “G”
One byte that holds current relay status
– Bit0 = K1, Bit1 = K2, Bit2 = K3, Bit3 = K4
– 1 indicates relay is On; 0 indicates relay is Off.
Prop-1 Example:
Main:
SEROUT Sio, OT2400, ("!RC4", %00, "G")
SERIN Sio, OT2400, rlyStatus
In this example, bits 0..3 of rlyStatus will hold the current state of the RC-4 relays.
Connections – Direct Control
In applications where intelligent control is not required the RC-4 relays may be activated through a direct
connection. Direct control is achieved by connecting power and control signal to headers X1..X4 (as
required). Note that power is carried to the X1..X4 connections on the R (red: +5 vdc) and B (black:
ground) connections. By connection a normally-open button or switch between the W (white: signal) and
R connections, the corresponding relay is brought under direct control (on when button pressed).
The diagram the follows shows the connection of the power supply and four normally-open push-buttons
to control relays K1..K4.
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
5
NOTE: When using direct control the power supplied to the R connections of the X1..X4
connectors must not exceed +5.25 vdc, otherwise damage to the RC-4 will occur. When
using an external power supply you must ensure that it is regulated to +5 vdc.
Most plug-in (“wall-wart”) power supplies are not regulated – if using this kind of supply,
proceed with caution to prevent damage to the RC-4.
Example Program
The following program demonstrates the RC-4 features under serial control using the Prop-1 (BS1)
controller. When using the Prop-1 the serial baud rate is set to 2400 (Baud jumper removed).
' =========================================================================
'
'
File....... RC4_Test.BS1
'
Purpose.... RC-4 Features Test
'
Author..... Team EFX -- Copyright (C) 2005 Parallax, Inc.
'
E-mail..... teamefx@parallax.com
'
Started....
'
Updated.... 01 SEP 2005
'
'
{$STAMP BS1}
'
{$PBASIC 1.0}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
6
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
'
' RC-4 demonstration program
' -----[ I/O Definitions ]------------------------------------------------SYMBOL
Sio
= 0
' -----[ Constants ]------------------------------------------------------SYMBOL
SYMBOL
Baud
Addr
= OT2400
= %11
SYMBOL
SYMBOL
IsOn
IsOff
= 1
= 0
' %00 - %11
' -----[ Variables ]------------------------------------------------------SYMBOL
SYMBOL
SYMBOL
id0
id1
id2
= B0
= B1
= B2
' version string
' -----[ Initialization ]-------------------------------------------------Reset:
DEBUG CLS
' -----[ Program Code ]---------------------------------------------------Main:
SEROUT Sio, Baud, ("!RC4", Addr, "V")
SERIN Sio, Baud, id0, id1, id2
DEBUG "RC-4 Version ", #@id0, #@id1, #@id2, CR
Test_Set:
FOR id0 = %0000 TO %1111
SEROUT Sio, Baud, ("!RC4", Addr, "S", id0)
GOSUB Show_Status
PAUSE 500
NEXT
Test_Reset:
SEROUT Sio, Baud, ("!RC4", Addr, "X")
GOSUB Show_Status
PAUSE 500
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005
' get version
' set outputs
' all off
7
Test_RelayCtrl:
FOR id0 = 1 TO 4
SEROUT Sio, Baud, ("!RC4", Addr, "R", id0, IsOn)
GOSUB Show_Status
PAUSE 500
NEXT
FOR id0 = 1 TO 4
SEROUT Sio, Baud, ("!RC4", Addr, "R", id0, IsOff)
GOSUB Show_Status
PAUSE 500
NEXT
Test_Ignore:
' send invalid relay number
SEROUT Sio, Baud, ("!RC4", Addr, "R", 5, IsOn)
GOSUB Show_Status
' no change
END
' -----[ Subroutines ]----------------------------------------------------Show_Status:
SEROUT Sio, Baud, ("!RC4", Addr, "G")
SERIN Sio, Baud, id1
DEBUG CR, "Status = ", #%id1
RETURN
' get status
For additional programming examples be sure to visit us on the web:
www.parallax.com
www.parallaxefx.com
forums.parallax.com
NOTE: The RC-4 makes the control of AC circuits very easy, still, caution must be used when
installing and using the RC-4 for its intended purpose. Parallax recommends that the RC-4
and related wiring be installed in a suitable enclosure that can be secured to prevent
accidental access to live AC circuits.
Consult a qualified electrician regarding the use of AC in your props and displays. For
questions on RC-4 application and control, feel free to consult Parallax Team EFX at:
teamefx@parallax.com.
8
© Parallax, Inc. • RC-4 Relay Board (#31204) • 10/2005