Low Power Wiring Confirmation

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am just about to order a new PCB, but before I order I would like confirmation I have wired up the micro Low Power Crystal correctly.

 

Using the ATmega324P I would like to use the 32kHz low power external crystal, and put the micro to sleep and wake up using an external interrupt.

 

Reading the Datasheet it says "The Oscillator is optimized for use with a 32.768 kHz watch crystal", however reading the forum other people mention they are using just a 32kHz watch crystal.?

 

So I have opted to use a 32.768 kHz watch crystal and connect to XTAL1 (with a 18pf cap) and XTAL2 (with a 8pf cap), page 35 on the datasheet.  Have I read this correct?

 

Lastly one other question, when the micro wakes up on the interrupt, can a 100kHz I2C device be run on a 128kHz internal clock or would I have to use a something like a 1MHz clock?

 

Look forward to your reply.

 

Thanks,

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why would you want to run at 128 kHz?

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another question, why run at 32khz?  What voltage are you running teh AVR at anyway?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

Currently the AVR runs at 4Mhz using an external crystal and is supplied with 3.3V, but the power consumption is to high.

 

To reduce my power consumption, I was going to run a 32kHz external crystal and put the micro to sleep when it is not being used.  When an external interrupt is fired, the micro will wake up and run on the internal clock.  I have read some people running the standard 8MHz on wake up, but I guessed this will be in power hungry mode again.

 

The 128kHz was just question, I was unsure if it was possible to run that slow on the internal clock and save more power.

 

Thanks.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If operational speed is not an issue then why not just use the internal oscillator during operation, and if you are not doing anything else during sleep do you really need the 32khz clock?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
I have read some people running the standard 8MHz on wake up, but I guessed this will be in power hungry mode again.

In broad terms, in a sleeping app, you will draw less power by awakening, running fast, get the needed work done, and get back to sleep faster -- versus plodding along.  The "hare" is more efficient than the "tortoise".

 

There might be exceptions, or situations where it comes out even.  But not usually.  And a watch crystal is an extra part...

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

The reason I am using the external 32khz crystal/ clock, is because the micro will not wake up from an external interrupt on the internal clock.  Have I got this wrong.  I understood in sleep mode, an external crystal had to be used to wake up from sleep & external interrupt?

 

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
The reason I am using the external 32khz crystal/ clock, is because the micro will not wake up from an external interrupt on the internal clock. Have I got this wrong. I understood in sleep mode, an external crystal had to be used to wake up from sleep & external interrupt?

 

The short answer is "don't use external interrupt" -- use pin-change interrupt to awaken.  That is active in all sleep modes.

 

(and also note the use of low-level interrupt to awaken.  Old-fashioned, but it works.  Remember that it keeps triggering so you have to turn it off in the ISR.)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you need accurate timekeeping while in lowest-power sleep?  If not, there's no need for the 32 kHz crystal.

 

As for power consumption, it is almost always better to run fast for a shorter time then sleep for longer, than it is to run slow for longer then sleep for less.

 

Perhaps if you explained what your app will be doing, for which parts of that it needs to be awake, and for which parts it can afford to be asleep.

 

If it were me, I'd run a battery operated app at 4 MHz when awake, and go into power-down or power-save whenever I could.  At 4 MHz an AVR can run at 1.8V.  It doesn't get better with lower speed.

 

The only exception might be when running off of something like a CR2032 which has a significant internal resistance.  Higher cpu clock speeds will increase instantaneous load on the battery and result in a greater voltage drop.  That is, while the AVR can run at 4 MHz at 1.8V, if the CR2032 is near the end of its useful life, drawing the higher current associated with a higher clock speed a 2.0V CR2032 might dip below 1.8V under that load, whereas the lower draw from running at 1 MHz might keep it above 1.8V.  But this is 'blood-from-a-stone' territory, and can be managed in software.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
Using the ATmega324P ...

 

If indeed on a quest for milliamps and microamps, do you realize that a '324P draws about twice as much power when active as a '324A or '324PA would?

 

