Go Down

### Topic: can I safely ground 12v (vcc) to digitalWrite(pin, LOW); (Read 508 times)previous topic - next topic

#### jeanpaulsc

##### May 12, 2018, 11:28 pm
I would like to ground an NPN emitter to the pin adjacent to it's base. Is this a bad idea? The NPN's function is to open a 12v solenoid.

#### avr_fred

#1
##### May 13, 2018, 12:40 am
Bad idea? That impossible to say as this statement:
Quote
I would like to ground an NPN emitter to the pin adjacent to it's base.
makes no sense. While it is correct that that you ground the emitter in a typical npn switch circuit, what pin and base are you referring to?

Perhaps a photo to explain?

#### Wawa

#2
##### May 13, 2018, 01:23 am
I think OP is asking if you can use a digital output pin as ground pin for the emitter of an NPN transistor that drives a solenoid.
The answer to that is NO.
Because all the solenoid current will then flow through the Arduino pin, which has an absolute limit of 40mA.
Leo..

#### ReverseEMF

#3
##### May 13, 2018, 01:44 amLast Edit: May 13, 2018, 07:51 am by ReverseEMF

And if so, then the way to language this is: The Arduino Digital Output, tied to the Base of the NPN Transistor, through a series [current limiting] resistor, Grounds the 12V connected mystery thing, when D? is HIGH, and un-grounds it when D? is LOW.  D? can be any of the Arduino Digital Outputs.

A Bipolar Transistor is a Current Amplifier.  In other words, a small current flowing from the Base to the Emitter, controls a larger current flowing from the Collector to the Emitter.

You need the transistor because the Arduino Output mustn't go higher than 0.5V more than VCC.  If the Arduino has a VCC of 5.0V, then the output pins mustn't go higher than 5.5V.  If an output is connected to something that goes to 12V, then, when the output is HIGH, there is the danger of that 12V source pulling the output higher than 5.5V

Also, Transistor selection depends on what it is that you want to switch.  How much current will it draw?  Is it just going to 12V or is there more to the circuit?  We very much need more information to properly answer this question, so if you can provide a schematic or good photo or something that would allow us to know what it is you are trying to do, that would be a BIG help

UPDATE:  I missed that the "Mystery Device" is actually a solenoid, so I added a protection diode to the schematic diagram (above).

Also, if that solenoid draws more than 200mA Max, use a MOSFET.
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

#### RIN67630

#4
##### May 13, 2018, 05:03 am
I would like to ground an NPN emitter to the pin adjacent to it's base. Is this a bad idea? The NPN's function is to open a 12v solenoid.
Yes, that IS a bad idea.
If you ask, then you probably have got no experience with DC solenoids, which are is one of the weirdest thing in electronics.

If you don't know how to drive them, go for the safe way and use a relay shield.

#### Southpark

#5
##### May 13, 2018, 09:05 amLast Edit: May 13, 2018, 09:06 am by Southpark
I would like to ground an NPN emitter to the pin adjacent to it's base. Is this a bad idea? The NPN's function is to open a 12v solenoid.
Draw a circuit diagram for clarity. Draw the transistor, and add some text and arrow to point to the terminal that you want to 'ground'. The title of your post is unclear. In general, we want to avoid connecting 'Vcc' to 'ground'.

#### jeanpaulsc

#6
##### May 13, 2018, 11:54 pmLast Edit: May 14, 2018, 12:02 am by jeanpaulsc
This is what I had in mind:

(my image was here, but I cannot seem to attach to an edit. Image in 5 min)

It certainly can't draw power from the pin, though it draws very little, but my question was really can I safely ground to a pin set to LOW.

I don't see why not. If not, is there a danger grounding to a GND pin?

#### Wawa

#7
##### May 14, 2018, 12:03 am
Image doesn't work.

Setting a pin HIGH connects the pin internally to VCC (5volt) with a mosfet switch with an absolute max current rating of 40mA.

Setting a pin LOW connects the pin internally to GND with a mosfet switch with an absolute max current rating of 40mA.

So you can't 'drain' more than 40mA to ground through an output pin.
Leo..

#### jeanpaulsc

#8
##### May 14, 2018, 12:04 amLast Edit: May 14, 2018, 12:11 am by jeanpaulsc
This is the image (attached).
(Not intuitive. Do I really have to upload it to an arbitrary site?)

Regarding the current limits, does the GND pin have the same limit?

#### Wawa

#9
##### May 14, 2018, 12:06 amLast Edit: May 14, 2018, 12:11 am by Wawa
The full solenoid current would flow from collector to emitter through the pin to ground, likely blowing the pin.

The base of an NPN transistor NEEDS a current limiting resistor.
Base current for full saturation of the 'switch' should be 5-10% of the collector current, depending on the transistor.
If that's more than ~20mA, then you should switch to a darlington or mosfet.
Leo..

#### jeanpaulsc

#10
##### May 14, 2018, 12:15 am
The base of an NPN transistor NEEDS a current limiting resistor.
Base current for full saturation of the 'switch' should be 5-10% of the collector current, depending on the transistor.
If that's more than ~20mA, then you should switch to a darlington or mosfet.
Enlightening. Thank you.

#### Wawa

#11
##### May 14, 2018, 12:19 amLast Edit: May 14, 2018, 12:23 am by Wawa
A TIP120 is a good choice for a solenoid.
It still needs a base resistor, but base current for that darlington is 1:250 for saturation.
Note the higher BE voltage (~1.5volt) when you calculate the base resistor.
Don't forget the back-EMF diode across the solenoid.
Leo..

#### ReverseEMF

#12
##### May 21, 2018, 12:54 am
A TIP120 is a good choice for a solenoid.
It still needs a base resistor, but base current for that darlington is 1:250 for saturation.
Note the higher BE voltage (~1.5volt) when you calculate the base resistor.
Don't forget the back-EMF diode across the solenoid.
Leo..
The thing about a Darlington Transistor is the fairly high Emitter Collector saturation voltage.  A MOSFET is a much better choice.
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

#### Wawa

#13
##### May 21, 2018, 01:07 am
The thing about a Darlington Transistor is the fairly high Emitter Collector saturation voltage.  A MOSFET is a much better choice.
Not much difference if you power a solenoid with 11.25volt (darlington) or 11.95volt (fet).

Different story if you switch a LED strip.
Then a 1volt drop could have a light power reduction of 40%.
Leo..

#### ReverseEMF

#14
##### May 21, 2018, 02:34 am
Not much difference if you power a solenoid with 11.25volt (darlington) or 11.95volt (fet).

Different story if you switch a LED strip.
Then a 1volt drop could have a light power reduction of 40%.
Leo..
Try more like 10.8V, but I get your point -- it's probably a trivial difference [though, with the right MOSFET, that voltage could be closer to 12V -- not sure where you get 11.95 -- but even so, still, probably, trivial], BUT, there is another parameter to consider: Power Dissipation.  With a higher voltage drop across the switch, there will be greater Power Dissipation.  Whereas, with a MOSFET, the Power Dissipation can be nil in all but the most extreme cases.  There is no way to get the Emitter-Collector voltage down on a Darlington -- it will always be at least 1.2V, and probably more like 2V for higher currents.
"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

Go Up