I am having problems turning on this relay:
https://omronfs.omron.com/en_US/ecb/products/pdf/en-g6qe.pdf
Using a transistor whose base is connected to a digital signal of an Arduino Nano.
The schematic I am using is attached. I have tried both, BC558 (PNP) and BC549 (NPN) transistors. Neither of these works. I would've figured the PNP should work because it is a high side switch but it almost seems that the Arduino Nano does not supply enough current to switch on the transistor. That is because when hooking the transistor's base straight to a power supply it does work but once again the Nano just can't seem to handle it. I am pretty novice at this so I am looking for some help. What am I missing here?
Thanks in advance
-
2\$\begingroup\$ you need a diode in parallel to relay coil. \$\endgroup\$– Fernando BaltazarMar 22, 2019 at 6:39
-
\$\begingroup\$ What is the I/O pin voltages for your MCU? \$\endgroup\$– jonkMar 22, 2019 at 6:47
-
\$\begingroup\$ about 4.8 to 5v but it fluctuates a little. Could a flyback diode be the reason? I didn't think that would change the transistor's on capability? \$\endgroup\$– thisissparzoMar 22, 2019 at 6:53
-
2\$\begingroup\$ " I didn't think that would change the transistor's on capability" it could indeed kill your BJT straightaway (or permanently alter its characteristics at each switch-off, when the coil overvoltage happens). \$\endgroup\$– LorenzoDonati4Ukraine-OnStrikeMar 22, 2019 at 7:06
-
1\$\begingroup\$ Replace the relay with a 1k resistor and small red or green LED and test it. If the circuit you've draw works with 5 V on the base then the transistor is short-circuited between base and collector or else it isn't a PNP. \$\endgroup\$– TransistorMar 22, 2019 at 7:27
1 Answer
simulate this circuit – Schematic created using CircuitLab
Do something like the above. You have the following problems:
- You need a better transistor (and you have damaged the one you have anyway)
- Even with a better transistor you need more base current to drive almost 300mA (but too much, as in grounded the base without a resistor, will damage the transistor)
- You need a flyback diode, or the transistor can be damaged by even one operation
Potential problems.
- Make sure your supply can handle the required current. Often it's better to use a higher voltage supply for the relay, such as 12V or 24V, which means less relay current (coil power will stay about the same) and this also helps avoid problems with the relay disrupting the MCU. That usually means using an NPN transistor since the circuit you are using won't work with a common-ground higher voltage supply (it would always be on).
- You can 'flip' the circuit so HIGH = ON if you want, just use a 2N4401 and make sure the diode polarity is reverse biased. Make sure you get the diode polarity correct from the beginning in either case or you'll need a new transistor.
- The base current is close to the maximum the MCU used in the Nano can supply. It would be nicer to use a MOSFET, however there are few appropriate MOSFETs available in through-hole packages so I have not suggested that. There are many, many available in SOT-23 and other SMT packages with stellar specs and those would be far preferable. AO3401 is one that works very well from 5V (or 3.3V). The circuit is similar to that with a PNP transistor however you may want to put 100K from gate to source in case the output is floated.
For what it's worth, just the other day, I lashed up a circuit with a relatively lower power relay (9V 360mW driven by an 8050 NPN transistor) driven by a Nano to run a test on an embedded system by interrupting and re-applying the power at random intervals.
-
\$\begingroup\$ I ordered all of these components you suggested except for the MOSFETS. Do you think it will be more possible to work if I use the 24v variant of the relay which only draws around 50mA (I tried running my 5v relay at a higher voltage which didn't work but obviously, it was not meant for this). \$\endgroup\$ Mar 22, 2019 at 22:44