Go Down

### Topic: PNP transistors as a switch controlled by arduino (Read 5937 times)previous topic - next topic

#### pwillard

#15
##### Jul 17, 2013, 07:00 pm
Quote
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.

#### meee418

#16
##### Jul 17, 2013, 08:06 pm
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.

#### pwillard

#17
##### Jul 17, 2013, 08:10 pm
wow... that's stinks... or should I say... it's essentially  "normal"

#### meee418

#18
##### Jul 17, 2013, 08:14 pm
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.

#### meee418

#19
##### Jul 17, 2013, 08:42 pm
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.

#20
##### Jul 17, 2013, 08:50 pm
On the latest boards, D13 goes to LM358 as a buffer to drive the LED, so there is effectively no load concern (and I think it was only  ~0.5mA  before that).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### alnath

#21
##### Jul 17, 2013, 09:07 pm

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.

OK, I can't do this right now, but I'll have a deeper look. But at first sight, I think that you'll use Ax values and some calculations to switch on or off the transistors, individually ? If so, it could work, but the base resistor should be less than 1k (yes I know, I'm stubborn ) . Don't forget the 0.4V if you stay with 2907 (there are better switching transistors) . And maybe you could use mosfets transistors, depending on the current, it could be a better choice, some mosfets have a really low RDSon value ....

#### meee418

#22
##### Jul 17, 2013, 09:16 pm
Actually I built the circuit with MOSFETs initially for that reason, but in the end I couldn't get the right MOSFET and had to make the circuit with some PNPs that I had lying around (because I never used them  ). I appreciate all your input, I am installing the circuit to the device tonight, then it is deployed for a week and taken back to have maintenance done. My idea is to find the right parts for this circuit, then modify the circuit next chance I get. Good to hear that this "might" work, that's actually great. Right now I've tested it and I get some values that roughly correlate to what I am expecting, but the PNPs do worry me a bit in terms of how they are put in the circuit.
Let me know when you can.

To everybody in this thread: Thank you so much for your time and consideration, you will definitely seem me attempting to help others as a result, words cannot do justice to the appreciation I have for what you are all doing.

#### LarryD

#23
##### Jul 17, 2013, 09:28 pm
Quote
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   smiley-red. 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  smiley-wink

Should we not be looking at a cct. like this?
No technical PMs.
The last thing you did is where you should start looking.

#### meee418

#24
##### Jul 17, 2013, 09:30 pm
the circuit you posted is a smaller part of the larger circuit, used only to gauge whether the battery should be charging or discharging. The circuit I just posted does not show the circuit from my initial question, but still involves PNP switching.

#### pwillard

#25
##### Jul 17, 2013, 09:32 pmLast Edit: Jul 17, 2013, 09:34 pm by pwillard Reason: 1

There is no reason to start doing that here since we have so far remained ground referenced on all parts of the circuit.  The divider that feeds the analog pins needs to be part of a circuit that the pin can measure.

#### meee418

#26
##### Jul 17, 2013, 09:46 pm
Sorry, I understand the confusion. All of the analog pins are actually voltage dividers between the points they reference and common ground. Pretty much everything is grounded where it should be. My main question is will these PNP transistors act as "switches" in a way more or less similar to relays. I realize that they are transistors and not relays.

#### karls0

#27
##### Jul 18, 2013, 01:31 am
Hi @ all.
Sorry for joining so late. From the first posting I think, that you want to measure the voltage of your batterie(s) which are around 6V nominal. To save the current of the voltage divider, you want to use two resistors of 1K each.

The problem with your circuit is, that the Arduino-pin goes up to approximately 5V only. Since your PNP-emitter is connected to 6V, the base gets some current (1V - 0.7V = 0.3V; 0.3V at 1K gives 0.3mA). Since your complete "load-current is about 2mA, a transistor with a B of 150 will turn on to some degree. So you can never turn it off.

To solve this, you can lower the emitter voltage by replacing the series-resistor with a Zener-diode of two to three volts. Since your "load-current" does not change very much, the voltage could be considered constant and inserted into your calculation.
I would prefer to take away the series resistor in the emitter and put a Zener in the base circuit. So the Arduino-pin has to go down further to turn on the PNP. To be sure, that the PNP turns off, you could add a 22K resistor (rule of thumb, maybe even more) between emitter and base.

hth,
Karl

#### alnath

#28
##### Jul 18, 2013, 10:45 am

The problem with your circuit is, that the Arduino-pin goes up to approximately 5V only. Since your PNP-emitter is connected to 6V, the base gets some current (1V - 0.7V = 0.3V; 0.3V at 1K gives 0.3mA). Since your complete "load-current is about 2mA, a transistor with a B of 150 will turn on to some degree. So you can never turn it off.

oh, yes, I missed that
I'm afraid I'm a little rusted !

#### karls0

#29
##### Jul 20, 2013, 09:26 am
Quote
I'm afraid I'm a little rusted !

, me too! Solution three would be to use an additional NPN-transistor to pull down the base, when you want to measure. If you need a drawing, maybe I can do one on monday (I am not at my office-PC now).

Karl

Go Up

Please enter a valid email to subscribe