PNP transistors as a switch controlled by arduino

So my basic circuit is a PNP transistor with 6V (battery) on the emitter, a digital pin on the base and then two 1k resistors between the collector and ground. It seems that when I put the pin to LOW, nothing really changes, but when I unplug it entirely the transistor works as expected. This is to check the battery's voltage without having it constantly discharging.

Some notes:
I am literally on an island and in a time crunch, so buying new parts is almost impossible (otherwise I would just use megaohm resistors and call the discharge negligible). Please let me know what I am doing wrong.

Edit: when using PIN 13, the light stays on indefinitely whenever the base is plugged in.

What voltage is on the base when you pull the pin LOW. Are there any other resistors in the base circuit?

meee418:
So my basic circuit is a PNP transistor with 6V (battery) on the emitter, a digital pin on the base and then two 1k resistors between the collector and ground. It seems that when I put the pin to LOW, nothing really changes, but when I unplug it entirely the transistor works as expected. This is to check the battery's voltage without having it constantly discharging.

you didn't put a resistor between the base and the digital pin, and no resistor between the emitter and +6V ??
:astonished:

DOH. yeah, adding another resistor between the 6V and the emitter works... :grin: Thank you so much!

so now my circuit is:

+6V ----1K-----C B E-----1K---Analog Read---1K-----Gnd
|
1k
|
Digital Pin

since the battery voltage will be changing, is there any way to know if it's a fraction of the total voltage? or a "good guess" (+ or - .5 Volts)?

Drawings, even bad ones, are better than text.

Here is what I hear you saying... but I would say... there is a bit of a problem here...

To start with... A PNP turns on when you set a digital pin "low"... but where is your base resistor to control current to the base pin?

[edit] Ok, I see that question has been dealt with...

batt.jpg

So, here is a an updated drawing we can discuss.

My final thought was that you had no "load" per se... but that was discussed while I was drawing.

EDIT: Updated drawing

batt2.jpg

what is your transistor ?

You didn't send your schematics, but if it is done as I imagine it to be, you should mesure :
0v on the collector wgen the digital pin is high (transistor Off)
and almost 6V when the pin is low (transistor ON)

But a 1k resistor gives only 5mA base current, it is too low to get the transistor saturated, try with
lower value of Rbase . Ib values depends on the transistor characteristics .
Look at the datasheet, find VceSat at Ib=xxxmA Ic=yyymA then you'll have the Ib needed.

Edit : OK I wrote this while you were sending your schematics, sorry :wink:

well, that we ME trying to draw for the OP... I could be way wrong here... and a 1k (5ma) is usually just fine for a small signal transistor with 150-300 gain) If he's using a PNP power transistor, I agree with you.

I attached a modified drawing of the circuit, you were missing a single resistor between 6V and the collector. Also good to know about PNP being LOW to be "on" I've only ever worked with NPN and bought these by accident :blush:. This resistor issue actually throws a lot of my project into question... much of it involves reading voltages across .3 ohm resistors. I am going to have lunch and then upload another question about PNP switching involving the rest of my circuit. Don't worry I'll draw it this time :wink:

My trick to remember "what makes a transistor switch" is, the middle letter. "ON" is: for NPN - A more Positive voltage than the Emitter, for PNP - a more Negative voltage than the Emitter.

OK, I see....
You can get rid of the emitter resistor, make Rbase lower (look at the datasheet for Ib )
the value on the analog input will be : (Vbatt-VceSat)/2 , given the equal 1k resistors that makes the divider .
Should work...if you don't let the battery discharge too much :wink:

Here is my charging circuit for a battery, NOW I am going to lunch. Please give me critiques on whether you think it will work or not.

Don't use pin 13 ! On most boards pin13 is attached to an LED onboard, and will make the voltage on the base of the transistor different than you expect. Use any other data pin

Good luck.

pwillard:
well, that we ME trying to draw for the OP... I could be way wrong here... and a 1k (5ma) is usually just fine for a small signal transistor with 150-300 gain) If he's using a PNP power transistor, I agree with you.

Look at the datasheet of 2n2907A (ok, not the best switching tr, but widely used) :

Vce(Sat) Ic=150mA Ib=15mA 0,4V
Vce(Sat) Ic=500mA Ib=50ma 1,6V

If I used this transistor, I would change the values of the two collector resistors to have an Ic sat value of 150mA , and I would use a Rbase to get Ib=15mA -
Then I think OP should read the datasheet and use the values to calculate the needed resistors.

meee418:
Here is my charging circuit for a battery, NOW I am going to lunch. Please give me critiques on whether you think it will work or not.

oups, I think I'm goiing to lunch too...I'll tell you later on, if nobody has answered in the meanwhile :wink:

but you could redraw your schematics, with the transistor name, where is the emitter... etc...
and maybe tell us approximately how you want it to work. Why use all these Ax inputs ?

Then I think OP should read the datasheet and use the values to calculate the needed resistors.

Agree. I had one reply that I deleted where I started asking questions like, 'what is the design goal?' 'have you done any math calculations or are you "rule of thumbing" it?' etc... but I decided to not ask those questions at that point.

I assume that someone might argue at this point that a p channel mosfet would be a better idea.

Basically I s given a month to build a circuit and then told to ignore it and focus on other things. Then my boss tells me to build it in a week (be has a degree in economics). So now I am rule of thumbing it because my project was mismanaged beyond my control.

wow... that's stinks... or should I say... it's essentially "normal"

yeah but I've accepted it. Just annoying, but essentially at this point even if the circuit doesn't work great for collecting data, I still have it collecting some data, and if that data isn't what he wanted then I am gonna explain that these things take time and trouble shooting. So back to my second question: will the resistors shown in my circuit not be large enough to properly work these transistors? I will begin working on a diagram for the overall circuit so I can explain what exactly I am going for here.

Here is my total circuit, essentially what we're doing is comparing A0, A1 and A2 to A7 to get our total current/power output through there, then measuring A3 vs A5 and A4 vs A6 to get the actual current going into the battery. I assume based on what I have learned today that these PNP transistors won't really work for my purposes... but I would love to know if I am right in thinking that.