i want to operate a relay with an ARDUINO UNO, but i want to use a separate power supply for the relay. Ive seen relays with VCC and jVCC (dont know what that is), but mine only has this pins: GND, IN1, IN2, VCC.
how should i connect it to the Arduino and the external power supply?
-
2That doesn't look like a relay board set up for separate power supply. Those that do will have an opto-isolator per relay. – ratchet freak Aug 18 '17 at 20:54
-
jVCC (where avail) is used to drive the magnetic relay coils, VCC is used to drive the logic/LEDs. – dandavis Aug 19 '17 at 12:16
This relay is designed to operate on 5V.
Most commonly this will come from the Uno's 5v
pin.
If you want to externally power the relay itself then make sure to connect the +5
to the Vcc
on the relay board and the -
lead to the GND
on the relay board.
Uno's GND
must also be connected to the GND
on the relay so the Digital outputs from the Uno will properly control the IN1
and IN2
inputs to the relay board.
The Uno has multiple GND
connections so it makes the most sense to connect the -
to one of them then another to the relay.
Note that the Uno's 9V Vcc external power comes in through the barrel connector on the Uno itself. The Uno will pass power through its internal regulator to provide 5v
at the appropriate connection.
If you are switching external devices that run on 120V it would be on the screw-terminal side of the board only.
To prevent accidental activation of the relays, note that this particular board is
ACTIVE-LOW
which means that as you initialize the output pins you should first set themHIGH
so setting the pinMode will not default toLOW
which would trigger the relay.
In the setup()
section, using pins D5 and D6 as an example:
digitalWrite(5,HIGH); pinMode(5,OUTPUT);
digitalWrite(6,HIGH); pinmode(6,OUTPUT);
-
1The question is "but i want to use a separate power supply for the relay". – MatsK Aug 19 '17 at 22:33
The Arduino and the external PSU should have the GND or - connected with each other.
Then connect the external PSU + or Vcc to the relay boards Vcc.
-
1Regarding jVCC see arduino-info.wikispaces.com/RelayIsolation . It is used when you have optocouplers isolating the power supplying the relay coil from the Arduino's power (VCC). – MatsK Aug 18 '17 at 23:59
External psu to gnd and vcc, in1 and in2 to arduino pins which control each relay (on is LOW) and most importantly gnd also to arduino gnd.