Arbitrarily, see 1MHz and 3.3V below...

 

 

At 4MHz and 3.3V, it is more than twice -- ~5mA vs. ~2mA:

 

 

Power-down current is about twice as much as well.

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK good information.

 

So my device will wake up when a motion event occurs which triggers the interrupt to process the data.  It will only be awake for about 20 seconds whilst the data is being saved.  Then it will go back to sleep.

 

I have used both INT0 and INT1 which both can be configured as external interrupts and Pin change interrupts, so I have this part right.  Thanks theusch.

 

I have changed my PCB to use the external 32kHz crystal now and 3.3v.  Its quite a mission to change all to 1.8V and 4Mhz crystal.  

 

Generally speaking this is an ongoing project, so If I make board 1 using a 32kHz crystal running at 3.3V, waking up to 8MHz, and on board 2 using a 4MHz crystal running at 1.8V, waking up to 8MHz.  Would there be much difference in power consumption or very negligible?

 

Thanks again for your input.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, yeah, you not only save power, but you save a buck as well...

 

Qty. 100 Mouser prices, -AU package:

'324P:  $5.46

'324A:  $4.19

'324PA:$4.47

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

So looking at those figures,

 

1) external 32kHz crystal running at 3.3V, waking up to 8MHz is OK

 

2) external 32kHz crystal running at 1.8V, waking up to 8MHz is OPTIMUM

 

Do you agree?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
Its quite a mission to change all to 1.8V and 4Mhz crystal.

???  Where did this crystal come from?!?  I thought the first posts talked of internal oscillator and then changing to watch crystal.

 

In general, you don't want to use external crystal in a power-sensitive app.  It will not be as power efficient when active, and has very slow wakeup time.  (and those couple milliseconds count)

 

Now, if you need accurate timekeeping in your sleeping app, then use the watch crystal on timer2 and at least periodically recalibrate your internal clock.

 

Tell more about the 20 second wake time.  Are you processing full-bore that entire time?  I'd guess not.  An approach when waiting for stuff to happen, if your app has e.g. internal timer tick of e.g. 10ms, is to make a main loop pass and then go to Idle mode until the next interrupt. 

 

I can't see where using the internal oscillator causes any board rework.

 

Now, in the last post you talked of two different scenarios, 1.1V and 3.3V.  1)  Can't you go to the same datasheet pages I'd use to answer that?  and 2) what power source are you using?  Apparently not battery?  And if not battery, it may well be that your regulator circuit losses are bigger than the AVR draw.

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have changed my PCB to use the external 32kHz crystal now and 3.3v.

Hang on.  Are you using the LF crystal as a system clock?  Or for the asynchronous TIMER2?  For the latter, place the crystal on TOSC1/2 instead of XTAL1/2.  The rest is only fuse settings and software.  MUCH better to run from the 8 MHz internal oscillator (divided down to 4 MHz if low-voltage operation is desired), but derive an accurate clock from the 32.768 kHz LF crystal.

 

EDIT: typo

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Sat. Jan 30, 2016 - 03:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
So looking at those figures, 1) external 32kHz crystal running at 3.3V, waking up to 8MHz is OK 2) external 32kHz crystal running at 1.8V, waking up to 8MHz is OPTIMUM Do you agree?

I'd need to know what the watch crystal is for...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Previously I had a 4MHz external crystal as my main system clock on pins 7 & 8 on the TQFP44.

 

In my moment of madness I thought I could swap the 4MHz for a external 32KHz Low Frequency Cylinder Watch Crystal and all my power problems would be solved.  I have not used any internal clocks yet, as I am still in development and I have not ordered my PCB yet.

 

My device is 3.6V battery powered and I have a main 3.3V regulator running numerous IC2 and SPI etc devices, so I thought I would save space and run everything at 3.3V.  Some of the devices will not run down to 1.8V and I am short on space on my PCB so I cannot add anymore regulators.

 

