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?
This relay is designed to operate on 5V.
Most commonly this will come from the Uno's
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.
GND must also be connected to the
GND on the relay so the Digital outputs from the Uno will properly control the
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-LOWwhich means that as you initialize the output pins you should first set them
HIGHso setting the pinMode will not default to
LOWwhich would trigger the relay.
setup() section, using pins D5 and D6 as an example:
digitalWrite(5,HIGH); pinMode(5,OUTPUT); digitalWrite(6,HIGH); pinmode(6,OUTPUT);