element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Ralph Yamamoto's Blog TPL5110 Nano Power Switch
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ralphjy
  • Date Created: 20 Aug 2019 2:46 PM Date Created
  • Views 3419 views
  • Likes 5 likes
  • Comments 3 comments
  • tpl5110
  • lora sensor
  • battery power
Related
Recommended

TPL5110 Nano Power Switch

ralphjy
ralphjy
20 Aug 2019

While building my recent LoRaXes project I realized for successful battery power operation that I need a way to remove and restore power between data transmissions because the components that I was using did not have adequate sleep mode functionality.  I found numerous references to projects using the TI TPL5110 Nano Power Switch to provide that functionality with Arduino compatible boards.  Adafruit and Sparkfun both carry TPL5110 breakout boards.  The Adafruit board is just a bit smaller and uses a trim pot to set the time duration while the Sparkfun board uses discrete resistors and a DIP switch.  I'm using the Sparkfun board primarily because I could get it sooner.

image

    https://www.adafruit.com/product/3435

           image

   https://www.sparkfun.com/products/15353

 

 

Time interval testing

Sparkfun has a GitHub repository for their board: https://github.com/sparkfun/SparkFun_TPL5110_Nano_Power_Timer

 

The nano_power_timer_checker.ino program measures the time interval that output power is on if there is no done signal.  Connect VDD (3.3V) and GND to the input of the TPL5110 and connect the VDD_OUT from the TPL5110 to an external interrupt on the MK WAN 1300 (also connect GND between boards).  The MKR WAN 1300 is powered vis the microUSB connector.  I had to modify the program slightly - it was using digital pin 3 for the interrupt input and that isn't an interrupt input on the MKR WAN 1300 so I used digital pin 0 instead.  I also had to add a while(!Serial); statement to allow the Serial stream to start before outputting to the Serial Monitor.

/*
  Example Code for the TPL5110 Nano Power Switch Hookup Guide. This code
  checks to see the exact time that is set by the switched resistor. This time
  varies by the EXACT resistance of the resistor which has a 1% tolerance. In
  addition, the datasheet clarifies that each resistance has its own margin of
  error when producing the given time at a given resistance. What does this
  mean? If you are in need of HIGH precision timing, this may not be the choice
  for you. If you're looking to decrease power consumption to increase battery
  life in remote applications, applications that don't require high sampling
  rates (less than 100ms), or some Internet of Things application, then you're in the right
  place. If you're using a 3.3V microcontroller then use a 3.3V power source,
  if you're using a 5V microcontroller then use a 5V souce. Take care to not
  BURN OUT your digital I/O. 
  SparkFun Electronics
  Date: May, 2019
  Author: Elias Santistevan
*/

/*  Hardware Setup on Redboard (Arduino): 
   - VDD_OUT -> 0 
   - GND -> GND 
   - VDD -> 3.3V 
*/

// REMEMBER - You must cycle power set new timer!
// ALSO - Press onboard button to begin cycle for long timers!
unsigned long endTimer = 0; 
unsigned long beginTimer = 0; 
float timerLength = 0; 

bool start = false; 
bool interrupted = false; 
// VDD-OUT goes is on pinCheck
int pinCheck = 0; 

void setup(){

  Serial.begin(115200);
  while(!Serial); 
  Serial.println("Nano Power Switch - Timer Check!"); 
  Serial.println("Press the onboard button to begin the check.");
  pinMode(INPUT, pinCheck);
  // A interrupt may be overkill but it ensures we won't miss anything. 
  attachInterrupt(digitalPinToInterrupt(pinCheck), checkTimer, FALLING);

}

void loop(){

  // Check that timer is on! 
  if( (digitalRead(pinCheck) == HIGH) && (start == false)){ 
    Serial.print("Started: ");
    beginTimer = millis(); 
    Serial.println(beginTimer); 
    start = true; // Power is high, first flag is set. 
  }

  // If done signal is not sent back to Nano Power Switch, the Nano Power
  // Switch turns off power at the end of the timer anyway. After 50 ms the
  // Nano Power Switch will then turn the power back on. We're looking for that
  // small window when the power is turned off to calculate the exact time. 
  // Code will enter this block when timer has started (Power from VDD_out is
  // ON) and when we've seen it go low (Power from VDD_OUT is off).
  if((interrupted == true) && (start == true)){
    Serial.print("Ended: "); 
    Serial.println(endTimer);
    timerLength = endTimer - beginTimer; // Total time
    timerLength = timerLength + 50; // 50 ms off before back onto interval 
    Serial.print("Timer Length: "); 
    Serial.print(timerLength / 1000); // Convert to seconds... 
    Serial.println("-------");
    Serial.println();
    interrupted = false; 
    start = false; 
  }

}

