Go Down

Topic: Digital Output pin set LOW vs. GND pin? (Read 14950 times) previous topic - next topic


Jan 13, 2011, 05:07 am Last Edit: Jan 13, 2011, 06:09 am by Joeinator Reason: 1
What is the difference between the GND pin on the Arduino Uno and a digital pin set as an output and LOW?
I'm trying to use an output pin to turn a darlington transistor on and off to send power to a motor. The transistor is NPN. (TIP122G). Basically, I need to ground the base of the transistor to allow the motor to turn on. If I connect it to a GND pin on the Arduino, the motor turns at the rate I want to. If I connect it to a digital pin and set it to LOW however, the motors barely get enough power to turn. What is a digital pin set to LOW doing that a GND pin isn't?  :-?

James C4S

Are you sure you've set the pinMode() for the I/O pin to OUTPUT?

You should probably measure (or calculate) the amount of current you expect to flow from the base through the pin.  In any event, you should still be using a series limiting resistor to make sure no more than 20 or 30mA flows through the I/O pin.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


Jan 13, 2011, 07:04 am Last Edit: Jan 13, 2011, 07:06 am by retrolefty Reason: 1
Normally one has to turn an output high if wired to a base (with series base resistor)of a NPN transistor, if emitter is grounded and collector to load and then to positive voltage, so called low side switching. Perhaps if you could post a drawing of your circuitry we might be able to figure it out.

A digital output low is a direct connection to ground as long as the current demand is lower then 40ma, above that damage to the pin will result. A arduino output pin can both sink (when low) and source (when high) current up to the max current rating stated above.



I've definitely set the pinMode to OUTPUT. The current seems to only flow through the transistor when I put the base to GND. Is this what should happen?


Is this what should happen?

That depends how everthing is wired up, including the load and external power supply. Without a drawing to see what and how you wired everything we can only speculate. A picture is indeed worth a thousand words in cases like this.



Jan 13, 2011, 08:29 am Last Edit: Jan 13, 2011, 08:34 am by Joeinator Reason: 1

Here is what I have wired together. I can't understand why connecting the base of the transistor to pin 2 and setting the output to LOW gives less power to the motors than putting the base to GND. Also, I don't understand why I'm using GND to 'turn on' the transistor. I thought it required power through the base to allow current to flow through the collector and emitter. This seems to be the only way I can get any response from the motor in my circuit...  :-[

(Maybe this will help? The transistor I am using is a TIP122G NPN transistor: http://pdf1.alldatasheet.net/datasheet-pdf/view/175434/ONSEMI/TIP122G.html)


Jan 13, 2011, 08:51 am Last Edit: Jan 13, 2011, 08:57 am by retrolefty Reason: 1
The problem is that your resistor is both the wrong value and wired in the wrong place. Remove that 100k ohm resistor and wire a 200 to 1,000 ohm resistor between the output pin 2 and the base terminal of your transistor. Lastly make sure you run a wire from the battery minus terminal to an arduino ground terminal. All should be fine with those changes made.

However there is a chance that you might have damaged the output pin 2 due to not having a series connected resistor between pin2 and the base. You may have to test using a different output pin.

See I told you a picture was worth many many words.  ;)



Thanks for your help. But it's still not working...  :-/
Now the the transistor responds to neither 5v or GND on the base, and I've tried using both a 300 ohm and 1000 ohm resistor. Just to clarify, this is what I'm at now:


Well the circuit is now correct as drawn. Now we have to test if the transistor or output pin is defective.

First test: Remove the resistor from pin 2 and plug it into the arduino +5vdc pin. If the motor runs then the transistor is good and we need to test the digital ouput pin2. If the motor doesn't turn on with +5vdc applied to the resistor then you have a bad transistor, or possible you have misidentifed the proper terminals for the transistor, check the datasheet to make sure you know which is base, emitter and collector.

Second test: If motor ran with +5vdc applied to the resistor, then move the resistor to another pin2 and change your software to use that new output pin. Also make sure you are using pinMode(pin, OUTPUT); properly to set the pin to output mode.

Good luck;



Jan 13, 2011, 01:40 pm Last Edit: Jan 13, 2011, 01:41 pm by fdufnews Reason: 1
First test: is controlling the pinout of the transistor
Second test: controlling it is correctly wired.

If you have wired as in your drawing, connecting the base of a NPN to ground had never made flowing current through the collector. So either the transistor is defective or it is uncorrectly wired.


So either the transistor is defective or it is uncorrectly wired.

Or you blew it up with the first wrong circuit you used it in.


Ah! Solved it. You were right. I'd misidentified the proper terminals. I couldn't find it on the datasheet before, but I've located it at the bottom of the page.
I assumed the terminals were (from left to right) emitter, base, collector.
Turns out they are actually base, emitter, collector, for this transistor. But now connecting it to 5V works! Also, I tested it with a script for digital pin 5 and it also works! You've allowed me to continue working on my project and helped me learning! Thanks very much for all your help!!  ;D ;D ;D


I assumed the terminals were

A very valuable lesson learned, never assume wiring decisions. Always use references to determine proper terminals of components if you are not 100% sure.

Glad you got it working and good luck on your further progress.



Jan 14, 2011, 01:41 pm Last Edit: Jan 14, 2011, 01:43 pm by fdufnews Reason: 1
Turns out they are actually base, emitter, collector, for this transistor

Well I am very surprised. Are you sure?
I think you have exchanged emitter and collector. If I were you I will double check.

Look here --> http://www.datasheetarchive.com/Indexer/Datasheet-051/DSA0031567.html


Jan 19, 2011, 02:07 am Last Edit: Jan 19, 2011, 02:08 am by zaphil Reason: 1
Hmmm. B-C-E is quite common and lots of transistors will work (poorly) with the C & E terminals swapped!

Personally I prefer to use a FET - no resistor needed at all then :)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131