0
\$\begingroup\$

I searched far and wide but couldn't find an answer to my question. I've read the datasheet and I've look at schemes. I'm not very experienced with electronics.

This is the module I will be talking about: 2 Relay Module

Let's say I apply 5V to VCC from a given power supply, and then connect the ground. If I short IN1 and IN2 with VCC, nothing happens. Why is this so? Logic dictates it should, because when an Arduino controls the relay it powers the relay from 5V and then uses the same power supply to switch the relay with a pin connected to IN1 and IN2.

Why wouldn't it work with a simple 5V power supply? The power supply I used was my phone's adapter, it delivers exactly 5V.

Is there a way to short something to make it work?

Here's my scheme: Sheme

The scheme's idea is to switch between 5V from the wall and 5V from a battery. If power from the wall is available, then the battery is disconnected and recharged, if power is out then the battery kicks in.

I know MOSFETs will probably be better in this case but I've already soldered the thing.

Thanks!

\$\endgroup\$
  • \$\begingroup\$ I found that if you apply 5V to D1 and D2 instead, the relay switches on/off and works as I intend to use it. Isn't there a way to make it work using the pins that are already there? \$\endgroup\$ – Eduard G Jun 28 '17 at 14:20
  • 1
    \$\begingroup\$ See my answer about the IN pins needed negative logic, i.e. they need to be pulled low to turn on the relays. \$\endgroup\$ – J Rodgers Jun 28 '17 at 14:24
1
\$\begingroup\$

The module you are using needs the inputs to be pulled to 0V (ground) in order to switch the relay.

Check the manufacturers webpage for the module:

https://www.sainsmart.com/sainsmart-2-channel-5v-relay-module-for-arduino-raspberry-pi.html

This has a picture of the input circuitry on the module, which uses an optocoupler:

Input stage of module, optocoupler LED activated when IN2 pulled low

You need to redesign the rest of your circuit to take account of the fact that the inputs take negative logic:

INput: Low, Relay ON INput: Vcc or floating, Relay OFF

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Ohh. That helps! So the Arduino also connects them to ground when pulling a pin low? \$\endgroup\$ – Eduard G Jun 28 '17 at 14:26
  • \$\begingroup\$ Yes - with most microcontrollers and digital logic, you can consider a logic Low as a connection to Ground, and a logic High as a connection to the positive supply. \$\endgroup\$ – Peter Bennett Jun 28 '17 at 15:32
0
\$\begingroup\$

If I'm not mistaken, these modules are "active low", which means IN1 and IN2 are already pulled to VCC and you have to pull them low (read: connect to GND) to activate the relays.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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