// When power is low, we get our endTimer value, and set the second flag. 
void checkTimer(){
  endTimer = millis(); 
  interrupted = true; 
}

 

Here is the output when the DIP switches are set for a 5 second delay:

image

 

The time indicated is minus the 50 milliseconds the timer takes to reset.  It measures 4.7 seconds which is reasonably close.

 

Here is a scope capture of the VDD_OUT pin:

image

Th scope measures 5.731 seconds - 50 milliseconds = 5.68 seconds (maybe a little less as the reset interval looks larger than 50 milliseconds - I should have set the cursors to measure only the positive duration).  There is more time discrepancy than I would have expected.

 

Tried it again with a 13 second interval set:

image

image

This time a closer match 13.45 vs 13.53 seconds.  Not sure why the 2 measurements are off at 5 seconds, but that time difference won't matter in my application.  I'll probably have the interval set between 1-5 minutes depending on which sensor I'm using.

 

Power cycling the MKR WAN 1300

To test the actual use case the VDD input of the TPL5110 is connected to the battery and the VDD_OUT is connected to the battery terminals of the MKR WAN 1300.  Again, I needed to modify the sketch to accommodate the MKR WAN 1300 - the LED pin is digital pin 6 instead of 13 and I changed the done pin from digital pin 4 to 1 just for wiring convenience.

 

TPL5110_Blink_Done_Example.ino

All this sketch does on power up is toggle the LED on and off and then toggle the done_pin low and then high to signal the TPL5110 to turn off.  The done_pin is connected to the Done input of the TPL5110.

/*
  TPL5110_Blink_Demo_example.ino

  Simple Example Code for the TPL5110 Nano Power Timer Hookup Guide. This code
  simply blinks the pin 6 LED and writes pin 1 (donePin pin) high. This shift from
  LOW to HIGH of the donePin pin, signals to the Nano Power Timer to turn off the
  microcontroller.
  SparkFun Electronics
  Date: May, 2019
  Author: Elias Santistevan
*/

int led = 6; // Pin 6 LED
int donePin = 1; // Done pin - can be any pin.  

void setup(){

  pinMode(led, OUTPUT); 
  pinMode(donePin, OUTPUT); 

}

void loop(){
  // Blink. 
  digitalWrite(led, HIGH); 
  delay(1000); 
  digitalWrite(led, LOW); 
  delay(1000); 

  // We're done!
  // It's important that the donePin is written LOW and THEN HIGH. This shift
  // from low to HIGH is how the Nano Power Timer knows to turn off the
  // microcontroller. 
  digitalWrite(donePin, LOW); 
  digitalWrite(donePin, HIGH); 
  delay(10);
}

 

Here is a video demonstrating the operation.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

 

The next step is to run this with the board connecting to the Things Network.

  1. Power up
  2. Connect to the Things Network
  3. Read the sensors
  4. Transmit the data
  5. Power down

 

To simplify the Things Network connection I will need to change the activation mode from Over the Air Activation (OTAA) to Activation by Personalization (ABP) and have the session keys stored in FRAM.  That way the device does not have to negotiate session keys every time.  I will have to initially connect via OTAA, however.

 

When I get this working I'll send the battery voltage data and do a life test on the batteries transmitting every 5 minutes.  I also need to do a power measurement in power down mode.  I'll need to disable the LED on the breakout board.  The TPL5110 is spec'd at 35nA @ 2.5V.  Not sure what it is at 3V.  The Adafruit page indicated that it was measured to be 20uA ( I assume at 3.3V).  That will be material for a follow-up blog.

  • Sign in to reply

Top Comments

  • ralphjy
    ralphjy over 6 years ago in reply to dubbie +1
    Yes, that’s one of the reasons I need to use ABP instead of OTAA. I’ve noticed that the handshake to obtain keys is a time consuming process. My real concern is whether the GPS will reacquire quickly after…
  • Cadaval
    Cadaval over 3 years ago

    good afternoon

    i am interested in to do some similar, but i did not undertood, how i can store the session keys in FRAM module? any help please

    thanks

    CDV

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • ralphjy
    ralphjy over 6 years ago in reply to dubbie

    Yes, that’s one of the reasons I need to use ABP instead of OTAA.  I’ve noticed that the handshake to obtain keys is a time consuming process.  My real concern is whether the GPS will reacquire quickly after power up.  I’ll need to store all the satellite info each time I power down so that it has a good starting point.

     

    Ralph

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 6 years ago

    Looks like an interesting approach to saving power on modules with no power-down. I guess you have to have an interval long enough to allow the module to properly initialise and start-up.

     

    Dubbie

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube