Shop OBEX P1 Docs P2 Docs Learn Events
Low power guidelines — Parallax Forums

Low power guidelines

max72max72 Posts: 1,155
edited 2012-09-04 14:34 in Propeller 1
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):
  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
«1

Comments

  • LawsonLawson Posts: 870
    edited 2012-08-31 07:58
    Sounds like a good plan. Personally I'd just have all cogs drop into a wait state instead of killing them. Each active cog will only consume ~1.5uA at RCslow, and should be in the 0.5uA range while waiting. Unless you're VERY careful with the design of the rest of the circuit, the extra 4-10uA is unlikely to be significant. (i.e. cheap linear regulators usually consume 3-5mA while idle, etc.) Leaving the cogs loaded also saves ~7mS + initialization time reloading the cogs.

    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
  • max72max72 Posts: 1,155
    edited 2012-08-31 08:48
    Thanks for the suggestions.
    The LDO I plan to use is the MCP1700, which is very good, for low current applications.
    Massimo
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-08-31 09:15
    The GSM module don't have a enable pin?, one that put's in a very deep sleep.

    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.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-08-31 09:18
    The prop data sheet suggests a 10ms delay for the xtal and pll to stabilize, and only 75µs for the global delay when switching clock sources. So the delays you included are longer than they need to be. For power consumption, that is an issue if you are trying to minimize the ON time. Same for shutting down and restarting COGs, the power savings depend on the ratio of sleep time to reactivation time. From your description it sounds like your device will spend nearly all its time sleeping.

    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.
  • LawsonLawson Posts: 870
    edited 2012-08-31 12:10
    max72 wrote: »
    Thanks for the suggestions.
    The LDO I plan to use is the MCP1700, which is very good, for low current applications.
    Massimo

    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
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-08-31 12:34
    I agree that high side switching is better. The modem is not going to be powered from the MCP1700, so that means its positive supply is at a different level from it logic inputs, and that can entail level shifters or a hack with potential for parasite power paths.

    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.
    Screen shot 2012-08-31 at 12.28.09 PM.png
  • max72max72 Posts: 1,155
    edited 2012-08-31 14:32
    Thanks for the suggestions.
    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
  • TubularTubular Posts: 4,703
    edited 2012-08-31 15:23
    You can also get the time from the GSM network, so it is possible to wake just before the target time, go back to sleep for a short, adjusted time, then wake and transmit
  • Prophead100Prophead100 Posts: 192
    edited 2012-08-31 18:13
    You may also want to consider incrementing the power up and only add the speed and peripherals you need when you need them. For example, if it wakes ups and does some calculations it may only need to fully power up every few times to transmit or only if certain conditions are met. Not everything needs to be done at 80 Mhz or run all cogs.
  • cavelambcavelamb Posts: 720
    edited 2012-08-31 20:05
    Tubular wrote: »
    You can also get the time from the GSM network, so it is possible to wake just before the target time, go back to sleep for a short, adjusted time, then wake and transmit


    and adjust the nap time as it goes.
    until it wakes up with just enough time to check the time, and transmit.
  • max72max72 Posts: 1,155
    edited 2012-09-01 14:50
    Thanks for the suggestions, I really like the FDC6326L.
    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
  • max72max72 Posts: 1,155
    edited 2012-09-03 07:30
    A little update.
    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.
    GSM and pin floating: 46-48uA
    GSM and pins set: 36 uA
    No GSM and pins floating: 15-17uA
    No GSM and pins set: 1.1-1.5 uA
    

    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
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-09-03 08:15
    >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?

    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.
  • BatangBatang Posts: 234
    edited 2012-09-03 09:25
    The SIM900 will require peak currents of 2A @ 900mhz and 1A @ 1800mhz.

    Bad antenna matching can increase the above currents.

    Cheers
  • max72max72 Posts: 1,155
    edited 2012-09-03 12:07
    @tonyp12: you are right, I should have specified pmos

    @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
  • TubularTubular Posts: 4,703
    edited 2012-09-03 13:42
    I think the various modules have similar current peak (around 2A peak)

    With the Telit modules we've used IRF7404 P-fets to switch the module successfully for several years now
  • max72max72 Posts: 1,155
    edited 2012-09-03 14:30
    Nice Pmos :-)
    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
  • groggorygroggory Posts: 205
    edited 2012-09-03 15:18
    As a side note...

    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.
  • TubularTubular Posts: 4,703
    edited 2012-09-03 16:43
    max72 wrote: »
    Nice Pmos :-)
    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

    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
  • BatangBatang Posts: 234
    edited 2012-09-03 22:18
    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.

    @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.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-09-04 00:24
    For sake of visualization, here is a 'scope trace of current drawn by a GSM (GPRS) modem, showing a series of 4 spikes. The current is measured through a 0.1Ω shunt, so trace "A" is working mostly at about 40mA, but the 4 pulses of current in this case go up to 1.4A. There are two traces on the screen, and the thin line (trace "B") is a an expanded version of trace "A", the highlighted first pulse, shifted in time and up a little in baseline offset. Each pulse lasts about 1ms with a dwell time of 0.5ms at the peak, and draws about 0.001 coulomb. (That would be a 1V drop on a 1000µF capactor.) The pulses are spaced at 4.5ms intervals. Oh, this is a Multitech socketmodem IP.

    GPRS_1A_spikes.JPG
    640 x 478 - 82K
  • max72max72 Posts: 1,155
    edited 2012-09-04 00:30
    Thanks for the tips.
    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
  • max72max72 Posts: 1,155
    edited 2012-09-04 00:39
    Thanks Tracy.
    The picture is great.
    The SIM900 datasheet shortly explains the behavior, but your data clarify everything.
    This is a great learning experience.
    Massimo
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-09-04 01:02
    Another good option for the capacitors are polymer electrolytics. For example, the series S8 or R7 FPCAP from Nichicon (functional polymer aluminum cathode, solid electrolyte). Low ESR, less than 10 mΩ, generally lower than tantalums, also low inductance. Cheaper for the large capacitance values too.
  • max72max72 Posts: 1,155
    edited 2012-09-04 01:58
    Great, thanks.
    I was missing this part.
    I used some Panasonic in the past FP Type V but they are not as good.
    Massimo
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-09-04 10:28
    max72 wrote: »
    Thanks for the suggestions, I really like the FDC6326L.
    ...
    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

    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.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-09-04 10:34
    With regard to inrush currents, they can be substantial when switching via a low resistance path like a V-pmosfet. Here is another 'scope trace. This is not a modem; it is a lowly SD card being switched via a pmosfet from the same 3.3V power supply as a Prop, supplied by an MCP1703 regulator and 100µF filter capacitor.
    SD_glitch_mA_worst.jpg


    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.
    720 x 540 - 112K
  • groggorygroggory Posts: 205
    edited 2012-09-04 13:14
    Wow. I need to start using my shunts and watching for inrush in my designs more often!!!
  • max72max72 Posts: 1,155
    edited 2012-09-04 13:48
    the scope trace is already impressive even not considering it is a SD card..
    It is an aspect I underestimated.
    Massimo
  • Mark_TMark_T Posts: 1,981
    edited 2012-09-04 14:34
    For sake of visualization, here is a 'scope trace of current drawn by a GSM (GPRS) modem, showing a series of 4 spikes. The current is measured through a 0.1Ω shunt, so trace "A" is working mostly at about 40mA, but the 4 pulses of current in this case go up to 1.4A. There are two traces on the screen, and the thin line (trace "B") is a an expanded version of trace "A", the highlighted first pulse, shifted in time and up a little in baseline offset. Each pulse lasts about 1ms with a dwell time of 0.5ms at the peak, and draws about 0.001 coulomb. (That would be a 1V drop on a 1000µF capactor.) The pulses are spaced at 4.5ms intervals. Oh, this is a Multitech socketmodem IP.

    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...
Sign In or Register to comment.