Beginner here, so this problem came up:

I got a 250vac 30A relay board which seems to require 5v to be driven.
It has 4 input pins: GND, IN-, IN+, VCC
What are the IN- and IN +?

My rpi output pin does not seem to be able to triger the relay when connected in the IN+ (although the board's led does turn on and off)
Here is a pic of the 4 pins: enter image description here Here is the ebay link: Ebay Item Link
The manufacturer page: chinalctech Link

Please note that my relay (pic #1) has 4 connection pins while the other two (pic #2 and #3) have 3 pins.

Thanks for the plenty of answers, I went through all of them, then went back and tested the things you guys suggested.
The GND and IN- pins are indeed connected through the jumper present in just behind them. I think it's in place in case you want to power the 5v input from another source on VCC and GND, then fire the relay with the IN+ and IN- connected to the GPIO and GND respectively.

That said, it seems like although i am powering the board with 5v on its VCC and GND, the switch wont fire unless it has 5v on IN+. I tried connecting the board to a usb 5v source like this (jumper shorting GND:IN-):

5v+ : VCC  

Then got a wire of the same 5v+ and touched the IN+ pin. The switch fired whenever the pin touched 5v.

Update 2:
I tried to replicate the same connection on the RPi 5v rail, (5v:VCC, GND:GND, test 5v: IN+) the relay does not fire. (jumper shorting GND:IN-)

I guess i reached the bounds of my E.E. knowledge, please advise, what am I missing?
Is it an Amperage issue?

  • \$\begingroup\$ what are you connecting to the GND+VCC pins? \$\endgroup\$
    – dandavis
    Commented May 15, 2017 at 14:23
  • \$\begingroup\$ you should ask on the manufacturer's website on how to use it. My best guess is, you supply VCC with 5V and drive IN+ and IN- with some voltage or current. \$\endgroup\$ Commented May 15, 2017 at 14:32
  • 1
    \$\begingroup\$ Check with a meter but I think that jumper on the board connects IN- to GND. So all you need to do is supply the correct voltage/current on the IN+ pin. (plus power and ground). If you can read the part number off the opto-isolator (the 4 pin part just above IN+ and VCC) then that should give you the requirements. Also check the power requirements for the relay by finding that data sheet and make sure that your +5V source can supply sufficient current. \$\endgroup\$
    – Andrew
    Commented May 15, 2017 at 14:36

3 Answers 3


Here is a likely schematics of your relay module:

optical isolation relay

Relay to Raspberry connection:

VCC to +5V
IN- to GND

GPIO is configured as push/pull output, no pull-up, no pull-down. Relay is turned on by writing 1 to the port.

Alternate connection if the first one can't activate relay:

VCC to +5V
IN+ to +5V

GPIO is configured as open-drain output, no pull-up, no pull-down. Relay is turned on by writing 0 to the port.

As voltage between IN+ and IN- is more then 2V, GPIO is never forced above 3.3V, so it should be pretty safe.

  • \$\begingroup\$ there's an LED on the board, as mentinoed by OP... \$\endgroup\$
    – dandavis
    Commented May 15, 2017 at 14:59
  • \$\begingroup\$ Unlikely schematic. Probably the LED is in parallel with the coil (with a series resistor, of course). Otherwise the 3V Rpi output would not work. Connecting GND to MCU GND negates much of the value of the opto. It's best to keep the relay supply separate from the MCU supply. What software did you use for that schematic? It's nice. \$\endgroup\$ Commented May 15, 2017 at 15:09
  • \$\begingroup\$ You are right, DS1 is probably LED. So if the suggested connection is not working, this one should: VCC to +5V, IN+ to +5V, IN- to GPIO, GND to GND. In that case, relay is turned on by writing 0 to the pin. \$\endgroup\$ Commented May 15, 2017 at 15:10
  • \$\begingroup\$ Rpi is 3V so it may or may not be marginal with the setup there. Might have to reduce the series resistor to the opto. Without a schematic or specs we are guessing about the cheap Chinese board. \$\endgroup\$ Commented May 15, 2017 at 15:11
  • 1
    \$\begingroup\$ @DamirŠkrjanec VCC to +5V and GND to GND, OK. But, Wont IN+ to +5V and IN- to GPIO be like shorting 5v ->GPIO? wont that damage the Pi taking into account that RPi's GPIOS work on 3.3v? (it's the only proposed connection method i have not tried yet) \$\endgroup\$
    – krasatos
    Commented May 16, 2017 at 12:03

Your module has an optocoupler between the inputs and the relay. This type of device has a LED in one side and a phototransistor in the other side, which is driven by the light generated when you make some current flow through the LED. Therefore, I guess that the inputs IN+ and IN- should be used as in the image below:

Your circuit schematic should look like this

This devices lacks information about how much current should flow in the LED for a proper switching of the output. This would be necessary to calculate the resistance's value. If possible, try to specifies the part number name of the optocoupler, then would be possible to take a look in the datasheet. But 10mA it is usually a good value for current in the input, so it would gives you a resistance around 500 Ohm, if you have 5V at your I/O. So, you can choose 470 Ohms or 560 Ohms, which are the most common around 500.

  • \$\begingroup\$ AFAIK these modules have a transistor that drive the optos (Q1 in the images), so the user does not have to drive the LED directly. \$\endgroup\$
    – Wesley Lee
    Commented May 15, 2017 at 14:35
  • 2
    \$\begingroup\$ It's hard to be sure but it looks like the input lines go direct to the opto isolator. I'd guess Q1 is controlling the relay, it's unlikely it would be driven directly from the opto output. \$\endgroup\$
    – Andrew
    Commented May 15, 2017 at 14:39
  • \$\begingroup\$ You want ~10mA after allowing for the LED voltage drop. 500 Ohms at 5V is assuming no voltage drop over the LED in the optocoupler. \$\endgroup\$
    – Andrew
    Commented May 15, 2017 at 14:41
  • \$\begingroup\$ @Andrew you are right, I forgot the voltage drop in the diode. But anyway, you will have something like 8mA~9mA with 500Ohm. \$\endgroup\$ Commented May 15, 2017 at 14:50
  • \$\begingroup\$ modules should not require any math to use; if the board tell you 5v, it should self-limit \$\endgroup\$
    – dandavis
    Commented May 15, 2017 at 14:51

So i found a work-around and would like to share it in order to get your comments on its safety.

I realised that the relay (lets call this relay Relay1) wouldn't fire with the 3.3v from the GPIO but only by with 5v (~1a) on the IN+ pin.

I had a relay board laying around from another project that would work on 3.3, had it tested before (lets call it Relay2). I could not use *Relay2*for the current project as its rated for 10a max and my water boiler is ~20a.

So i made a second circuit, with an extra 5v source, which i connected to the Relay1's VCC and GND pins.
Then took a wire from the source's 5v+, ran it through Relay2's COM port,
and another wire from Relay2's NO to Relay1's IN+ pin.

This way when the RPi operates Relay2, it would close the second cirquit and send 5v to Relay1's IN+ pin and operating it (closing the 220v circuit) succesfully.

Now, i know this is not the optimal way to solve it and i used an extra relay board and an extra power suply but it does work.
My question is: is it safe to use? Is there any thing i have overlooked that might present a hazzard?

  • \$\begingroup\$ To avoid the complication, you could have used a "raspberry pi single relay board". Or perhaps reduced the value of the resistor to the optocoupler's LED, but that could be fiddly. \$\endgroup\$ Commented Sep 10, 2021 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.