will this work?

I want to use a transistor to switch a battery charger off? Like in my diagram bellow? Will this work and what type of transistor do I need?

It's confusing for me because I don't know if I must do high side switching or if I treat the battery as the "load" or what?

Your “diagram below” did not appear.

Oops I forgot to attach it

Yes, use P-channel MOSFET like that for high side switching.
Or use N channel on the other leg for low side switching.
What will turn the transistor off & on?
If a 0-5V signal, then be sure to select a Logic Level MOSFET.
Want Low Rds so it does not heat up and dissipate power as chargng occurs.

What voltages and currents are involved?

(BTW you seem to have drawn an IGBT symbol of unspecified polarity - did you mean this?)

Yes I meant to draw it like that cause I don't know what type of transistor to use.

Ok I have connected an PNP transistor and im driving it with an NPN. I have a weird problem though. If I switch the charger on without the battery connected, the resistor from the base of the PNP to the collector of the NPN gets smoking hot and burns out. But when I connect the battery then it doesn't get hot? Why is this?

I have used a 1k resistor between the NPN collector and the PNP base and a 1K resistor as a pullup resistor for the PNP base.

The current is 250mA and the voltage is 29volts. The transistors I'm using is a P2N2222 and a BC327

Oh and sorry I am using an atmega 328 to switch the transistor

With 29V flying about you have to calculate resistor power dissipations and choose
suitably large packages as necessary.

MarkT:
With 29V flying about you have to calculate resistor power dissipations and choose
suitably large packages as necessary.

Please inform me how I can calculate the current flowing from the PNP transistor to the NPN collector? I thought small currents flow into and outof transistor bases?

Again- resample your images. I'm not going to scroll around a massive 3000x2000 pixel image.

What type of charger are you using? If it has its own on/off switch it might be easier to control that, instead of the flow to the battery

twelch:
What type of charger are you using? If it has its own on/off switch it might be easier to control that, instead of the flow to the battery

The power supply is a printer power supply. It doesn not have any switches

calvingloster:
If I switch the charger on without the battery connected, the resistor from the base of the PNP to the collector of the NPN gets smoking hot and burns out. But when I connect the battery then it doesn’t get hot

would it be possible to add a failsafe so that the charger will not switch on if there is no battery connected? I wouldn’t even know how if it was but It seems to make sense…

yes i think it would be possible to add failsafe.

You see things like this don't help me understand? if I add a fail safe I will sort out the hot resistor but I still have no idea why the resistor gets hot without the battery connected

I propose a new forum called "calvingloster's immense battery charger" to keep these threads organized.

Without a battery hooked up there is nothing using up the power going into the resistor, that power must go somewhere so it is released as heat. Its like beer, if you drink alot of beer but don't go pee, your bladder gets full and you do the pee-pee dance. Well your resistor is drinking beer, and is doing the pee-pee dance.

I have often encountered anomalies in a project and can find no reasonable explanation for one strange condition that I don't want to occur. While it is incredibly annoying to not know why it is easier to implement a failsafe to prevent it. Again I wouldn't know how to do it but it would seem to me you should be able to add a little code and some hardware to cheach if there is a battery present and then proceed based on that.

calvingloster:
Ok I have connected an PNP transistor and im driving it with an NPN. I have a weird problem though. If I switch the charger on without the battery connected, the resistor from the base of the PNP to the collector of the NPN gets smoking hot and burns out. Why is this?

Ummm... too much power going through it.

You know how to calculate power, right? We did it in the other thread.

First you calculate/measure the current going through it, then you multiply by the voltage across it. It doesn't take too many amps to heat up a resistor when you've got 27-28 volts across it.

PS: Those adjustable-voltage, current-limited battery chargers are still less then $2.50: http://www.ebay.com/itm/161272395732

fungus:

calvingloster:
Ok I have connected an PNP transistor and im driving it with an NPN. I have a weird problem though. If I switch the charger on without the battery connected, the resistor from the base of the PNP to the collector of the NPN gets smoking hot and burns out. Why is this?

Ummm... too much power going through it.

You know how to calculate power, right? We did it in the other thread.

First you calculate/measure the current going through it, then you multiply by the voltage across it. It doesn't take too many amps to heat up a resistor when you've got 27-28 volts across it.

PS: Those adjustable-voltage, current-limited battery chargers are still less then $2.50: http://www.ebay.com/itm/161272395732

Ok understandable, maybe easy for you but not easy for me. I know, I think I know, that the base of the PNP has not got 27volts across it. The emitter and collector has 27volts across it but not the base. So if I ground the base of the PNP transistor how can 27volts be across the base? I thought a transistor uses small amounts of voltage across the base to allow large amounts to pass through the emitter and collector?

fungus:
I propose a new forum called "calvingloster's immense battery charger" to keep these threads organized.

Haha that's pretty funny I'm not gana lie