Low power guidelines
max72
Posts: 1,155
I'm trying to have the prop running with the minimum power.
This is what I gathered around, but I would like your opinion.
I'll wait for a pin to go high to wake up everything.
The setup will include a GSM module, so the battery wil be a LiIon, no low voltage isses, the GSM will not work below 3.3V.
This is my approach:
To low power:
- turn off all COGs.
- shut off peripherals (GSM) with a MOS
- set the pins correctly
- go to RCslow, and waitpeq (??)
When there is the wake up signal:
- restore the nominal speed
- turn on the MOS and the peripherals
- correctly set the pins
code to switch frequency (tested):
Pin setup:
- never let a pin floating
- unconnected pins should be output and set low (or high, I remember a discussion suggesting to set it high, but cannot find it anymore)
- pins with pull-up or pull-downs should be set as input
MOS (IRF3708):
- when off the gate is low. Better have a pull down and the propeller pin floating or no pull down resistor and driving the gate low?
Waiting for a pin:
I expect very rare events, but I would like to exit the loop from time to time to send a "working.." SMS, say once a day, more or less.
Moreover I don't need a very fast response to the external trigger.
What are the options?
- use only the waitcnt and check the pin from time to time
- use the counters to switch a pin and use waitpeq on the trigger and on the counter pin, to wake up from time to time
- ...
Thanks in advance,
Massimo
reference found:
http://forums.parallax.com/showthread.php?129731-Prop-Limbo!-how-low-(power-voltage)-can-it-go!
http://forums.parallax.com/showthread.php?84907-Propeller-Current-Draw&p=582072
http://forums.parallax.com/showthread.php?116578-Low-power-usage-of-the-Propeller-current-draw-avoid-using-PLL-3.6vNiMh-3.7vL
http://forums.parallax.com/showthread.php?84874-CLKSET()-syntax
This is what I gathered around, but I would like your opinion.
I'll wait for a pin to go high to wake up everything.
The setup will include a GSM module, so the battery wil be a LiIon, no low voltage isses, the GSM will not work below 3.3V.
This is my approach:
To low power:
- turn off all COGs.
- shut off peripherals (GSM) with a MOS
- set the pins correctly
- go to RCslow, and waitpeq (??)
When there is the wake up signal:
- restore the nominal speed
- turn on the MOS and the peripherals
- correctly set the pins
code to switch frequency (tested):
clkset(%0_0_0_00_001,20_000) ' RCslow waitcnt(20_000+cnt)
clkset($68, 12_000_000) ' oscillator & pll warmup, RCfast waitcnt(6_000_000+cnt) clkset(%0_1_1_01_111,80_000_000) ' set clock waitcnt(16_000_000+cnt)
Pin setup:
- never let a pin floating
- unconnected pins should be output and set low (or high, I remember a discussion suggesting to set it high, but cannot find it anymore)
- pins with pull-up or pull-downs should be set as input
MOS (IRF3708):
- when off the gate is low. Better have a pull down and the propeller pin floating or no pull down resistor and driving the gate low?
Waiting for a pin:
I expect very rare events, but I would like to exit the loop from time to time to send a "working.." SMS, say once a day, more or less.
Moreover I don't need a very fast response to the external trigger.
What are the options?
- use only the waitcnt and check the pin from time to time
- use the counters to switch a pin and use waitpeq on the trigger and on the counter pin, to wake up from time to time
- ...
Thanks in advance,
Massimo
reference found:
http://forums.parallax.com/showthread.php?129731-Prop-Limbo!-how-low-(power-voltage)-can-it-go!
http://forums.parallax.com/showthread.php?84907-Propeller-Current-Draw&p=582072
http://forums.parallax.com/showthread.php?116578-Low-power-usage-of-the-Propeller-current-draw-avoid-using-PLL-3.6vNiMh-3.7vL
http://forums.parallax.com/showthread.php?84874-CLKSET()-syntax
Comments
Also, the manual and datasheet have info on how long you need to wait for the crystal and PLL to stabilize. I thought it was more like 5-10mS than the half second your giving? I'd also let the clock and PLL stabilize while running RCslow just to save a fraction more energy.
Lawson
The LDO I plan to use is the MCP1700, which is very good, for low current applications.
Massimo
I think I would rather use a P-channel mosfet at high side to turn off peripherals
And use 200k Pull-up on its gate, enable GSM with Prop pin output+low and turn that Prop pin back as a input before going to sleep.
The primary thing is to take care of external current drains. Your strategy for that is good, with regard to pullup and pulldown resistors, no floating inputs, every peripheral in its low-power state.
Do use a pulldown on the mosfet gate. Switching the low side of the modem? Be careful with the signal pins that go to the modem, because they will probably have to be configured high or input to get the lowest current, otherwise there will be parasite power applied to the modem via those pins or via pulldown/pullup resistors. Also, when switching the power, beware of inrush currents that might cause a brownout on your power supply. That is especially true if you use a mosfet switch, as opposed to a current-limited voltage regulator. The inrush current for a microsecond or so can exceed 10 amps as the peripheral capacitors charge up.
I use a real time clock chip for timing. It has a periodic output that provides a rising or falling edge to the waitpne pin at a rate of 1 Hz. In RCslow mode, the Prop counts those edges. The RTC also has an alarm that can be set to generate the interrupt at a set time, like the once per day you'd need for the SMS "alive" message. The waitcnt could do that, but the timing would be uncertain, if that matters. At 20kHz, it takes 29.8 hours for the cnt register to roll over.
Yes the MCP170x series is very good at low current as long as they don't drop out. When the input voltage drops below 2.5v with the 2.5v part it's ground current jumps to ~22uA. I'd expect higher regulation voltage parts to be exponentially worse. (Conversely, the 1.2v doesn't draw extra current and the 1.5v part should only draw an extra microamp or so.) This should be fine in a battery powered device though. (still wish it was in the datasheet...)
My thoughts for peripheral shut-down would be to use regulators with shut-down pins for each power zone. Basically all the regulators I've seen with shutdown pins spec less than one microamp shutdown current, and are easy to drive from logic so they make a simple and effective solution.
Lawson
A regulator with a shutdown pin and current limiting is one option. It has to be able to supply the normal peak currents, which can be around 1.5A for a GPRS modem. Another option is a high side load switch, which is basically two mosfets connected for level shifting and with an option for inrush current limiting. For example, the Fairchild FDC6326L in an enhanced SOT23-6 package can handle 1.8A continuous and 5A pulsed.
The gsm module is the SIM900. I'm using a breadboard with some circuits and a nice 100 mils pin spacing.
The module schematic is here:
http://www.futuraelettronica.net/pdf_ita/8100-TDGGSM_900.pdf
I already tested the shut down mode but I was wondering if I could improve the set-up with an external switch.
The module has a peak current of around 1.5A, but the average (according to my DMM) is about 50-70mA.
The GSM voltage range calls for a direct supply from a Li battery.
So a single pmos is not an option and the GSM module will shut down below 3.2V, so no big problem with low voltage supply on the LDO.
In my experiencethe RCslow waitcnt on a wait time of 6 hours varies +/- 30mins, with the same chip, so an RTC would be a nice option if a more accurate timing is required.
Massimo
and adjust the nap time as it goes.
until it wakes up with just enough time to check the time, and transmit.
Have to play some more with the GSM module for time keeping. When I asked the time I got nothing back.. An RTC could be a nice alternative.
Another question about the mos control:
I understand that the inrush current is an issue, so this is a more general question about high side switching.
Can I use a mos on the high side (+4V), with pull up (10k) on the gate and do the following:
- when off set propeller pin to input (?? uA)
- when on set prop pin as output low (100uA)
I'll have some current flowing through the pull up resistor, so maybe not a solution here, but could it work?
Massimo
I did a small test with the prop, eeprom and the GSM module, setting the pins or leaving them on their own.
Input from a regulated power supply, set at 3.7V, current measured with a DMM in series.
The GSM is directly powered from the power supply, and the propeller uses the LDO MCP1700.
The tests with no GSM connected is simply done removing the GSM module.
RC slow.
So I would say:
The LDO does a very good job
There is little difference between having the COG running or waiting.
Setting the pins make the difference
In this case the GSM is relatively power hungry with respect to the rest.
Massimo
>- when off set propeller pin to input (?? uA)
>- when on set prop pin as output low (100uA)
>I'll have some current flowing through the pull up resistor, so maybe not a solution here, but could it work?
Using a N-channel mosfet on the high side, requires that you supply the gate with around 6-8volt.
Having dual supply rails or pumping up the voltage requires some more work, so it easier to go with a P-Channel mosfet.
You turn OFF the "power grid" by giving a voltage on the P-channels gate (opposite what a N-channel does)
So run Vbatt trace through a 100k Resistor to its gate and also tie this trace to a Prop Pin.
In input mode it will not draw any power, as output-set-low (sinking) it will draw very little and as on-mode are just in short intervals nothing to worry about.
Bad antenna matching can increase the above currents.
Cheers
@Batang: the max current drain of the GSM modules is quite an issue. The average current drain is about 50-70mA, but peak current is very high. As far as I know all the GSM modules around have similar requirements. If a regulator is used it must be quite big, on the other hand the voltage requirement is a perfect fit with a lithium battery.
I started with other batteries but a switching regulator had an idle current way too big.
Massimo
With the Telit modules we've used IRF7404 P-fets to switch the module successfully for several years now
Did you use Lithium batteries?
In case did you have problems with the inrush currents at startup?
Telit modules are quite nice too, and you posts about them have always been extremely interesting (the BGA adapter is pure genius).
I guess for SMS delivery the AT commands are the same, but I have not tested them yet.
Thanks,
Massimo
many cellular modules can accept direct connection to a lithium ion battery
in addition
they often have built in lithium chargers, battery status monitors, runtime monitors, interrupts (for sleep), very low power sleep modes, etc.
As I've done work on these I've realized that in order to make a design work best with them, you have to use them for everything that they are good at. Workaround just eat up money, board space, and time.
Yes, Single cell LiPo, or sometimes 2 supercaps. That FET seems to switch on hard enough that inrush currents are not a problem, but it would be worth checking for the Simcom. I think the nasty current spikes come with transmission well after startup - initially you are just charging up the caps (yes this can draw quite a lot of inrush current, but I don't think the FET resistance matters too much at this point).
The onboard power smarts are OK, but they are sometimes too smart and not low enough quiescent current for solar or battery applications. There is really nothing like having a nice big switch to force hard resets and not bleed current or risk lockups.
I suspect the AT command sets are very similar, but haven't worked with the simcom. I have used Sony-Ericsson (when they were separate) and Telit. I have bought a wavecom to evaluate.
Thanks for the kind words about the Ge865 board
@max72, even though the peak current is 2A you can use it with a supply current of 500mA but you must have (depending of the band you use) between 220uF and 440uF in the form of low ESR tantalum caps (D Case 6/10V) as close as possible to the supply pins of the SIM900, likewise the PCB traces to the supply pins should be at least 60mils in width.
Applications such as USB GSM dongles etc only have 500mA to work with.
Cheers.
Checking the board in fact it should already be compliant with your suggestions.
The module I have already has a couple of similar caps (C3 and C4 on the pdf I posted earlier).
They are 470uF 6.3V, and from the look I would say they are tantalum. Unfortunately there is not a detailed description, but cross checking with your post things make sense.
Massimo
The picture is great.
The SIM900 datasheet shortly explains the behavior, but your data clarify everything.
This is a great learning experience.
Massimo
I was missing this part.
I used some Panasonic in the past FP Type V but they are not as good.
Massimo
The FDC6326 has the level shifting circuit. That is important even if you roll your own with discrete parts. I'd stear well clear of a p-mosfet with gate connected to Prop pin to control power to a modem running directly off the battery at a higher voltage. A Li-ion or -poly battery will be up at 4.1 or 4.2V when fully charged and drop to 3.1 or so at cutoff. There is both current through the pullup resistor and leakage current through the mosfet. The level shifting circuit assures that everything is fully shut off.
Leakage currents back into a pin can be insidious in a micropower circuit, because they can cause the power supply voltage to increase.
The mosfet is switched on by a prop pin at the trigger point, trace #2 at the bottom. Trace #3 with the sharp spike shows the current drawn by the SD card, and here the current is taken across a 0.2Ω shunt. The voltage across the shunt peaks at over 2V, which is a current over 10 amps. That's right! Does that surprise you? The time scale is 50µs per division. Trace #A is a time-expanded version of the peak at 0.5µs per division, and shows a roughly triangular waveform about 1 microsecond long, and integrated that is 0.00001 coulomb from the supply. Trace #4 at the top is the Prop 3.3V power supply, showing its 50µs response to the glitch. It dips down to 2.6V, the brownout voltage of the Prop. Most SD cards I tested were not that bad, but most drew more like 7.5A for 1µs in that circuit.
It just goes to show the benefit of 1) inrush current limiting and 2) good layout and power supply bypassing.
The GSM modem from my earlier 'scope shot was supplied directly from the battery via an LT1963 regulator. When turned on via the regulator's shutdown pin, the regulator itself limited the current to 3A.
It is an aspect I underestimated.
Massimo
The GSM spec gives timeslots as 0.577ms out of a frame of 8 slots lasting 4.615ms. Unless using multiple timeslots you'd expect a GSM transmitter to average 1/8th of peak current. The current peaks can't extend past the timeslot boundary otherwise the transmitter would interfere with other phones on the network, so I would expect those current peaks are very close to 0.577ms wide at the transmitter (decoupling capacitance smears out the load current that's seen further back). The 4.615ms framing leads to obtrusive 217Hz breakthrough when a handset is too close to a radio. Multiple timeslots are used to permit fewer frequency channels to be used so that standard quartz crystals are good enough for handsets - having to put a crystal oven into a miniature device would be tricky!
I believe for data GPRS allows more slots to be used by one handset if negotiated with the base station, meaning that the average transmitter current could be more than 1/8 peak - this would clearly be a problem if too many slots were in use for a USB dongle...