Go Down

Topic: electronically disconnecting a battery (Read 774 times) previous topic - next topic

I hope this is the right category to ask this question.

I am planning an attiny project for outdoor use. My plan is to include a 3.7V li-ion battery and a max1551 or max1555 charger ic together with an attiny85 on a a long and narrow pcb and seal it off with shrink tube so that it can withstand at least light rain and foggy weather(real waterproofness is not really a requirement)

The problem is that I would like to be able to reprogram the attiny even after the project is sealed and this requires the chip to be powered by the +5V supply from the programming arduino. The problem is that I would somehow have to disconnect the 3.7V battery from the circuit.

The easiest solution that I can think of would be to add a diode that prevents the current to flow from the +5V to the 3.7 battery. For some reason I doubt this will work.

Another option would be to use a pnp transistor to switch off the 3.7V signal, but I am not sure how to wire this up. I think that for a pnp transistor to allow current from emitter to collector it is not sufficient that the base is kept at 0V, it actually needs to be pulled to ground which means that in normal operation there will be a waste of precious battery power. Besides, it strikes me as strange that the base and the collector of the transistor would effectively be tied together... See the picture attached:


I have seem FET and MOSFET transistors and I suspect that these may be the solution but I don't understand yet how exactly they are different or how this could work.

Any suggestions?



dc42

#1
Jan 15, 2013, 05:12 pm Last Edit: Jan 15, 2013, 08:00 pm by dc42 Reason: 1
If you use a programmer such as the AVRISPmkII to reprogram the ATtiny, then you don't need to disconnect the battery. This programmer (and probably several others) requires the device to be powered when you program it, and it detects the voltage that is being used. I have used it to program an ATtiny-based system powered from 2 AA cells.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

majenko

What makes you think that a diode won't work?

For a diode to conduct, the anode has to be a higher potential than the cathode.  If the anode is on 3.7V, and the cathode is on 5V, it won't conduct, so the battery will be cut off.

Use a schottky diode so you don't get much voltage drop.

Many thanks to both replies.
This was really helpful. I guess you are right about the diode.

Just now I figured out why the simple diode option does not work :)
It has to do with a slightly different problem, which I confused to be the same :)
The reset pin on the attiny needs to be pulled high during operation so i connected it to the 3.7V input assuming that I was going to disconnect that somehow during programming.
The programmer needs access to the reset pin to access the bootloader. The problem boils down to the following:
the reset pin needs to be pulled up when no +5 is present and down when it is. So basically I need a very simple inverter and attach a pull-down resistor to the input so that no connection is converted to +5.
Searching on the internet I have found a site that uses 2 mosfet transistors to do this: http://manssomsnook.blogspot.nl/2013/01/scheme-diagram-500w-power-inverter.html
Why do they use mosfets? what's so special about those transistors? Do I need fet or mosfet to build an inverter or would regular transistors work as well?

Thanks in advance for any advice,

dc42

All you need to do with the reset pin is connected it via a pullup resistor of about 10K to the Vcc pin of the ATtiny. The programmer will drive it low when programming. You can even get away with leaving it disconnected if the wiring to it is short, because it has an internal pullup of around 60K already.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Is that also true if the programmer is another arduino? I guess so actually.

Many thanks again,
You have been of tremendous help

SirNickity

FETs are good switches.  They don't depend on current through the gate, just voltage.  There's no "gain" formula.  Once you cross the threshold sufficiently and the transistor is conducting, its impedance (from drain to source) is fairly consistent.  The way I see it, the only advantage bipolar transistors have is that they can be turned on with very low voltages at the base, provided the resistance is low enough to sink enough current.

Since your reset pull-up can be tied to Vcc, all you need to do is diode-isolate the battery at the source.  Then, Vcc (and thus reset) are both at either 3.7v (on batter), or 5v (with external power applied).  As long as the external voltage is higher than the battery, the diode will be reverse biased, effectively disconnecting the battery.  A FET switch here would be fun, but as long as you can deal with the voltage drop, and ensure the external supply is always higher (or won't be offended by back charge from the battery), a diode will do the trick.

majenko


FETs are good switches.  They don't depend on current through the gate, just voltage.  There's no "gain" formula.  Once you cross the threshold sufficiently and the transistor is conducting, its impedance (from drain to source) is fairly consistent.  The way I see it, the only advantage bipolar transistors have is that they can be turned on with very low voltages at the base, provided the resistance is low enough to sink enough current.

Since your reset pull-up can be tied to Vcc, all you need to do is diode-isolate the battery at the source.  Then, Vcc (and thus reset) are both at either 3.7v (on batter), or 5v (with external power applied).  As long as the external voltage is higher than the battery, the diode will be reverse biased, effectively disconnecting the battery.  A FET switch here would be fun, but as long as you can deal with the voltage drop, and ensure the external supply is always higher (or won't be offended by back charge from the battery), a diode will do the trick.


FETs act like a resistor, albeit a small one.  BJTs have no resistance, but a constant voltage drop at the junction.

At low currents the resistance of a FET causes a small voltage drop across it.  At large currents that voltage drop can rise quite high.  At that point a BJT becomes much more desirable, as the voltage drop will be the same regardless of the current through it.

dc42


At low currents the resistance of a FET causes a small voltage drop across it.  At large currents that voltage drop can rise quite high.  At that point a BJT becomes much more desirable, as the voltage drop will be the same regardless of the current through it.


That's all very well in theory, but in practice mosfets are better at large currents too. For example, if I want to switch 100A, then I can get a mosfet with 0.001 ohm Rds(on) such as http://www.farnell.com/datasheets/356273.pdf. The voltage drop will be 0.1V so power dissipation 10W. But the only BJTs I can find rated at 100A have Vce(sat) around 1V, so ten times higher voltage drop (and over 100W power dissipation) - and that's with 10A base drive.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

majenko



At low currents the resistance of a FET causes a small voltage drop across it.  At large currents that voltage drop can rise quite high.  At that point a BJT becomes much more desirable, as the voltage drop will be the same regardless of the current through it.


That's all very well in theory, but in practice mosfets are better at large currents too. For example, if I want to switch 100A, then I can get a mosfet with 0.001 ohm Rds(on) such as http://www.farnell.com/datasheets/356273.pdf. The voltage drop will be 0.1V so power dissipation 10W. But the only BJTs I can find rated at 100A have Vce(sat) around 1V, so ten times higher voltage drop (and over 100W power dissipation) - and that's with 10A base drive.


Very low Rds_on has (historically) been few, far between, and expensive.  Yes, they are more common nowadays, but still you pay extra for them.  For very large currents and/or very large voltages is is most common to use IGBTs (Isolated Gate Bipolar Transistors), which are essentially a BJT coupled with a MOSFET.  The MOSFET switches the BJT, which in turn switches the current.  This gives the fixed voltage drop of the BJT with the isolation of the FET's gate.

Anyway, 100A is nothing :P  I never said how much current... Try finding a MOSFET that can switch 10KA at 320KV...

dc42


Anyway, 100A is nothing :P  I never said how much current... Try finding a MOSFET that can switch 10KA at 320KV...


The reason I chose 100A is that I was unable to find a BJT rated at more than 120A - whereas the mosfet I linked to is rated at 240A. For higher currents, mosfets connected in parallel share the current well, unlike BJTs. But I agree that IGBTs are the usual solution for switching higher currents.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up