Shop OBEX P1 Docs P2 Docs Learn Events
Help with Power Shutdown — Parallax Forums

Help with Power Shutdown

mynet43mynet43 Posts: 644
edited 2012-04-03 08:19 in Propeller 1
I have a Propeller board that's powered by a 7.4V LiPo rechargeable battery.

I'm looking for a circuit to prevent the battery from becoming discharged. The battery is made up of two cells, each providing 3.7V. The battery is damaged if a cell is discharged below 2.7V.

I'm looking for a simple circuit to turn off the battery when the cell voltage falls below a preset value, say 3.0 V.

I can easily monitor the voltage with an ADC port I'm already using, MCP3208.

I'd like to use something like an FET, to turn off the battery when the Propeller tells it to.

The trick is to design it so the board will restart when the power is cycled. It should always start up and run, regardless of the battery voltage, unless the Propeller tells it to turn off.

This looks like it should be simple, but I haven't figured out the shut-off then restart problem.

Thanks for your help.

Jim
«1

Comments

  • BADHABITBADHABIT Posts: 138
    edited 2009-06-05 00:48
    Would a voltage divider work? you could set it up so that normal is high, then when it drops below 3, or wherever you want it, it will make the pin go low.

    Or...you could probably use an op amp with·a pot on pin3 to control the threshold
  • mynet43mynet43 Posts: 644
    edited 2009-06-05 00:57
    Badhabit,

    Thanks for the feedback.

    I'm not sure you read the post right. (Or I didn't understand your response.)

    I'm trying to have the Propeller shut off the battery. The Prop already knows the battery voltage (from the ADC).

    Jim
  • BADHABITBADHABIT Posts: 138
    edited 2009-06-05 01:07
    oops
  • BADHABITBADHABIT Posts: 138
    edited 2009-06-05 01:09
    how about something like a 4066 - Quad·analog switch IC -- w/an op-amp to set the control voltage to keep it from rebooting

    Post Edited (BADHABIT) : 6/5/2009 1:28:34 AM GMT
  • mynet43mynet43 Posts: 644
    edited 2009-06-05 01:57
    Badhabit,

    Thanks again for the feedback.

    I DO want to reboot the board when the power switch is recycled.

    Here's a summary:
    1. Turn off battery power under Propeller control (board goes dead).

    2. When power switch is recycled from off to on, allow battery power to all systems.

    I hope this helps.

    Jim
  • BADHABITBADHABIT Posts: 138
    edited 2009-06-05 02:30
    W/the op amp on the control I htink you could set it so that if the voltage is good it will be switched on (good to boot) and if voltage low switched off (not good to boot)

    Hopefully one of the older guys will verify this, but I think it would work.

    BH
  • BADHABITBADHABIT Posts: 138
    edited 2009-06-05 03:12
    NM, I don't think the above will work. It would keep drawing current after the prop is cut off which would eventually ballon your LiPo
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-05 03:28
    Jim,

    Can you be sure that both cells discharge at the same rate, or do you need to monitor them individually?

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-06-05 06:46
    Jim,

    I will leave the battery cell monitoring up to you.

    Here is a circuit derived from an auto shut-down circuit I originally designed for the Basic Stamp which had later been revised for the Propeller. The circuit below is an even further improvement on the previous Propeller design.


    Circuit operation:
    When the "ON" switch is closed, the PMOS transistor turns on which powers a 3.3V regulator (ideally this would be a low drop-out regulator). The regulator supplies power to the NPN transistor via a 330 Ohm resistor keeping it on which in effect holds the switch closed. If the I/O pin is made an OUTPUT and LOW, then the NPN transistor turns off shutting down the power. Now the Diodes serve two purposes they ensure that the I/O pin has enough BIAS to completely turn the NPN transistor off by raising the required voltage threshold to turn on the NPN transistor to about 1.95V compared to the normal 0.65V ... The other reason is that the I/O can be made an INPUT to monitor the state of the power switch. Again by raising the threshold to 1.95V, this ensures that the I/O can detect a logic "1". If the power switch is closed (even if the circuit is already on) the voltage at the base of the NPN transistor drops to about 0.65V resulting in a logic "0" detection from the I/O.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    849 x 863 - 168K
  • mynet43mynet43 Posts: 644
    edited 2009-06-05 14:36
    @Phil,

    I could monitor the indidividual cells, since that's what I'm using. However, right now my main concern it to avoid damaging the batteries from over discharging.


    @Beau,

    Thanks so much for the cool circuit. I think it will basically do what I'm looking for. I've been staring at it for a while, and there's still one thing I haven't figured out. If the "ON" switch is closed, how does the transistor turn off the power? I'm sure I just need another cup of coffee, but could someone help me understand this?

    Thanks for all the help!

    Jim
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-06-05 15:38
    "If the "ON" switch is closed, how does the transistor turn off the power?" - The "ON" switch should be a momentary push button type of switch. ... So after the Propeller has booted, the Propeller can monitor the switch and turn the unit "OFF" manually after the button has been pressed, or if the Propeller sees fit from the state of the batteries, the Propeller can turn the unit off.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • mynet43mynet43 Posts: 644
    edited 2009-06-05 15:50
    Thanks Beau!

    Now it all makes complete sense!

    It wasn't obvious from the diagram.

    The way it's set up, I can monitor the switch and turn it off for them when they press it a second time.

    Thanks again,

    Jim
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-06-05 16:42
    "The way it's set up, I can monitor the switch and turn it off for them when they press it a second time." - Yes, that is correct.

    Note: All power to additional circuitry must either go to the Drain of the Mosfet or the output of the regulator.

    When I built this circuit to test it last night, I used a SUD50P06-15L for the P-MOS and a standard 2n3904 for the NPN transistor. The P-MOS was way overkill (just what I happened to have in front of me) you should choose what will be applicable to your current demands.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • mynet43mynet43 Posts: 644
    edited 2009-06-05 17:36
    Thanks Beau!

    You just answered everything I wanted to know but was afraid to ask [noparse]:)[/noparse]

    I think that will work perfectly!

    Jim
  • Chad GeorgeChad George Posts: 138
    edited 2009-06-05 19:37
    not to dissuade you from trying to protect the li-po batteries with the propeller...i think that could work if done correctly.

    but it might be easier to just add a battery protection circuit to your battery pack.

    I've used something like this www.batteryspace.com/index.asp?PageAction=VIEWPROD&ProdID=3117 before and it works pretty well.

    I once tried to integrate this functionality into my board but found it was more cost effective to have the protection in the battery pack.

    an advantage of these circuits is they also protect from overcharging and over-current which can be dangerous as well.
  • mynet43mynet43 Posts: 644
    edited 2009-06-05 21:30
    Chad,

    Thanks for the good info. The price is certainly right, at $3.95 for the complete control board.

    I really don't want to use another circuit board. The battery is mounted to my board with velcro. I'm going to make some mods to my board anyway, so I'll probably use Beau's circuit, since he was kind enough to breadboard it to make sure it works. I already have a spare ADC channel, so I can monitor the voltage.

    I might also look at the chips referenced in your link. The Mitsumi MM1412 Protection IC and the Panasonic Si4936 MOSFET. They look interesting.

    Thanks again,

    Jim
  • Mag748Mag748 Posts: 269
    edited 2012-03-23 12:18
    Hello,

    I have put this circuit together on a Propeller Proto Board. I modified the proto board by removing the power jack and connecting the output of the PMOS to the supply pin. I have gotten the circuit to work somewhat. When I press the switch, the power comes on. When I manually ground the propeller I/O pin that the NPN base is connected to through the 100Ohm resistor, the power shuts off. But for some reason, I can not get the power to shut off with the I/O pin set as an output and LOW.

    I measured the voltage at the I/O pin and it is at about 2V. When the switch is pressed the voltage drops to about 0.75V. But when the I/O pin is set to an output and High or Low the voltage at that pin remains at 2V and does not change. The only way to shut the power off is to manually connect that pin to VSS.

    At first I thought that the I/O circuitry could have been damaged in some way, so after checking another pin, I moved the resistor to the new pin. And the same result. I checked the original pin, and it worked fine. The voltage was 0V and 3.3V when set to Low and High respectivly.

    I can't figure out why the Prop I/O pin doesnt do anything with this circuit in place.

    The only thing I can think of is that the NPN that I am using has some strange characteristics, although I'm pretty sures its just a 2N4400.

    Any suggestions?

    Thanks,
    Marcus

    The test code I am using is attached.

    PowerTest.spin
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-23 12:26
    Did you use two diodes off of the NPN transistors Emitter to ground connection? If the diodes aren't there, the Propeller can't overcome the diode drop within the transistor itself. by adding the two diodes, the Propeller should be able to overcome the transistor and shut it completely down.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-23 12:26
    Mag748 wrote:
    I have put this circuit together ...
    Which circuit would that be? I don't see anything wrong with your code. (You did remember to load it into EEPROM, right?) So I suspect it's something to do with your circuit.

    -Phil
  • Mag748Mag748 Posts: 269
    edited 2012-03-23 14:03
    I have in my circuit (2) 1N4003 Diodes. Please see the image attached of my Propeller Proto Board as a reference. The voltage drop across the diodes with the circuit powered down is 1.088V. The voltage drop across the diodes is 1.294V with the circuit powered up.

    The circuit that I am referring to is the one Beau attached to his post #10 above.

    I had not been writing this program to EEPROM, only to RAM, as I was worried about having the Prop shutdown after start up too quickly if the circuit did work, without allowing time to reprogram. But I did try it with EEPROM and the result was the same.

    Should I try adding a third diode in series with the other (2) diodes?

    Thanks you your responses. Let me know if there is anything in the image that is unclear.

    Sincerely,
    Marcus

    Proto Board.jpg
    1024 x 765 - 146K
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-23 15:16
    "But when the I/O pin is set to an output and High or Low the voltage at that pin remains at 2V and does not change." - what does your program look like? that doesn't seem right.
  • Mag748Mag748 Posts: 269
    edited 2012-03-24 11:53
    I have attached the test code I have been using to post #18 above.

    If I set the "powerPIN" to be 14, and then measure the voltage at pin 14 with a voltmeter, the voltage flips between 0V and 3.3V every one second as expected.

    Once I set the powerPIN to 15 (which is the pin the base of the NPN is connected to through the 100 Ohm resistor) and rerun the test, the voltage at pin 15 does not change at all. It remains at the same voltage at the base of the NPN, which is the voltage drop across the diodes.

    I agree that something does not seem right.

    Thanks,
    Marcus
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-24 12:01
    Marcus,

    Double-check your connections. It sounds like you've got a direct short between P15 and one of the transistor pins.

    -Phil
  • Mag748Mag748 Posts: 269
    edited 2012-03-26 06:16
    I have double checked the connections and found that the resistance between the prop pin and both the Collector and Emitter is greater than 3M Ohms and the resistance between the prop pin and the base is 100 Ohms.

    I have discovered another thing. If the prop pin that is connected to this circuit is set to an output, the prop stops working. I tested this by have 2 pins be controlled. When one of the pins is the pin connected to the Base of the NPN, the other pin remains at 0V. If I choose 2 pins that are not connected to the NPN, they both flip between 0 and 3.3V as expected. It appears that if the pin connected to the NPN is left as an input, the prop works fine. I think that the circuit is causing the prop to freeze or malfunction when the pin connected to it is set as an output.

    Thanks,
    Marcus
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-26 08:05
    Mag748 wrote:
    I have discovered another thing. If the prop pin that is connected to this circuit is set to an output, the prop stops working.
    But isn't that what it's supposed to do? If you set the pin to an output before setting outa to 1, it will pull the base low and turn itself off.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-26 08:56
    Phil is right ... that's exactly what it's supposed to do.

    If you want the Propeller to keep itself 'alive' set the pin HIGH first before making the direction an OUTPUT.
  • Mag748Mag748 Posts: 269
    edited 2012-03-26 09:46
    Sorry if I was unclear by saying the prop "stops working". The power to the regulators and the prop is not turned off in this state, everything is still powered up. The prop just seems to shut itself down. I don't believe this to be the correct operation. I would like to figure out why when I short to ground the prop pin that is connected to the NPN base, the circuit DOES shut power down. The prop is just not able to do it itself for some reason. And when it tries to, it stops working.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-26 09:58
    I think I know what's happening. I'll bet you've got your program loaded into RAM, right? When you pull the pin low, the power is interrupted, the Prop does a brownout reset, and the pin immediately tri-states. Although Vdd is low enough at this point to cause a reset, it's not low enough to keep the NPN off, and it comes back on again. But, because your program was in RAM, it's gone, and the Prop does nothing.

    -Phil
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2012-03-26 10:01
    Try placing a larger capacitor (100uF to 1000uF) across the output power of the 3.3V regulator.... If you don't have an extra capacitor handy try temporarily tying V_SERVO to 3.3V.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-26 10:19
    Beau,

    Won't that make things worse? It's the charge on the filter cap that's making enough voltage available to keep the NPN on when the Prop pin tri-states during reset. Maybe a diode connected across the 3.3V regulator: anode to Vdd, cathode to Vin. But I've got my doubts even about that remedy.

    -Phil
Sign In or Register to comment.