Can't get relay module to work properly

I’m trying to wire my photon to the relay here: http://www.amazon.com/SunFounder-Channel-Shield-Arduino-Raspberry/dp/B00E0NTPP4/ref=sr_1_1?ie=UTF8&qid=1445489474&sr=8-1&keywords=sunfounder+relay

-I wired the VIN to jv-vcc (took the jumper out first)
-Wired 3V3 to VCC
-Wired GND to GND
-Wired D0 to IN1

When I do digitalWrite(HIGH), the led for IN1 turns off. When I do digialWrite(LOW), the led for IN1 turns on. Since this module is inverse logic I’m assuming that’s how it’s supposed to be.

The problem is the relay isn’t closing/opening at all. I ran power to the COM line and hooked up a light to the NO(Normally Open) and the light just stays on. It never turns off.

My question is did I wire something here or is this just a bad relay module?

Try leaving the Jumper on JD-VCC + VCC and connect:

VIN --> VCC
GND --> GND
D0 --> IN1

1 Like

This is a 5V relay shield so you should wire Vin (on the Photon) to Vcc rather 3V3 to Vcc.
But given the possible draw of 2x 20mA I’d even power both - the Photon and the relay - from an external 5V supply, instead of powering the relay off the Photon.

1 Like

ScruffR is correct. I used the same relay module and had the same problem as the OP. Wiring both to external 5VDC solved it.

2 Likes

I tried that method and it doesn’t seem to work at all.

So to clarify, I need to leave the jumper off. Power the Jv-vcc with an external power source, wire the VIN -> VCC. GND -> GND and let D0 hook up to IN1 right?

So you left the jumper off then? Can you walk me through how you wired yours?

Check out this discussion :wink:

Hooking up the spark to arduino relay shield

See that’s the discussion I originally read and he doesn’t use an external power source. He just wires VIN to Jd-vcc, 3v3 to vcc and so on just like how I had it. I get the LED light on but no opening/closing. Think I might have a defective relay or something.

To check if your relay is actually working you can just wire Vin <-> Vcc and GND <-> GND and Jumper Vcc-JD_Vcc (this jumper just bridges the Vcc through to the relay coil - with it open you can seperate electronics and coil supply) - no other pins on the Photon.

And then just use a jumper wire to bridge IN1 or IN2 through to GND.
You should see the LEDs turn on and hear the click of the relay. If you don’t hear the click, just give the thing some whacking (form different directions) to maybe get stuck contacts lose, and try again.

I wired a 5VDC power supply to both the VIN on my core and to the VCC input on the relay module. GND to GND. D2 of the core to one IN on the relay. I left the jumper installed to connect the two sources on the relay.

Setting the D2 output low turns the relay on (active low).

I hope this helps.

So I tried wiring it up that way and couldn’t get it to work. but I did give it a little whack and it started working the original way for me. Really strange. Do you think it’s better to use something like a Mosfet in the future?

It’s not too unusual that relays get stuck, when they weren’t used for a while or when you keep switching too high loads (“spark/arc welding”).
So normally you should be good but might have to whack them from time to time :wink:

But if you can use a MOSFET or SSR that’s always a nice way out of this.

I too experienced the “little whack” problem when I first used the relay module. At that time I was using the 3.3VDC output of the core to power the input to the relay optoisolator. This was a mistake because the current limiting resistor on the input keeps the input from coming fully on. Sometimes a whack would make it transition. When I changed to using 5VDC on the input as well as the coil things became very reliable.

1 Like

I use the exact same relay with my Photon. Powered it from the 5V shield shield and have no issues. Important to note that trigger logic is reversed i.e pull low to trigger.