CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Reducing power consumption during sleep
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
alan



Joined: 12 Nov 2012
Posts: 349
Location: South Africa

View user's profile Send private message

PostPosted: Mon May 04, 2020 9:43 am     Reply with quote

gjs_rsdi wrote:
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


I agree, so that means you disconnect the resistor set from the supply when you enter shutdown mode.
Quote:

............... Analog in ----> Virtually no current during sleep
....................|.......................
Bat --Res1------Res2---VSS ----> This part of the circuit will draw power unless you disconnect the positive side
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon May 04, 2020 9:51 am     Reply with quote

I think he is not measuring the supply.
I think he is saying that he has an analog output from the sensor
feeding via a 510R resistor to the analog in, which then has a capacitor
to the Vss. Presumably trying to reduce noise from the sensor.
However some sensors will not like having a capacitor like this on their
output. Also a lot of sensors will not have the required output impedance
to drive the ADC. Hence my question after the part number of the
sensor....
alan



Joined: 12 Nov 2012
Posts: 349
Location: South Africa

View user's profile Send private message

PostPosted: Mon May 04, 2020 10:05 am     Reply with quote

Hi Ttelmah.
You're probably correct, but this was in the OP's 1st post.
Quote:
During wake-up (for 10 seconds) I am enabling the ADC to test the battery,
alan



Joined: 12 Nov 2012
Posts: 349
Location: South Africa

View user's profile Send private message

PostPosted: Mon May 04, 2020 10:12 am     Reply with quote

Ttelmah made me look at the thread again Rolling Eyes
The following also stand out:
Quote:
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.

Don't. Use the LF version then you can run at 3.3V or lower
Quote:
RA3 is input MCLR with the internal pull up.

Been bitten with this one in noisy environment, use proper pull up resistor. Internally is something like 100k ohm.

Regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon May 04, 2020 10:25 am     Reply with quote

Yes. I hoped he was doing this by the ratiometric method, using the
FVR. You use Vss to Vdd for the ADC Vref, then read the FVR using
the ADC. Using the 2.048v setting, the supply voltage is then:

Vdd = (Reading/2.048)*1024

The only caveat with this is you need to turn the FVR off when
not reading.

If he is using a resistor divider off the supply, the as you point out
this divider needs to physically be turned off, or it'll be wasting a
huge amount of power....
alan



Joined: 12 Nov 2012
Posts: 349
Location: South Africa

View user's profile Send private message

PostPosted: Mon May 04, 2020 11:21 am     Reply with quote

But don't you then only measure the output of your voltage regulator instead of actual battery voltage?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon May 04, 2020 12:22 pm     Reply with quote

If you look, he is not now using a voltage regulator. Direct drive
off three cells.
If he is using what was his 'original' circuit, then the caveats you
raise definiately do apply....

I think there is a general trend here. First, lack of actual data. Then a lack
of understanding that for low power, you need to switch everything off
internal to the PIC, and external.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Mon May 04, 2020 3:30 pm     Reply with quote

The sensor is HC-SR501
Sales here at around $1

Below the link to one datasheet, you may find other data sheets by the internet
https://www.mpja.com/download/31227sc.pdf
The sensor output is digital and not analog.
From my testings, the detection angles are bigger than stated.

Working with the 9V battery I was measuring the battery voltage before a Schottky diode. The circuit is supplied after the diode. Because of the resistors I used to feed maximum 5v to the controller ADC (27K to 9V, 33K to GND) the power consumption was increasing.
The controller is not working in noisy environment so the internal pull up on the MCLR is just fine from what I learned on the forum.

I have to read the data sheet again and see if the Vref 2.048 remain stable while the VDD changes so I may change to 3*AAA batteries, no voltage regulator same as now with 3*AA.

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue May 05, 2020 12:34 am     Reply with quote

That is a 'product description', not a datasheet.
For a datasheet, you need to pull the ones for the sub components
of this module. The BISS0001, the LHI778, and the 7133-1.

For reading the supply on the PIC, Sequence needs to be to power up the
Vref, then the ADC, pause for a moment, then take the reading, then
power down the ADC and the Vref.
Every peripheral you use needs to be switched off when not used, for
low power....

