Would like advice on feasible low power targets

Status
Not open for further replies.
Ok, great!

Just to make sure I understand...
Every time it enters loop() it will go to sleep

and every time the interrupt gets triggered it wakes up, but after the interrupt is completed, the next loop() that is entered it will go back to sleep?
 
yep anytime you call 'sleep()', 'deepSleep()' or 'hibernate()' it will go into lowpower (sleep) mode.
 
Wow, that almost sounds TOO easy! I guess I was over-thinking this.

I remember when low power modes for the teensy seemed like a far-off dream. Now it's almost as easy as using delay(msec).
 
Well I must say that using IntervalTimer and 'sleep()' won't work as expected, i guess I should said this earlier. When going to 'sleep()' the bus is 2MHz so some IntervalTimer register values will be wrong. This can fixed by resetting the register values before sleeping to get the correct timing. I'll put an example up later today to show you a way to do that.
 
Thank you.

Is there an advantage to using sleep() if the teensy is set to run at 2MHz to begin with? Like is the bootloader powered down during sleep?

And just so I know what to expect, will USB still work (if at 24MHz or above) whenever it is awake? Any complications around that?
 
Well I must say that using IntervalTimer and 'sleep()' won't work as expected, i guess I should said this earlier. When going to 'sleep()' the bus is 2MHz so some IntervalTimer register values will be wrong. This can fixed by resetting the register values before sleeping to get the correct timing. I'll put an example up later today to show you a way to do that.

If you get around to this, I'd be interested.

With T3.2,
I tried 2MHz, but my sketch failed, maybe the interrupts couldn't finish in time.
I tried 4MHz, it works but the sensor is a little noisy.
8MHz and 16Mhz aren't allowed with the ADC library.
I tried 24MHz, it works and the noise is gone.

I noticed that for T-LC, there is no option below 24MHz.
 
The datasheet says LPO could be off by as much as 10% (100,000 ppm). I've measured LPO frequency error on 10 or so teensy's, and worst I saw was 18000 ppm (18 ms on 1khz)

Oh, that's a lot of error. Is there a feasible way to compensate for the error? Will the error always be the same, or is it variable?
 
Oh, that's a lot of error. Is there a feasible way to compensate for the error? Will the error always be the same, or is it variable?
I don't think there is any hardware calibration to correct the LPO frequency. It varies from chip to chip, so you might be able to do some software calibration. With my testing, using an ISR gets far worse frequency error, because I had to disable LPTMR, clear TCF flag and restart timer, which loses ticks?? my LPO measurements were from a free-running LPTMR/LPO. The anecdotal frequency data is at
https://github.com/manitou48/crystals/blob/master/crystals.txt
Temperature could affect LPO frequency.
 
If you get around to this, I'd be interested.

With T3.2,
I tried 2MHz, but my sketch failed, maybe the interrupts couldn't finish in time.
I tried 4MHz, it works but the sensor is a little noisy.
8MHz and 16Mhz aren't allowed with the ADC library.
I tried 24MHz, it works and the noise is gone.

I noticed that for T-LC, there is no option below 24MHz.
Are you just changing the cpu speed in the Arduino IDE? Did you try to use the ADC library in the loop function at those speeds to see if there is still the noise?
 
I removed the ADC stuff, and the sketch works at 2MHz. The ADC stuff was only sampling 2 pins in an interrupt at 25Hz and placing in a buffer. I could reduce it down to 8-bit samples to try and speed it up. I forgot about the other ADC settings that could help. Maybe I'm better off not using the ADC library?
 
I inadvertently was using the built-in analogRead() function, and wasn't actually calling the adc library. It runs a little longer before locking up at 2MHz, but still has problems unless I move it to 4MHz or higher. Changing the ADC clock didn't have much of an effect.

Here's the relevant ADC setup code:
Code:
    adc = new ADC();
    pinMode(EXT_SPO2_PIN, INPUT);
    pinMode(EXT_PPG_PIN, INPUT);
    adc->setAveraging(1); // set number of averages
    adc->setResolution(8); // set bits of resolution
    // it can be ADC_VERY_LOW_SPEED, ADC_LOW_SPEED, ADC_MED_SPEED, ADC_HIGH_SPEED_16BITS, ADC_HIGH_SPEED or ADC_VERY_HIGH_SPEED
    // see the documentation for more information
    adc->setConversionSpeed(ADC_VERY_HIGH_SPEED); // change the conversion speed
    // it can be ADC_VERY_LOW_SPEED, ADC_LOW_SPEED, ADC_MED_SPEED, ADC_HIGH_SPEED or ADC_VERY_HIGH_SPEED
    adc->setSamplingSpeed(ADC_VERY_HIGH_SPEED); // change the sampling speed

What kind of power usage can I expect from teensy at various MHz? I tried searching but couldn't find the info although I think I've seen it before.
 
I found those posts but there's no info on below 20MHz, or either it was about special power down modes.

I'm using onehorse's charging circuit which I imagine bypasses the voltage regulator. Is it comparable to the murata product?

It uses this:
http://www.st.com/en/power-management/stbc08.html

Not sure what you mean by onehorse's charging circuit.
That chip is designed to take in 4.25 - 6.5V and output a constant 4.2V @ whatever current limit you set, it is a linear device.
 
Yeah sorry I didn't provide much info:
This is the one I'm referring to:
https://www.tindie.com/products/onehorse/stbc08-high-current-lipo-battery-charger/
2015-08-29T22:03:43.948Z-STBC08Front.jpg

A lipo battery is the power source for the teensy. But I'm not sure if the power is delivered to the 3.3V input or the normal USB power source. That's probably important considering what you said.

edit: It doesn't look like I could power the murata chip with a lipo as it requires 7V minimum.
 
Yeah sorry I didn't provide much info:
This is the one I'm referring to:
https://www.tindie.com/products/onehorse/stbc08-high-current-lipo-battery-charger/
View attachment 9946

A lipo battery is the power source for the teensy. But I'm not sure if the power is delivered to the 3.3V input or the normal USB power source. That's probably important considering what you said.

edit: It doesn't look like I could power the murata chip with a lipo as it requires 7V minimum.

I wasn't sure what you where using, the murata is my go to when I need a drop in replacement for an lm7805.

The Onehorse circuit will charge the lipo when USB power is present and will power the teensy from the lipo when it is not connected to use. The lipo has a Voltage Range of 3.7 to 4.2V, the Teensy has a Vin range of 3.7 to 5.5v. A fully charged lipo at 4.2V and a load of say 20mA will be 84mW total with 66mW going to the Teensy (78.6% efficiency). The other 18mW will be lost. Sadly at such low power levels many buck regulators wont do much good. I did see a few that had greater then 92% efficiency at 20mA.

Digikey List i got after a few minutes of adjusting needs. I guess it comes down to how much losses your willing to allow and how much effort in savings you are willing to work for. A 10% savings may or may not be useful, you have to find out what your low power and high power needs are then take a look at the efficiency's of several chips to find one that gives you a good overall savings.
 
Status
Not open for further replies.
Back
Top