I am trying to switch on a G5Q Relay on a Genuino MKR1000. I am able to do it using VCC (3.3v) but not with Digital I/O pin (Also 3.3v) this is because the current from digital pin is lower(7mA). I am new to electronics. How can I boost the current to the relay without damaging my board?
-
1Check sources like Aliexpress and buy a relay module. – Wouter van Ooijen Sep 17 '16 at 16:17
-
1This appears to be a duplicate of http://electronics.stackexchange.com/a/203906/9006 Also, web search engines provide a lot of results by searching for "controlling relay with arduino". There are also likely answers on http://arduino.stackexchange.com/ Please read the [help] to understand how to ask good questions. This question will likely get closed as a duplicate. – gbulmer Sep 17 '16 at 16:37
-
1Possible duplicate of How do I increase the drive current from the arduino digital pins? – Armandas Sep 17 '16 at 22:24
-
Possible duplicate of a hundred questions. ... – Passerby Sep 18 '16 at 06:18
1 Answers
Although this is mostly a duplicate of "How do I increase the drive current from the arduino digital pins?" as kindly commented already, there is another point to address in your question.
You said:
I am trying to switch on a G5Q Relay on a Genuino MKR1000. I am able to do it using VCC (3.3v)
The lowest coil voltage G5Q relay has a nominal 5V coil - not 3.3V. The fact that yours operates at 3.3V is not guaranteed and will be affected by things including temperature, internal wear etc. The G5Q datasheet I linked above shows that Omron guarantee the relay will operate at 75% of nominal coil voltage = 3.75V for a 5V coil. Therefore, as I said, your relay is not guaranteed to operate at 3.3V.
You may also find this previous question interesting, about operating relays at reduced voltages: "Is it OK to use a lower voltage to operate a relay coil than rated coil voltage?"
Therefore your situation seems to require:
- an suitable external driver (e.g. transistor) and freewheeling diode, to drive the relay coil (see the first linked question above) from the 3.3V digital output of your board; and
a suitable power supply voltage for your relay.
That means using a 5V supply for a 5V relay, if you expect reliable operation. From researching your MKR1000 board, I see that 5V is available when the board is powered via its USB or Vin connectors. This could be used to supply a 5V relay coil (assuming a suitable current rating of that power supply). Don't use the 3.3V supply which you mentioned, to directly power a 5V relay.
However when the board is powered from an attached LiPo battery, then only the 3.3V supply voltage is available. A boost regulator could be added to generate 5V from that 3.3V input, and the generated 5V could be used to power a 5V relay. I could not find documentation stating how much current your board can supply at 3.3V (to power a 5V boost regulator and relay) in that situation. The answer will be related to the 3.3V regulator IC (AP7215-33YG, according to the board schematic) and how much current the board already uses, from the 600mA maximum which that regulator can supply according to its datasheet.
So in summary: The way forward depends on how you intend to power your board. I just wanted to highlight that powering a 5V relay from 3.3V (even when you think it works, as you stated) can result in problems.
-
-
@Kashif - "IO pin supplies 7mA at 3.3v while the relay takes 30mA at 5v" - That difference in current required vs. available directly from the pin, is why you need to use an external driver (e.g. BJT, MOSFET etc.). (FYI the relay's rated current is 40mA @ 5V according to the datasheet I linked.) You should never try to power a relay directly from an I/O pin. How to handle the difference in voltage is what I tried to explain in my answer. Again, the voltage at the I/O pin is only part of the story (you don't power a relay from an I/O pin!); it is the power supply voltage which matters. – SamGibson Sep 18 '16 at 13:35
-
[continued] If you have a specific question about something which is not clear, please ask it. – SamGibson Sep 18 '16 at 13:38