Hobbybotics Optoisolated Relay Controller




Build It

Use It

Related Links



This project details an optoisolated relay board designed to switch on/off AC or DC devices.  There are 4 relays per board and each can switch 125VAC  @ 15A or 12-24VDC @ 15A.  Each relay is isolated from the associated digital logic  input pin.  Control can be accomplished by applying a high or low signal from a micro-controller output pin or, simply by applying a switchable 5V signal.

** WARNING ** AC current can be potentially lethal if proper precautions are not taken.  Ensure devices are disconnected from any AC source while handling or making connections to the relay controller.  Failure to do so can be lethal and/or cause damage to any associated equipment.  Hobbybotics takes no responsibility for any damages to equipment or injuries as a result of use or misuse of this controller.


  • High-speed 4 input/4 output optoisolated switch
  • 125VAC @ 15A, 12-24VDC @ 15A output control
  • Input voltage: 12VDC coil, 5VDC logic
  • LED on/off indicator for each relay
  • Boards can be stacked to expand outputs
  • Size: 2.5W” x 3.8L”


  • Schematic – PDF
  • PCB – PDF
  • Schematic – SCH
  • PCB – PCB
  • Mechanical Drawing – DXF
  • Bill of Materials – PDF

The schematic and PCB was developed with the freely available ExpressPCB software.

Build It

Reference the B.O.M above for a list of the parts necessary to complete the Hobbybotics Optoisolated Relay Controller.

Most of the components are surface mount devices (SMD) except for the connectors and relays.  As such, soldering may take a little more time and a little more experience.  I recommend starting with the low profile components first such as the 0805 resistors and LEDs.  I also recommend that consideration be given to the components that may be a little more difficult to solder because of location, such as the diodes and transistors.  The last device that should be installed on the board is the PS2501 optoisolator.

Reference the below schematic and layout file for component locations.

Use It

I recommend you look over your solder connections before you apply power to the board.  This will give you an opportunity to detect and correct any bad solder joints or solder bridges that could possibly let the smoke out.  Once that is complete there are a few tidbits we need to take care of before we can make stuff.  We’ll need to get some software (free of course) and configure some settings.  If you are using a different micro-controller then, skip this section.

1.  Go here and download the latest version of the Arduino Ide.
2.  Plug the FTDI Serial-to-USB adapter into an available USB port on your computer.  The drivers will automatically be downloaded and installed.
3.  Go to Device Manager on your computer and expand the Ports (COM & LPT) field.  Right-click on the USB serial port and select -> properties -> port-settings tab -> advanced.  Set the baud-rate to the appropriate setting for your controller.
4.  Extract the compressed file to a location on your computer and launch the “arduino.exe” file.
5.  In the Arduino Ide, select Tools -> Board -> Arduino Duemilanove or Nano w/ ATmega328.
6.  Ensure the correct serial port is selected in the Arduino Ide.

You are now ready to upload and test the below sketch on the Hobbyduino Mini.

  Relay Test
  Turns on a Relay for 5 seconds, then off for 3 seconds, repeatedly.
  This example code is in the public domain.

void setup() {
//Run once, when the sketch starts

void RelayON(int pin)
  pinMode(pin, OUTPUT);
  digitalWrite(pin, HIGH);    //Set Relay on

void RelayOFF(int pin)
  pinMode(pin, OUTPUT);
  digitalWrite(pin, LOW);     //Set Relay off

void loop() {
  RelayON(2);                 //Set the Relay on
  delay(5000);                //Wait for 5 seconds
  RelayOFF(2);                //Set the Relay off
  delay(3000);                //Wait for 3 seconds

1.  Launch the Arduino Ide and either copy and paste the above code or download the file from here.
2.  Connect digital pin 2 of the Hobbyduino to the IN1 port on the relay controller.
3.  Connect a 12V source to the VDD and GND pins on the controller board and apply power.
3.  Click the upload button and the sketch will be uploaded to the Hobbyduino.  You’ll need to do a little troubleshooting if the sketch fails to upload.  I recommend checking for the correct serial port and board within the Arduino Ide.
4.  If all is successful, relay 1 on the controller will turn on for 5 seconds and off for 3 seconds repeatedly.  The LED attached to this relay will also light.

This completes the basic functionality test for the Hobbybotics Optoisolated Relay Controller.  Checkout the video to see it in action.

Related Links

Hobbybotics Optoisolated Relay Controller Gallery


This example shows hardware and software used to implement the design.  It is recommended the viewer use sound judgment in determining and/or implementing this example for any particular application.  This example may include information from 3rd parties and/or information which may require further licensing or otherwise.  Additional hardware or software may be required.  Hobbybotics or any affiliates does not support or warrant this information for any purpose other than a design example and takes no responsibility for any mishaps (none being implied).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s