High speed and sleep vers slow and steady Current consumption


+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,864
    Thumbs Up
    Received: 54
    Given: 96
    Total Downloaded
    1.37 GB

    0 Not allowed!

    Default High speed and sleep vers slow and steady Current consumption

    Hello my good friends

    I'm looking to establish the best system to reduce current consumption. On a previous product as I had to drive a GLCD I went for max speed 64mhz but after I was done with my task I went back to sleep. Napping for 2ms and inc counters until I slept for 50ms. Then set flags depending on how many I slept for eg 20hz, 10hz, 5hz and 1 hz. I also ran an interrupt on a timer so I could keep track of time when not counting naps. This was important as I had a HPWM running that stopped when you slept. So when say a buzzer was going you stopped sleeping same with a PWM dimmed back light.

    Now I'm on a new product. Same low power requirements but no issue with a large GLCD. I will need FP maths but nothing onerous. I could use the same 18F device as its cheap and I have code for it. Or I could go for some 16F device and run at a much lower OSC. 4mhz or less.

    So my question is what do you think. Fast bursts and take plenty of naps or take it easy. I suppose its a maths question based on the current consumption between osc speeds and if there are overheads with keeping stuff alive above that required to push bits around.

    Thanks

    Tim
    Tim

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,423
    Thumbs Up
    Received: 31
    Given: 8
    Total Downloaded
    1.18 GB

    0 Not allowed!

    Default Re: High speed and sleep vers slow and steady Current consumption

    Hi Tim,
    Have you looked at Microchip Nanowatt XLP devices, apparently there is a calculator download for battery life estimator.
    http://ww1.microchip.com/downloads/e...Doc/39941d.pdf

    Regards,
    Bob

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    849
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: High speed and sleep vers slow and steady Current consumption

    I've always found it difficult to get the theoretical power consumption that Microchip quote when the device is sleeping. It's also difficult to estimate power consumption when there are lots of small spikes which there often are and other circuitry.

    I bought a Joulscope a while ago though haven't used it that much, I also noticed that there is a cheaper current monitor specificaly for looking at battery life, I think it may have some issues, there is an EEV review on Youtube, anyway these sort of devices are great for seeing REAL power use over time.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,794
    Thumbs Up
    Received: 375
    Given: 182
    Total Downloaded
    2.09 GB

    0 Not allowed!

    Default Re: High speed and sleep vers slow and steady Current consumption

    Depending on the device used, there are several ways to go to sleep more efficiently. For example, I have just done a project that operates on batteries and it has a host of peripheral devices attached to it, so the first thing is to have the microcontroller in charge of powering external peripherals and use external MOSFETS to turn off the peripherals that can be turned off before the microcontroller goes to sleep. This itself saves current because the pins controlling the peripherals will be brought low. Never leave a pin as a floating input because this will draw random currents.

    In a procedure named SetupBeforeSleep(), I disable whatever I can including the peripherals that will never be used on the device, and make any analogue pins digital low:

    Code:
    '
    ' Set the PMD registers to reduce power consumption by disabling unused peripherals
    '
        PMD0 = cFVRMD_Off | cHLVDMD_Off | cCRCMD_Off | cSCANMD_Off                  ' Disable FVR, HLVD, CRC
        PMD1 = cTMR6MD_Off | cTMR5MD_Off | cTMR4MD_Off | cTMR3MD_Off | cTMR1MD_Off  ' Disable all timers except TMR0 and TMR2
        PMD2 = cDACMD_Off | cCMP2MD_Off | cCMP1MD_Off | cZCDMD_Off                  ' Disable DAC, comparators & zero crossing module
        PMD3 = cPWM3MD_Off | cPWM4MD_Off                                            ' Disable PWM3 & PWM4 modules
        PMD5 = cDSMMD_Off                                                           ' Disable DSM module
    '
    ' Note. Cannot disable USART1 before sleep, otherwise it does not re-enable after sleep
    '
        PMD4 = cUART2MD_Off | cMSSP2MD_Off | cMSSP1MD_Off | cCWGMD_Off              ' Disable EUSART2, MSSP2, CWG1 modules
    
        HLVDCON0 = %00000000                                       ' Disable High/Low voltage detection
        Clear WPUA                                                 ' \
        Clear WPUB                                                 ' | Disable weak pull-ups for each port
        Clear WPUC                                                 ' |
        Clear WPUE                                                 ' /
        VREGCON = %00000011                                        ' Voltage regulator in Low power mode in
    Then with a procedure named SetupAfterSleep(), power is sent to the external peripherals and any analogue pins are made digital again etc...

    The sleep is enabled using the sleep command and wakes automatically using watchdog timer, or a button press on the INT0. The device I used was a PIC18F26K40 and has a huge selection of times for the watchdog, so mine goes to sleep, then wakes every 30 seconds because of the watchdog, then does its thing, then goes to sleep again.

    The PMD registers in the above listing are a set of $defines I created to make life easier and teh code easier to understand:
    Code:
    ' Peripheral disabling bits to be ORed into the PMDx SFRs
    '
    ' PMD0 Bits
    '
    $define cIOCMD_Off   %00000001              ' Disable Interrupt-on-Change, All Ports
    $define cCLKRMD_Off  %00000010              ' Disable Clock Reference
    $define cNVMMD_Off   %00000100              ' Disable NVMMD NVM Module
    $define cSCANMD_Off  %00001000              ' Disable NVM Memory Scanner
    $define cCRCMD_Off   %00010000              ' Disable CRC Engine
    $define cHLVDMD_Off  %00100000              ' Disable High-Low-Voltage Detect
    $define cFVRMD_Off   %01000000              ' Disable Fixed Voltage Reference
    $define cSYSCMD_Off  %10000000              ' Disable Peripheral Access Clock Network
    '
    ' PMD1 Bits
    '
    $define cTMR0MD_Off  %00000001              ' Disable Timer0
    $define cTMR1MD_Off  %00000010              ' Disable Timer1
    $define cTMR2MD_Off  %00000100              ' Disable Timer2
    $define cTMR3MD_Off  %00001000              ' Disable Timer3
    $define cTMR4MD_Off  %00010000              ' Disable Timer4
    $define cTMR5MD_Off  %00100000              ' Disable Timer5
    $define cTMR6MD_Off  %01000000              ' Disable Timer6
    '
    ' PMD2 Bits
    '
    $define cZCDMD_Off   %00000001              ' Disable Zero-Cross Detect module
    $define cCMP1MD_Off  %00000010              ' Disable Comparator 1
    $define cCMP2MD_Off  %00000100              ' Disable Comparator 2
    $define cADCMD_Off   %00100000              ' Disable ADC
    $define cDACMD_Off   %01000000              ' Disable DAC
    '
    ' PMD3 Bits
    '
    $define cCCP1MD_Off  %00000001              ' Disable Pulse-Width Modulator CCP1
    $define cCCP2MD_Off  %00000010              ' Disable Pulse-Width Modulator CCP2
    $define cPWM3MD_Off  %00000100              ' Disable Pulse-Width Modulator PWM3
    $define cPWM4MD_Off  %00001000              ' Disable Pulse-Width Modulator PWM4
    '
    ' PMD4 Bits
    '
    $define cCWGMD_Off   %00000001              ' Disable CWG1 Module
    $define cMSSP1MD_Off %00010000              ' Disable MSSP1
    $define cMSSP2MD_Off %00100000              ' Disable MSSP2
    $define cUART1MD_Off %01000000              ' Disable EUSART1
    $define cUART2MD_Off %10000000              ' Disable EUSART2
    '
    ' PMD5 Bits
    '
    $define cDSMMD_Off   %00000001             ' Disable Data Signal Modulator
    Forget the nonesense in the datasheets for sleep currents, they are a fantasy with the microcontroller doing nothing whatsoever, and powering nothing. The least I could do was 2 uA, but that was because some of the peripherals could not be powered off. i.e. the RTC, and some were disabled with their EN pins etc...

    But even 2uA is an excellent current when asleep.

    Depending on how long the microcontroller is awake and doing its thing, depends on how fast you want to run it. If it is just taking a few sensor reading then some calculations, the faster the better because the microcontroller can go back to sleep faster, as long as the sensor has a fast response. Or use the internal oscillator and switch frequencies on the run. Once asleep, the main oscillator is disabled anyway, so it draws no curent.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,864
    Thumbs Up
    Received: 54
    Given: 96
    Total Downloaded
    1.37 GB

    0 Not allowed!

    Default Re: High speed and sleep vers slow and steady Current consumption

    Thanks for the suggestions, well worth remembering

    In my case there are parts of the device that need to be left active. The LCD driver (HT162x). There is a Load balance ADC (HX711) that runs on its own clock at a 10hz sample period.

    One thing in my case is its not meant to be micro powered. The biggest factor in saving power is stuff like back lights. On a handheld temp meter I developed the biggest current was the PT100 chip, There are 2 and they take 4ma a sample each. One feature I added was a analogue 20ma dial gauge. It was really handy working out what was going on in my code. The biggest total draw was the DC DC step up from the 2 x AA batteries. No way I could get around it as the case dictated 2 AA's.
    What I was looking for was getting the battery life up around the 400 hour range.

    Thanks Les on confirming the speed through the calcs and back to sleep theory. I'm going with that.

    Tim
    Tim

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. How to get very low power consumption in sleep mode
    By SimonJA in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 27th March 2015, 21:31
  2. Slow down oscillator to reduce current
    By geoff_c in forum Proton Plus Compiler v3
    Replies: 8
    Last Post: 12th March 2014, 07:21
  3. [SOLVED !] Shin and Shout speed is too slow
    By mhanley in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 6th January 2013, 14:16
  4. Replies: 1
    Last Post: 6th May 2012, 12:14
  5. Current draw 16f883 sleep mode
    By evoortman in forum Proton Plus Compiler v3
    Replies: 35
    Last Post: 6th March 2008, 19:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts