2

I'm trying to trigger 8 different 5V relays using arduino atmega 2560. the relays (70Ohm coil) are powered by an external 5V source, and im trying to trigger them through a driving stage which contains for each relay a npn transistor (2N3904) and 1kOhms resistor directly connected to digital pin of the arduino.

the relays in my application are supposed to be drived 2 by 2 not all of them at once.

My problem is that i dont succeed triggering the relay with digital pins of my arduino, once i connect it to the resistor the voltage of the digital pins falls down from 5V to 0.4V or less. The transistor needs only 7mA to be triggered, the output current of the atmega2560 pins is 20mA max.

i tried with an external 5V source, it triggers correctly showing 10mA maximum of current through the driving stage.

Thank you in advance for your help. Best regards. enter image description here

19
  • 1
    @timemage it is 1kohms i did the conception. – TESLA Nov 24 '20 at 13:32
  • 1
    A base resistor of 1kOhm at 5V will give you a max base current of 5V/1kOhm = 5mA, which is less than 7mA. That could prevent the transistor from working correctly (as you wrote, that it needs 7mA). have you tried with about 500Ohm? That would give you 10mA. Does the pin correctly output 5V, when nothing is connected to it? – chrisl Nov 24 '20 at 13:51
  • 1
    Please show a schematic. – ocrdu Nov 24 '20 at 13:56
  • 3
    Are you setting the pin to OUTPUT? You could be "activating" the pin with the internal pullup resistor otherwise, which would exhibit the symptoms you describe. – Majenko Nov 24 '20 at 14:11
  • 2
    Without showing us your schematic (edit the question), you problem is not really understandable. e.g. do you set the resistor direct in series to the relay or did you add it to the base of the NPN transistor. You said the relay sees only 0.4 volt if the resistor is in place. That sounds like you have the following connections: emiter of the transistor --> resistor --> relay. That does not work. – Peter Paul Kiefer Nov 24 '20 at 14:27
-1

If the coil is 70 ohms and it's driven by 5V, it should draw about 5/70 = 71 mA. That's pushing the 2n3904 a bit hard, and doesn't even account for inductive effects. (It's a small-signal transistor.) Do you have an NPN power transistor to try, just as a test? If its current gain (beta) is too low, use a Darlington configuration by combining it with your 2n3904. (2n3904 base from digital out resistor, emitter drives power NPN base directly, both collectors are connected together to the bottom of the coil, and the power NPN emitter is the effective emitter of the just-created "super transistor" with high beta and power handling.) Be sure to use an anti-kickback rectifier (1n4001)across the relay coil.

3
  • sorry i did a mistake, its actually a 5V relay, it means 71mA through the relay. taking in account the 2N3904 gain i would have arround 7mA through the transistor this is why im using a 1k resistor. – TESLA Nov 24 '20 at 14:17
  • Just to be sure: The relay coil must be between +5 and the collector, with the emitter grounded. – Boggyman Nov 24 '20 at 14:41
  • yes i just added a schematic please look at it. – TESLA Nov 24 '20 at 15:13
-1

Good Job, you are right on, the transistor is rated at 200 mA which is adequate for the job. The flyback diode will protect your system and the transistor. the drain source drop would be maybe 0.01V on a bad day depending on the RDSon. You will probably need a little lower value base resistor depending on the gain of your transistor. I would use something between 220 and 510 ohm. It should work fine. Using a darlington would hurt you instead of the ~.7 volts drop across the collector it would become about 1.4 volts, leaving the relay with 3.6V assuming you are actually getting 5V. My preference would be a small logic level avalanche rated MOSFET. Use a 50 Ohm resistor in the gate circuit and it will be just fine. Use something like a 10K pull down resistor between the gate and source, that will guarantee that it will be off during reset.

3
  • Why do you need any gate resistor at all with a MOSFET? They have capacitive inputs, and draw almost no current. – Duncan C Nov 25 '20 at 2:23
  • When the gate pulse starts, the capacitive input will appear as a short to the output pin (for a few nanoseconds). The gate resistor limits the current at that time. There is a lengthy discussion about this on the Arduino Forum which you might find interesting. – Nick Gammon Nov 25 '20 at 5:38
  • To prevent oscillation, it does not happen on all circuits but a good design practice. This happens because of the miller capacitance effect during the time the channel in enhancing. – Gil Nov 25 '20 at 22:09

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.