Author Topic: Teensy 2.0 - power consumption  (Read 3351 times)

0 Members and 1 Guest are viewing this topic.

Offline cub-uanic

  • Thread Starter
  • Posts: 72
  • Location: Ukraine, Kharkov
Teensy 2.0 - power consumption
« on: Thu, 05 March 2015, 20:24:53 »
Hi,

I'm experimenting with Teensy on low power, and found something that I can't explain.

Currently Teensy runs on 3.3V and 4MHz.
When I power it up, consumed current is 12.4mA.
It's very different from my expectations, because it should consume 10.6mA on 3.3V/8MHz, so on 4MHz it definitely should be less than 10.6mA.

When I connecting USB, and consumed current drops down to 7.5mA.
Wow.
I expected that USB will eat some additional power from battery.

And when I'm disconnecting USB, consumed current drops down again to 4.2mA.
Hmmmm....

And now when I'm connecting/disconnecting USB, consumed current is 7.5/4.2mA.


I tried to power it up with connected USB, and then I see 7.5/4.2mA from the beginning and there is no 12.4mA peak.


I'm using TMK firmware for my experiments (https://github.com/tmk/tmk_keyboard/tree/master/keyboard/onekey) because I'm familiar with it, and after all I want to make BT keyboard :)
Everything I've changed - it's just set cpu prescaler during matrix initialization:

Code: [Select]
--- ../onekey/matrix.c  2015-01-03 13:38:59.383088670 +0200
+++ ./matrix.c  2015-03-06 04:07:57.022047139 +0200
@@ -21,6 +21,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <avr/io.h>
+#include <avr/interrupt.h>
 #include <util/delay.h>
 #include "print.h"
 #include "debug.h"
@@ -57,6 +58,12 @@
 
 void matrix_init(void)
 {
+    // set CPU speed
+    cli();
+    CPU_PRESCALE(CPU_4MHz);
+    sei();
+
     debug_enable = true;
     debug_matrix = true;
     debug_mouse = true;

Obviously, TMK firmware does not doing something on start, what it doing when USB is connected.
This "something" is very influencing to power consumption.
Unfortunatly, I have no clue what this could be.

Any help, ideas and directions to experimenting really much appreciated.
I need full power of your telepathy :)

ErgoDox Classic - Stock Clears
Teenesis - Kinesis Advantage powered by Teensy

Offline BlueNalgene

  • Posts: 739
  • Location: Oklahoma, USA
Re: Teensy 2.0 - power consumption
« Reply #1 on: Thu, 05 March 2015, 21:04:20 »
How are you hooking up the USB?  Is it a wall wart or computer?  If wall wart, what is the brand and model?

I ask because I assume that the USB that you use to power goes through a switching PSU, while your battery hookup is direct.  You might be losing a great deal of efficiency there.

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Teensy 2.0 - power consumption
« Reply #2 on: Thu, 05 March 2015, 21:20:36 »
Before pluging in USB port it will run into busy wait for USB to be configured. This explains the fact that it consume more power when it is unpluged. This behaviour is useful for wired keyboard but not for wireless one.

https://github.com/tmk/tmk_keyboard/blob/master/protocol/lufa/lufa.c#L572-L580

Offline cub-uanic

  • Thread Starter
  • Posts: 72
  • Location: Ukraine, Kharkov
Re: Teensy 2.0 - power consumption
« Reply #3 on: Thu, 05 March 2015, 21:29:03 »
How are you hooking up the USB?  Is it a wall wart or computer?  If wall wart, what is the brand and model?

I ask because I assume that the USB that you use to power goes through a switching PSU, while your battery hookup is direct.  You might be losing a great deal of efficiency there.
I use battery as power for Teensy and do not take power from USB.
See http://www.pjrc.com/teensy/external_power.html for more details.


Before pluging in USB port it will run into busy wait for USB to be configured. This explains the fact that it consume more power when it is unpluged. This behaviour is useful for wired keyboard but not for wireless one.

https://github.com/tmk/tmk_keyboard/blob/master/protocol/lufa/lufa.c#L572-L580
Ok, thanks will look into this.

ErgoDox Classic - Stock Clears
Teenesis - Kinesis Advantage powered by Teensy