View previous topic :: View next topic |
Author |
Message |
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
Reducing power consumption during sleep |
Posted: Fri May 01, 2020 7:01 pm |
|
|
Hi
PIC12F1840
CCS PCM C Compiler, Version 5.062
I am working on a alarm system using the above PIC. It is usually in sleep mode except wake-up in case of the external interrupt triggered by the sensor.
I don't have pull-up resistor on the pin as the interrupt is L to H.
The program works as expected, but:
A regular square 9V alkaline battery get to end of life after 130 hours. Not feasible
I am testing now with 3*AA alkaline batteries so I eliminated the voltage regulator as I know is also taking power even with very low power consumption.
During wake-up (for 10 seconds) I am enabling the ADC to test the battery,
no conversion during sleep.
My questions are:
1. Disabling the MCLR~ internal pull-up resistor is a bad thing?
2. Making all the pins input before sleep will reduce power consumption?
3. What else I can do to reduce the PIC power consumption during sleep?
From my testing and reading by the internet, the sensor connected to the PIC consumes 5 to 10 uA in idle. I have to state that my capability to test
accurately the current is very low.
Best wishes
Joe |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Fri May 01, 2020 7:09 pm |
|
|
Somebody correct me if I'm wrong but I believe setting pins as input will actually take more power. Instead unused pins should be set to output low. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Fri May 01, 2020 7:20 pm |
|
|
dluu13 wrote: | Somebody correct me if I'm wrong but I believe setting pins as input will actually take more power. Instead unused pins should be set to output low. |
Low or high, doesn't really matter as long as it's not left floating as an input. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9269 Location: Greensville,Ontario
|
|
Posted: Fri May 01, 2020 7:54 pm |
|
|
Check the Microchip website for a really old(20+ years) Application Note about 'power consumption. Maybe AN669 ? Wish I still had real databooks.. it's a few pages long has a LOT of data about clock speeds,powerup times, and coin cell battery life. It's really a 'must read' for all 'ultra low power' applications.
If there's an 'L' version of that PIC...check the datasheet ! could be X10 better or more for reduced power. Clock speed...slower is better though the Ap Note tests showed go slow, then fast(to do math ),then slow saved energy.
I've got a Radio Shack LCD clock module here still running on 2 AA alkalines, better part of 30 years and accurate....
Ok it took a bit of googling....but
AN606B is the apnote I've been thinking about...
Even though it's old...it's a 'must read'.
I assume there's newer info butthis is the one a memebr reading in a DATABOOK, about 2" thick.......
Jay
Last edited by temtronic on Sat May 02, 2020 2:57 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Reducing power consumption during sleep |
Posted: Fri May 01, 2020 9:13 pm |
|
|
gjs_rsdi wrote: |
The program works as expected, but:
A regular square 9V alkaline battery get to end of life after 130 hours.
From my testing and reading by the internet, the sensor connected to the PIC consumes 5 to 10 uA in idle. I have to state that my capability to test
accurately the current is very low.
|
1. Measure the total board current.
2. Measure the PIC's current alone.
Do each measurement when the PIC is sleeping, and when it's running.
Tell us what you got.
Also, set all unused i/o pins to output low. It's safer than output high.
When they are low, they won't provide a current source if touched by
something accidentally.
Describe the circuits on each PIC pin, including component values and
chip names. Tell us what you are doing with each PIC pin during sleep.
I want to know if you setting a pin to output low when you have a pullup
resistor on it (internal or external), when in sleep mode.
Also, tell us how long you would like the batteries to last. And down to
what voltage level ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19589
|
|
Posted: Sat May 02, 2020 12:41 am |
|
|
Key thing not mentioned.
If he is using a 9v battery, he will be using a regulator to drop to the
5v needed by the PIC.
In general most basic regulators will draw hundreds of times the current
needed by the PIC....
If you want low power, you need to be using ultra low power regulators.
A TPS783, versus a 78L05, reduces regulator consumption massively.
A 7805, has a quiescent of about 5 to 8mA.
A 78L05 about the same.
A 78LC05 drops this to 1.1uA.
A TPS430 takes this down to under 500nA.
In each case a linear regulator is also inefficient. I mA drawn by the target
implies slightly more than 1mA into the regulator. For efficiency a
switching regulator is needed, but again an ultra low power type.
A switcher like the TPS62743 (there is also a Motorola, and a Maxim
unit with even less consumption).
Generally the 9v battery will be rated at perhaps 400mAh. If the regulator
is drawing a couple of mA, it'll run down in only a couple of hundred hours,
whatever is done to the PIC.... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Reducing power consumption during sleep |
Posted: Sat May 02, 2020 1:57 am |
|
|
gjs_rsdi wrote: |
I have to state that my capability to test accurately the current is very low.
|
That's a requirement. You need to get a multimeter that can read low current. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Sat May 02, 2020 2:07 am |
|
|
Thank you everyone that posted.
As I mentioned in my first post, the boards run now on 3*AA alkaline batteries, it gives a maximum of 4.79 volt when I started testing endurance.
The reason for the change from 9V is the current of the voltage regulator itself.
After 24 hours the 3*AA batteries are giving 4.55 volt.
RA0 is output low when in sleep, when no sleep output H/L to a LED via 560 ohm resistor.
RA1 is analog input via 510 ohm resistor and have 100nF capacitor to the VSS
RA2 is input from HC-SR501 PIR. Data sheet says works from 4.5 volt VCC and up, from my testing works at 3.9 volt also. I am testing now how low the VCC can be.
RA3 is input MCLR with the internal pull up.
RA4 is output low in sleep, output high if not in sleep.
RA5 is output low, not used
I made the current consumption test as PCM Programmer suggested, I have now a multi-meter that goes down to 200uA.
Sleep mode:
Without sensor 103uA
With sensor 169uA so sensor in idle consumes 66uA.
Active mode: 9.5mA for 10 seconds
The AA battery is rated at 800mAH when discharged at 100mA to 1.1 volt per cell.
So at sleep the 3*AA batteries will last around 200 days down to 3.3 volt
If the sensor will not work at lower VCC than 3.9, to this level the battery is rated 200mAH, the batteries will last for 49 days.
I will be back with the final results, I suppose will take long time.
I will buy (if available here) the TPS430 that Ttelmah proposed, will try also with LP2950 and see the results as I would like to work with the 9 volt battery because the small size and price, they cost here 25 cents (if the endurance will be around 60 days)
I want to thank everyone who contributed to this topic
Best wishes
Joe |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 02, 2020 3:53 am |
|
|
gjs_rsdi wrote: |
I made the current consumption test as PCM Programmer suggested,
I have now a multi-meter that goes down to 200uA.
|
The front panel range may say 200uA, but typically meters with that
setting can read down to 0.1 uA (100 nA).
gjs_rsdi wrote: |
Sleep mode:
Without sensor 103uA
|
Do you consider that acceptable ? The 12F1840 datasheet shows
the power-down current for the PIC is typically 0.5 uA with a Vdd of 5v.
See page 310 of the datasheet. Look at D022 in the gray section,
3rd row, in the Typ column for Vdd 5v:
http://ww1.microchip.com/downloads/en/DeviceDoc/40001441F.pdf |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Sat May 02, 2020 5:05 am |
|
|
Hi PCM Programmer.
I wrote that 103uA is acceptable because the time that the battery will last.
After reading the part of the data sheet you told me I understand that with all the peripherals disabled I will have a current of 0.5uA during sleep. But I have BOR enabled 8uA and the weak pull-up resistor on the MCLR pin typical 140uA.
I can't have MCLR enabled without the resistor I think.
Thank you PCM Programmer
Best wishes
Joe |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19589
|
|
Posted: Sat May 02, 2020 11:54 am |
|
|
The weak pullup, draws nothing, if the pin is not pulled down, It only draws
it's current when current is drawn on the pin. You should not be measuring
103uA.
Look at the data sheet:
Quote: |
To minimize current consumption, the following conditions
should be considered:
• I/O pins should not be floating
• External circuitry sinking current from I/O pins
• Internal circuitry sourcing current from I/O pins
• Current draw from pins with internal weak pull-ups
• Modules using 31 kHz LFINTOSC
• Modules using Timer1 oscillator
|
Weak pull ups is the fourth line.
Something you have is drawing power from the chip.
An I/O pin taken to a level that draws power would be the obvious one. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Sat May 02, 2020 1:38 pm |
|
|
Hi Ttelmah
I will make again some tests and see what can I do.
Will be back with the results.
Best wishes
Joe |
|
|
alan
Joined: 12 Nov 2012 Posts: 357 Location: South Africa
|
|
Posted: Mon May 04, 2020 3:15 am |
|
|
Quote: | RA1 is analog input via 510 ohm resistor and have 100nF capacitor to the VSS |
What are the value of the resistor to the battery voltage. If you use the same value as when measuring 9v, I suspect you have 1k ohm resistor.
On 4.5v that alone will draw nearly 3mA. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Mon May 04, 2020 6:35 am |
|
|
Hi Alan
As I know the analog input don't draw much current. Also the analog circuit is not working during sleep. As I mention in my previous post, I will make an additional test to see how much current I have in sleep mode. Can't be 3mA as I am measuring 103uA
Best wishes
Joe |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19589
|
|
Posted: Mon May 04, 2020 7:34 am |
|
|
Tell us about the sensor. Part number?. |
|
|
|