3
\$\begingroup\$

I purchased a 5V 8 channel realy to use with Arduino. When the output is low the relays are on. I need to turn the relays on when the output signal is high. Is there a way to make the board respond to a high input and to turn on the relay?

\$\endgroup\$
4
\$\begingroup\$

You could

  • invert the signal inside the software. This would be my choice.
  • put an inverter between the Arduino and the relay board. Take for instance a 74HC540(my original suggestion) or a much more common uln2803 as StevenH suggests. This would be my choice if you really can't change the software.
  • change the board itself. Bad choice IMO.
|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Just curious: For the software approach, "Invert the signal" meaning what exactly? The OP has an Arduino whose output is connected to the trigger input of the relay board. Current config: A Low from the Arduino turns the relay on. Desired config: OP wants a High from uC to turn it on. How could the code fix this? \$\endgroup\$ – boardbite Sep 10 '12 at 14:17
  • 2
    \$\begingroup\$ The OP wants to have the relay on in a certain situation. The current software outputs a 1 in that situation, while a 0 is required to turn the relay on. If the OP modifies the software to output the inverse he gets what he wants without any hardware modifications. \$\endgroup\$ – Wouter van Ooijen Sep 10 '12 at 15:00
4
\$\begingroup\$

Inverting the logic in your software, like Wouter says, is the zero cost solution. If you don't want that you can change the logic with little hardware.

For a single relay I would use an NPN transistor, but you have 8 relays and then the ULN2803 is a good solution.

enter image description here

It's an array of 8 transistors with base resistors integrated, so you don't need any other components, not even a power supply. Due to the higher saturation voltage of the Darlington transistors your LED current will be a bit lower, but the Darlington on the relay side will fix this. You may also decrease the value of R1, the LED's series resistor.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ That's an open-collector (pull-down-only) chip, so depending on the relay module the OP might need 8 pull-up resistors. \$\endgroup\$ – Wouter van Ooijen Sep 10 '12 at 11:25
  • \$\begingroup\$ @Wouter - did you look at the schematic of the module? The input is the cathode of a LED, in series with an optocoupler's LED, in series with a current-limiting transistor. Open collector is what you need here. (It's not clear to me why they need the optocoupler, though.) \$\endgroup\$ – stevenvh Sep 10 '12 at 11:32
  • \$\begingroup\$ !! I checked the datasheet (click on the text "download link"), but that does not show the circuit. But the page itself has a picture. Stupid circuit IMO, but indeed, it fits well with an 2803. Equally well with my suggestion, but a 2803 is a much more common chip. \$\endgroup\$ – Wouter van Ooijen Sep 10 '12 at 11:50
  • \$\begingroup\$ @Wouter - the outputs of the '540 can sink enough current to drive a relay, so that seems a good find, but the IC's ground current is 50 mA Absolute Maximum Ratings, so for all relays on you should stay well below 6 mA, and that may be too little for the (unidentified) optocoupler. In any case you'll have to increase the series resistors then. \$\endgroup\$ – stevenvh Sep 10 '12 at 14:13
0
\$\begingroup\$

Maybe I'm misreading the device data, but with this device you have both options available to you?

A logic 0 at the input connects relay pins 1 and 2 A logic 1 at the input connects relay pins 2 and 3

So if your load is currently over pins 1 and 2, swap it to 2 and 3

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ That would mean you activate the relay to switch it off. That's not a good idea for two reasons. One: You may consume power to do nothing. If you activate the relay to switch something on, then there's a load anyway, so the extra bit for activating the relay doesn't matter. Two: Safety. If there's a power outage on the driving side the relay would get switched on. A failure always should switch off a load. \$\endgroup\$ – stevenvh Sep 10 '12 at 14:08
  • \$\begingroup\$ @stevenvh - I absolutely agree, but the questioner wasn't asking that, was he? If you take that line, then the only safe answer to the OP is "No!" :) \$\endgroup\$ – Andrew Sep 10 '12 at 14:17
  • \$\begingroup\$ @stevenvh "A failure always should switch off a load." not if the load is my Wifi Access Pont! :) If the Arduino fails, I want it on, and in normal circumstances I want it on without the Arduino providing any power. But I know you are normally right. \$\endgroup\$ – FrancescoMM Sep 29 '17 at 14:30
0
\$\begingroup\$

Have a look at Arduino cc and look at digitalWrite()

You then set your pin to output low to turn your relay on don't forget to set your pin as an output.

Bob

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ This would be better if you included some more information, I assume the OP knows how to control outputs and just wonders how to invert them. \$\endgroup\$ – PeterJ Nov 25 '14 at 13:21
0
\$\begingroup\$

Inverting the logic on the code is not always a good solution because the relay can be turned on while the device is booting.

Another solution is using these connections:

JD-VCC ----> 5V
VCC    ----> Digital IO
IN     ----> GND
GND    ---—> GND

The digital input can be 3.3V

Unhappily it does not work when we have many relays on the same board sharing the same VCC and GND.

|improve this answer|||||
\$\endgroup\$
-2
\$\begingroup\$

my relay board has 3 terminals for each relay center is the power input and then there is the normally open and closed sides as a safety option i believe the relay is set to open so if some mishap happened the power is off so just switch the output on the relay to the other side and in my mind you fixed the issue

|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.