Low Power "Green" Battery Operation Solutions For The Teensy 3.

Status
Not open for further replies.
I am working on a project using Teensy 3.0 that requires very low power consumption and the use of the RTC. When I use the library presented here, My RTC isn't keeping track of time well. Is there anything I can do?
 
i assume your using the time library? if so re-sync after sleeping "setSyncProvider(getTeensy3Time)", there is a issue with the time library and sleeping.
 
That fixed it. I was also trying to use Arduino's RTC lib, which wasn't working well. Silly mistake. Thanks for the help.
 
I was waiting on how the mini54 will go into low power before releasing it, but maybe i could and just leave out putting the USB regulator into standby mode.
duff
Using the USB supply is what I'm doing at the moment...also I'm not sure if putting the mini54 into low power will work without some hardware changes?

I'm running the ADC in VLPR mode and put the results together with a timestamp (from millis()) to a SD card using the SD2Fat library. I reach sample times around 500 Hz but putting the data to the card using 512 Byte blocks takes around 24 ms each... The ADC is configured in the slowest mode, maybe this could be further optimized without the need of much more energy. I'm going to supply the teensy be batteries in a next step, also to measure the actual power consumption.
 
just remember that you are only running at 2MHz in VLPR mode, i'm not sure what you would have to do to optimize the ADC.

putting the USB regulator into standby mode doesn't effect powering the teensy through the USB.
 
i've been sitting on this for awhile so i thought i would just go ahead and post it. Added a struct so you can now have multiple wake sources for sleeping and added RTC Alarm and TSI as wake sources also. The GPIO wake pins have been defined as you will see in the examples so make sure you use them instead of just the pin number. Here is the list of changes:

ChangeLog Beta2:
1. Added struct to store sleep configurations
2. Added RTC Alarm wake
3. Added TSI wake
4. Put usb regulator in standby for VLPR
5. Got rid of stand alone LPTMR timer fucntions
6. Cleaned up the library and example codes
7. New examples added
8. Defined GPIO wake pin names

anyway hope its useful and let me know if there are any problems.

duff

View attachment LowPower_Teensy3_beta2.zip
 
@Duff ...
You brought the Teensy 3 power consumption, using your low power library, down from idle of 25.18 ma @ 48 Mhz to ~ 2.5 ma. or ~1000% or
~ 10 times !!!! :):):)
 
@Duff ...
You brought the Teensy 3 power consumption, using your low power library, down from idle of 25.18 ma @ 48 Mhz to ~ 2.5 ma. or ~1000% or
~ 10 times !!!! :):):)

Correction - sorry ... from 28.18 to 6.5 ma. There is still a Mini54 bootloader chip offset (~6.5 ma. ???) that still needs to be resolved???

Like others on this topic, I am also building a low power, high performance Teensy 3 uSD data logger. I found a AA battery powered step up
converter LTC3525-5, Adafruit's uSD breakout, Maxim-IC DS3234 +- 2 PPM precision RTC. By adding a CLI (command line interface) to the
software which executes functions with parameters, this data logger can be setup with any serial data terminal without IDE programming.
 
Last edited:
Like others on this topic, I am also building a low power, high performance Teensy 3 uSD data logger. I found a AA battery powered step up
converter LTC3525-5, Adafruit's uSD breakout, Maxim-IC DS3234 +- 2 PPM precision RTC. By adding a CLI (command line interface) to the
software which executes functions with parameters, this data logger can be setup with any serial data terminal without IDE programming.
sounds cool, are you building your own board for this?
 
sounds cool, are you building your own board for this? .

Yes, we are using the expensive ExpressPCB PCB board service. This is only after thoroughly bench testing the
electronic modules software with the Teensy 3.

