Using TeensyWiNo on battery

This tutorial illustrates how to optimize the energy when the TeensyWiNo is powered by a LiPo battery.

Connecting a LiPo battery

The TeensyWiNo can be powered by a LiPo battery via the battery connector. It embeds a LiPo charger to recharge any LiPo battery.

Do not connect another battery type on this connector.

The TeensyWiNo battery connector

When the LiPo battery is connected, the TeensyWiNo acts as a charger as soon as the USB is powered. When the charger is on, the dedicated red LED automatically turned on (no control by software). When the LiPo battery is full, this LED is turned off.

LiPo charger active: charger LED on

Theoretical energy consumption

The two mains energy consumers on TeensyWiNo are the MCU (Teensy) and the transceiver (RFM22b). When designing an application, remember that:

  • The MCU frequency the higher, the energy consumption the higher,
  • the transceiver consumes energy even in reception and idle modes.

The following table summarizes the power consumption of the MCU (Teensy: Freescale MK20DX256 VLH7) and the transceiver (HopeRF RFM22b) (source: datasheets).

 State/frequencyPower consumption (Vcc=3.7V)
CPU
MCU: Teensy
(Freescale MK20DX256 VLH7)
Working, 96MHz129mW
Working, 72MHz103mW
Working, 48MHz88.8mW
Working, 24MHz55.5mW
Working, 16MHz32.9mW
Working, 8MHz22,2mW
Working, 4MHz14.8mW
Working, 2MHz5.18mW
Sleep, any freq, LPTMR wake 2mW
Deepsleep, any freq, LPTMR wake 650μW
Hibernate, any freq, LPTMR wake <30μW
Transceiver
(HopeRF RFM22b)
Transmit (10dBm) 76mW
Receive57mW
Idle26mW
Sleep<5μW

Enabling sleep states on the MCU and transceiver

The best way to save the battery is enabling sleep states on both MCU and transceiver.

On the transceiver

With RadioHead, enable the RFM22b sleep mode with:

rf22.sleep();

The transceiver enters in sleep mode just after calling the sleep() method; it then consumes less than 5µW and does not receive messages anymore until waking-up. Wake the transceiver by calling recv(), send()… as indicated in the RadioHead documentation.

On the MCU

Enabling the sleep states (sleep, deepsleep and hibernate) of the Teensy is easy using the Snooze library. The examples sketches work out-of-the-box on the TeensyWiNo.

Note that the USB Serial is lost when the Teensy enters sleep mode.

Typical lifetime on battery

The lifetime depends heavily on actions on the MCU and the transceiver.

A first benchmarking

Here is an example of a simple code that:

  1. Get the temperature using the BMP085,
  2. Get the voltage and charge of the LiPo battery,
  3. Send these data on radio,
  4. Wait 50ms for nothing,
  5. Turns the transceiver on sleep mode,
  6. Turns the MCU on sleep mode for 10 seconds.
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <MAX17043.h>
#include <Snooze.h>
#include <RH_RF22.h>

#define LED_BLUE_PIN 6

MAX17043 batteryMonitor;
Adafruit_BMP085 bmp;
RH_RF22 rf22(SS,9);

SnoozeBlock config;
uint8_t rfbuf[RH_RF22_MAX_MESSAGE_LEN];
uint8_t rflen = sizeof(rfbuf);


void setup() {

  pinMode(LED_BLUE_PIN, OUTPUT);
  SPI.setSCK(14);

  if (!rf22.init()) while(1);
  if (!bmp.begin()) while(1);

  rf22.setTxPower(5);
  rf22.setModemConfig(RH_RF22::GFSK_Rb125Fd125);
  rf22.setFrequency(433.7, 0.05); &nbsp;

  batteryMonitor.reset();
  batteryMonitor.quickStart();

  config.setTimer(10000); // milliseconds
}


void loop() {

  float temperature = bmp.readTemperature();
  float cellVoltage = batteryMonitor.getVCell();
  float stateOfCharge = batteryMonitor.getSoC();

  digitalWrite(LED_BLUE_PIN, HIGH);
  sprintf((char*)rfbuf, "temp=%.1f°C,bat=%.1f%,volt=%.2fV", temperature, stateOfCharge, cellVoltage);
  rf22.send(rfbuf, strlen((char*)rfbuf));
  rf22.waitPacketSent();
  delay(50);
  digitalWrite(LED_BLUE_PIN, LOW);

  rf22.sleep();
  Snooze.hibernate( config );
}

A LiPo benchmarking has began on December, 26th 2016 on four nodes, with two different LiPo batteries: 850mA.h and 1600mA.h. The four nodes are still alive. Follow the lifetime evolution in the news 🙂





Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Leave a Reply