Have to agree wholeheartedly with Alan here. The IC in the sensor, draws
about 50uA at 3.3v.The chips are rated to run down to 1.8v.
The LF version of the PIC itself draws less current, and also runs down to
1.8v.

Then get rid of the voltage regulator on the module. The module is built
to be able to run off a wide range of supplies, and has a voltage
regulator to run the PIR. This has a quiescent consumption of about
2.5uA. Another unnecessary waste.

With the whole system run of 3v, without voltage regulators, you
should be down at perhaps 75uA, with the sensor. This will
go up when the sensor is triggered. The consumption will go up by about
44uA when this happens, plus whatever the PIC does at this point. The PIC
should be down at about 16uA when asleep.

The pin that is the input fed from the sensor, needs to be set
as an input. Everything else that is not driven by something, set as
outputs.

There is a query about the module itself. Rb is specified in the TT0001
data sheet to be 1.5MR. They give figures for it at 1.5MR, and 2MR.
It sets the bias current to the op-amp. However the module has
this set at 1MR. Result more current than expected.... It may be they
have seen a stability issue with the chip, but I'd be looking to increase
the resistor to 1.5MR, and see how much it saves (potentially about 5uA).
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Tue May 05, 2020 2:07 am     Reply with quote

Thank you for the explanation Ttelmah.

I mention in the past that the PIR current at idle is 66uA.
I am not enough good in electronics to go forward from the "product description" so I am checking the PIR to see how much lower voltage it will still work.
I am running the board I made with the 3*AA batteries.
Will build a new board and ordered a variable power supply to check how low the PIR will still work.

I just read in the data sheet that the FVR is independent of VDD. I am going to see how to work with it.

Best wishes
Joe
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Tue May 05, 2020 2:35 am     Reply with quote

Hi Ttelmah

You wrote:

Quote:
You use Vss to Vdd for the ADC Vref, then read the FVR using
the ADC. Using the 2.048v setting, the supply voltage is then:

Vdd = (Reading/2.048)*1024

How I can read the FVR?

Best wishes
Joe
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue May 05, 2020 2:57 am     Reply with quote

The PIR runs down to 2v.

To read the FVR, it is adc_channel 31. Already defined in the processor
include file. So:

set_adc_channel(FVR_CHANNEL);

The enable for it is:

setup_vref(VREF_ADC_1v024);

Or

setup_vref(VREF_ADC_2v048);

You turn it off with:

setup_vref(VREF_OFF);

I mis-typed the formula The supply voltage is:

Vdd = (1024/reading)*selectedVref

So with 1.024, and a reading of 317:

Vdd=(1024/317)*1.024 = 3.3v

While with 2.048 selected, you will see a reading of perhaps 634
from the same supply.
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Tue May 05, 2020 4:59 am     Reply with quote

Thank you Ttelmah.

I will start testing with FVR when I have the second board.

Best wishes
Joe
gjs_rsdi



Joined: 06 Feb 2006
Posts: 468
Location: Bali

View user's profile Send private message Send e-mail

PostPosted: Sat Jun 13, 2020 6:05 am     Reply with quote

Hi

Long time from my last post, just got the new boards 2 days ago.
The pins configuration:
Code:
#define TXpin PIN_A0//TX out; at sleep, output low
#define Sensor PIN_A1//PIR sensor input; sensor active 'L' to 'H'
//PIN_A2 AN2 monitoring the battery via 510 ohm resistor; 100nF to GND; when sleep, no adc conversion
//PIN_A3 MCLR, internal pull-up
#define ALARM PIN_A4//active output 'H' for siren & flash light; sleep output 'L'
#define LED PIN_A5//led blink at power up and alarm; sleep output low

3*AAA batteries for power supply.
The power consumption without the PIR sensor is 17uA at sleep.
Code:
setup_vref(VREF_OFF);

Making that before sleep, don't reduce the power consumption at sleep.
The PIR is still on 66uA.
Tested down to 3V, still everything works, I am alerting to change battery at 3.3V.

In the graph of the AAA Duracell Alkaline battery is shown that at 100mA power consumption the capacity is around 830 mAh.
My consumption at sleep including the sensor is 83uA so the batteries will last at least 417 days, acceptable for me.

I would like to thank everyone who contributed to this topic, I learned a lot!

Thank you and best wishes
Joe
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group