What we found out is having two SPI devices eg SPI Adafruit uSD card and SPI RTC DS3234 don't
like to play with each other. It seems the sdFat library hogs the bus and plays havoc with the other chip
selects. <-----<<<< Look Out !!!! :(

http://forum.pjrc.com/threads/17288...ternate-Pin-Functions?highlight=alternate+spi

We decided to nix the SPI DS3234 and drop back to the Maxim-Ic precision I2C DS3231 +- 2PPM or
the DS3232M+ +-5 PPM to provide a precision data logging timestamp.

The layout will include a 8 pin connector, on the bottom of the T3 "carrier board" to hold the Adafruit uSD
breakout board. Since Adafruit added a 3.3 V regulator and SPI noise reduction circuitry, we decided to keep
their breakout board as a plug-in for our data logger. Also, on the "carrier board" layout, will contain
the SCB70 SMT battery boost converter (LTC3525-5) and the precision SMT I2C RTC. The PCB size will be about
the same size as the Teensy 3, which will just plug into the carrier board.

Finding a command line interface (CLI) to run on the Teensy 3 took us a very long time to locate one.
This allows serial commands to setup the uSD and RTC without IDE programming.
http://www.freaklabs.org/index.php/Tutorials/Software/Tutorial-Using-CmdArduino.html

Any spares we make, one will always be reserved for the author of the Teensy 3 low power library. :cool:
 
Last edited:
A beta version of the upcoming low power support is now ready for testing. Over the last week, duff and t3andy have already been testing this version. Things are looking pretty good so far...

Now I'm ready to open the beta test to anyone else who is interested in low power applications and has time to test over the next several days. Please email me directly: paul at pjrc dot com, if you're interested?

This new version reduces the MINI54 power consumption. Currently it draws about 6 mA in all conditions. This update reduces the MINI54's current to about 0.14 mA while not uploading code, but waiting for an auto-reboot request from the Arduino software. It also adds detection for the MK20 sleep modes. When the MK20 enters a sleep mode, so will the MINI54, reducing the MINI54's current to about 6 uA.

In this beta test, aside from verifying the power savings, the main thing we're testing is if the MINI54 always wakes back up properly. While in the 0.14 mA mode, it should be able to detect a reboot request (no need to press the button). Once it enters the deep 6 uA sleep mode, the only way to return to uploading is with a pushbutton press. In particular, this beta test is focused on attempting to discover any low power condition where the pushbutton fails to respond (in theory, no such condition is supposed to exist).

Again, please email me directly if you're able to help test over the next several days. Unless any bugs turn up, my goal is to publish this new version at Teensyduino 1.16 in about week, so please only contact me if you will have time to beta test within the next 5 days.
 
A major Teensy 3 development milestone has been accomplished --> low power / battery operation!
This opens up many new user low power (battery) applications for the Teensy 3.


The T3 low power "deep sleep" quiescent current consumption is now = ~ 250 uAmps <------<<<<<< (was ~ 6.5 ma.) (see notes below)

By fixing the Teensy 3 Mini54 bootloader current offset (Paul S), the "deep sleep" quiescent current depletion went from 14 days to 366 days !!!! (see notes below)
In other words, the T3 will "deep sleep" @ 250 uA quiescent current of battery power, using a booster converter, for about 1 year! (see notes below)

Using 2 2200 mAh AA battery(s) and a Teensy 3 - the "deep sleep" quiescent current depletion = 2,200 mA / 6.5 mA = ~ 14 days <--- previous current

Using 2 2200 mAh AA battery(s) and a Teensy 3 - the "deep sleep" quiescent current depletion = 2,200,000 uA / 250 uA = ~ 366 days <--- current now with fix


Note 1 - Using "Duff's" low power library beta 2
Note 2 - Very rough and crude AA battery depletion calculation - used only as rough estimate!!!! Expect very much lower depletion times due to battery(s) chemistry!
Note 3 - A standard AA Akaline battery(s) discharges at very non-linear rate - see manufacturer battery specs.
Note 4 - Does not take into account for the AA self discharge rate.
Note 5 - AA Alkaline battery discharge (depletion) voltage: 0.80 - 1.00 volts
Note 6 - AA battery total discharge voltage does not produce 100% current depletion!
Note 7 - Does not account for the AA booster converter quiescent current of ~ 20 uA.
Note 8 - T3 "deep sleep" has all pins as inputs or analog in, onboard status LED is off and all GPIO are NOT connected to anything.
Note 9 - Anything we forgot for current draw/consumption goes here. <----<<<< ????

Beta testing is still ongoing ....
 
Last edited:
Please understand this low power improvement is still in beta testing.

The beta test is now open to pretty much anyone with a Teensy3 and willingness to help test this week. Email me directly, paul at pjrc dot com if you'd like to participate.

I want to stress again, this is still "beta". Proper release is at least a week or two away, and obviously it may be farther if the beta tester discover any problems.
 
Last edited:
Glad to see this low power stuff show up!

Wow, What timely great news. I have a project that needs to use the T3 in a battery application and need it to be able to run in low power mode. In our case this was not only to preserve the battery but also because we run the T3 off the battery even when plugged into USB power with the battery being recharged by a LIPO battery charger IC. That charger IC never indicated "full charge" on the battery because of the residual current draw by the T3. Just thought I would mention this in case someone else runs into this.

Also, I typically do current measurements using my multimeter. But I recently bought a EEVblog uCurrent box to help do more accurate current measurements. I first heard about it in article by great author Jack Ganssle:
http://www.embedded.com/electronics-blogs/break-points/4406380/The--Current
There is a good article on why this device is useful, or more importantly some things to be careful of just using your mutlimeter for current measurement, at:
http://www.alternatezone.com/electronics/ucurrent/uCurrentArticle.pdf
In particular it tells how just measuring current wrong can cause your HW to act up due to voltage drops.

So, just wanted to pass along those notes. I'm going to go ahead and try to get into this beta test as the timing is perfect. This Teensy stuff is great.
 
@froeber
To confirm my numbers, please publish, on this board, your test measurements taken from your precision uCurrent box. :D
 
I got the following measurements with the Mini54 update (116) and Duff's library (beta 2). My multimeter is not a top of the line, so the measurements may be off slightly.

Before the update (mA)With the update (mA)
Normal run (RUN)2519
Low power run (VLPR)92
Hibernate (VLLS3)60.13
DeepSLeep (LLS)60.13

According to the datasheet, there seems to be even lower power modes and the utility directory in the Duff's library seems to have the required functions to use them, but these Hibernate (VLLS3) and DeepSleep (LLS) modes are more than enough for me. Great work Paul and anyone else who made the Mini54 update.


During the next couple of days I will be testing out the "DeepSleep" or LLS mode with ChibiOS RTOS with a more complicated project.
 
Last edited:
I have Paul's beta version and will be looking to test it. But I'm trying to set up code for the power mode I want/need to use (VLPS) based on Duff's excellent work. One thing I did note from the Errata sheet for the 1N86B revision of the MK20DX128VLH5 the T3 uses is that there are some errata that pertain to low power. One is "e4590 MCG: Transitioning from VLPS to VLPR low power modes while in BLPI clock mode is not supported." There are workarounds listed to go into RUN mode on exit from VLPS. Also, it anyone is using a debugger, there is errata "e3964 When debug is active a wakeup from STOP or VLPS with interrupt causes a hard fault interrupt." I'm not using debugger so no problem. Finally, errata "e4481: PMC: STOP mode recovery unstable" says to be careful using STOP mode for more than 50msec. They suggest using VLPS which is what I was planning anyways.

Along with Duff's note on there being a useful App Note 4503 for low power operation, I also found App Note 4470 on low power that has more of a focus just on the Kinetis processors we are using. What's nice is that there is a ZIP file with a LOTof support code for the low power demos they do. I found the App notes and other documentation at http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=K20_50&fpsp=1&tab=Documentation_Tab. The link to get the ZIP file with the SW didn't work directly for me but trimming the link to http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4470SW.zip did work.

I'll post numbers on what I get for VLPS when I get it going (and as t3andy requested I'll indicate differences between measurements with straight multimeter vs the uCurrent product I got specialized for power measurements.
 
@Onoki
Normal run (RUN) 25 19
<--- Taken only at 48 mhz ? Other CPU speeds will vary --> higher speed = higher power consumption
Also deep sleep and hibernate seemed "switched" (250 uA for deep sleep)
 
The achieve the lowest power, one thing to consider is the configuration of pins 18 and 19. These 2 pins should be configured as INPUT_PULLUP or OUTPUT mode, or have a logic high or low externally applied.

By default, Teensy3 pins are disabled until you use pinMode() or they're configured for a peripheral. That's great for low power, since they can't draw current if the voltage on the pin is undefined.

However, pins 18 and 19 also connect to the Mini54 chip. Random floating voltage on those 2 pins can cause extra current consumption in the Mini54.

Just using pinMode(18, INPUT_PULLUP) and pinMode(19, INPUT_PULLUP), if those pins aren't connected to anything, will prevent any issue.
 
@duff
I'm looking at the code in mcg.c for VLPR_PEE_BLPI(). At the end it "fixes" the SYSTICK rate. I think there is a problem with that code. In Paul's ResetHandler initialization code he set up SYST_RVR = (F_CPU / 1000) - 1 so that it generates 1 msec interrupts. I think all you need to do in your code is change it to SYST_RVR = (2000000 / 1000) - 1 since in BLPI mode you are running at 2 MHz.
 
@Paul S
Speaking of low power ...
Using the Teensy 3 SPI with low power is OK but could you put a solder-bridge jumper on the Teensy's 3 on-board LED so it could be configured to be enabled or disabled? It draws a whooping 2-3 ma. of un-necessary power when using SPI (uSD / sdFat) I hate to remove this LED everytime for low power.
 
Taken only at 48 mhz ? Other CPU speeds will vary ... Also deep sleep and hibernate seemed "switched"
Yes, at 48 MHz. I probably should have mentioned that. I also measured the currents again. There must have been a mistake yesterday. Now it seems to be the same on both modes.
 
@onoki
This is what I got from our logger project ..
.
Low power
Teensy 3 Active Mode Test:

Before software bootloader change ...
Downloaded program: "blank.pde"
Teensy 3 active run (idle) current Is 19.29 ma. @ 24 Mhz <-------<<<<<
Teensy 3 active run (idle) current Is 25.18 ma. @ 48 Mhz <-------<<<<<
Teensy 3 active run (idle) current Is 31.68 ma. @ 96 Mhz <-------<<<<<
No connections are made to the Teensy 3
On board LED is off
Note: Higher freq = higher current consumption

After software bootloader change ...
Downloaded program: "blank.pde"
Teensy 3 active run (idle) current Is 13.07 ma. @ 24 Mhz <-------<<<<<
Teensy 3 active run (idle) current Is 18.8 ma. @ 48 Mhz <-------<<<<<
Teensy 3 active run (idle) current Is 25.4 ma. @ 96 Mhz <-------<<<<<
No connections are made to the Teensy 3
On board LED is off
Note: Higher freq = higher current consumption

The T3 low power "deep sleep" quiescent current consumption = ~ 250 uAmps <------<<<<<< (was ~ 6.5 ma.)

The Teensy 3 "only" current consumption dropped by ~ 6.5 - 0.25 in all speed modes. See above blank idle current readings.
 
Status
Not open for further replies.
Back
Top