I am not using any timers, my device starts up from and interrupt, executes some takes, then a few msdelays are added then it shuts down into sleep mode.

 

So to conclude, I am a bit lost now.  What is the best approach using 3.3V for low power.

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

The only reason I have used an external clock is because on Microchip the internal clock used to go out of calibration with temperature and the RS232 would stop working.  I fitted an external 4MHz crystal and this problem stopped.  So the honest answer is because I have always used external crystals.  Probably a bad habit, and this was my reason.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is your 3.6V battery a LiPo?  It will drop as low as 2.7V while discharging.  Is your 3.3V reg an LDO reg?  What's the dropout at your designed current?  What else is drawing power?  How much is that?

 

The 324 has a 'speed grade' i.e. a chart which describes the fastest it can run for a given Vcc.  At 2.7V, the fastest it can run is 8 MHz.  With your reg's dropout, the 2.7V from your battery may result in 2.5V or less.  You must manage that, and the speed of your AVR.
 

 

EDIT: typo

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Sat. Jan 30, 2016 - 03:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is the regulator.

 

I think it meets those requirements.  This is all a new area to me, so I am still learning.

 

http://www.microchip.com/wwwprod...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
My device is 3.6V battery powered and I have a main 3.3V regulator running numerous IC2 and SPI etc devices, so I thought I would save space and run everything at 3.3V.

Take a deep breath.  ;)  Make a target/goal:  "I want this app to run off an XYZ n.mV battery as the power source.  That has a capacity of 1234mAH.  I want to battery to last abc days."

 

Now there is a target, and a simple calculation gives the allowed average power draw.

 

1)  I'll wager that your regulator loss over time will be larger than the AVR draw.  So even if you make your AVR draw no power at all, the target/goal might not be reachable.

 

2)  As pointed out, your chosen model draws multiples of the power that compatible and less expensive models do.

 

3)  From general experience:  If at all possible, ditch the regulator and run directly from the battery.  I'd guess none of your devices are going to drop dead at 3.6V or 3.65V.  If that is really a problem then use a Shottky diode drop.

 

4)  From general experience, ditch the crystal.  discussed above:  More power and slow wakeup.

 

5)  IT TAKES NO BOARD CHANGES TO RUN FROM THE INTERNAL OSCILLATOR AND TRY STUFF OUT.

 

Once the gross stuff above is out of the way, then you can start tuning the power budget.  It isn't too interesting to me to continue and try to achieve e.g. 25% savings, when using the A version gives 50% savings.

 

For details of what I mean by "power budget", this post https://www.avrfreaks.net/comment... has links to prior threads with a "worked example".  I suggest you do the same.

 

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Fri. Jan 29, 2016 - 09:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK I will go away and crunch some more numbers and come back to you.  I am glad to see you have all been up the li-ion battery route.  I did think of going the shottky diode route but I want to charge the battery in the device, and not remove.  The I2C device must not go over 3.6V else it will destroy itself.  So this was the reason for the 3.3V regulator.  

 

OK back to the drawing board.

 

Thanks again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I assume you have a really good ammeter to measure these low currents accurately?

 

Theory is great, but at some point one has to actually measure the performance of the device on the bench.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
I assume you have a really good ammeter to measure these low currents accurately?

 

Indeed, that is tricky.  We have decent Fluke meters for bench work.  When down at a few uA, reversing the ammeter leads gives a different reading.  And the series R of the meter's sense resistor on the uA scale (IIRC it is like 40 ohms) can affect the readings when using a wimpy little battery and invoking e.g. a wireless send that draws some mA.

 

So we'll work on the uA/sleeping part separately till that is "right".  Then work on the mA/active part.

 

If you follow the power budget link above, you'll find that in a fairly active system, several/many wakeups and transactions per hour, once you have the sleeping current down into the low uA it is insignificant in the overall scheme.  (My rule-of-thumb:  Once you have the sleeping current at or below the battery's leakage rate, fuggedaboudit and move on.)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.