Low Power Teensy+PCB problem

Status
Not open for further replies.

hesquibet

New member
I have designed a quick prototype with a teensy and accelerometer (MPU9250)

I have successfully put the teensy into hibernate mode, and i do get around 40uA when used alone (not plugged to the PCB).
When i power the PCB with the accelerometer and without the Teensy, i get 3mA.

When i plug the teensy on the PCB with the accel. and set it into hibernate mode, i get 78mA. ( i can see the variation of current from "awake" (108mA) to hibernate (78mA) mode )

i do not understand where this current leakage can come from.

I have heard unconnected pins can draw current, that's why i have set all unused pins to OUTPUT

Does anyone have an idea how i can reduce the power consumption to about 3mA ?

Code:
#include <Snooze.h>
#include "MPU9250.h"
#include "signal.h"
#include "filter.h"

SnoozeAlarm  alarm;

MPU9250 Sensor_1(3);


#if defined(__MK20DX256__)
SnoozeBlock config_teensy32(alarm);
#endif

#define LED_BUILTIN (18)
#define NUMBER_SAMPLE 5000
#define ACQUISITION_FREQUENCY 4000.0

char data[12];
uint8_t size;
int i;


void setup() { 
  pinMode(0,OUTPUT);
  pinMode(1,OUTPUT);
  pinMode(2,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(14,OUTPUT);
  pinMode(15,OUTPUT);
  pinMode(16,OUTPUT);
  pinMode(17,OUTPUT);
  pinMode(18,OUTPUT);
  pinMode(19,OUTPUT);
  pinMode(20,OUTPUT);
  pinMode(21,OUTPUT);
  pinMode(22,OUTPUT);
  pinMode(23,OUTPUT);

  Sensor_1.initMPU9250();
  Sensor_1.getAres();
  
}

uint16_t getRMS(MPU9250 *sensor) {
  float accelData[NUMBER_SAMPLE];
  float filteredData[NUMBER_SAMPLE];
  float filteredDataCached[NUMBER_SAMPLE-1000];
  int16_t accelCount[1];
  uint16_t i = 0;
  long timer =millis(); 
  uint16_t elapsed = millis()-timer;
  while (i < NUMBER_SAMPLE && elapsed<2000) {
    elapsed = millis()-timer;
    if (sensor->readByte(MPU9250_ADDRESS, INT_STATUS) & 0x01)
    {
      sensor->readAccelData(accelCount);  // Read the x/y/z adc values
      accelData[i] = (float)accelCount[0] * sensor->aRes * 9.81 * 1000; // - accelBias[2];
      i++;
    }
  }

  if( elapsed<2000 ? false : true){
    return 0;  
  }

  filterType *filter = filter_create();
  filter_init(filter);
  filter_filterBlock(filter, accelData, filteredData, NUMBER_SAMPLE);
  filter_destroy(filter);
  
  for(int i=1000;i<NUMBER_SAMPLE; i++){
    filteredDataCached[i-1000]=filteredData[i];
  }
  integrateSignal(filteredDataCached, accelData,NUMBER_SAMPLE-1000,1.0/ACQUISITION_FREQUENCY);
  
  return RMS(accelData,NUMBER_SAMPLE-1000,1/ACQUISITION_FREQUENCY)*100;
}


void loop() {
 

  uint16_t rms = getRMS(&Sensor_1);

  data[0] = rms >> 8;
  data[1] = rms & 0xff;
 


  Serial.println(rms);
  alarm.setAlarm(0, 20, 00); //hours, minutes, seconds
  Sensor_1.Sleep();
  Snooze.hibernate( config_teensy32 );// return module that woke processor
  Sensor_1.initMPU9250();
}

Fichier_000-min.jpg

Unfortunately i have lost the original wiring, but the version below is quite close ( even though dirty...)
wiring.JPG
 
I would try the Teensy on the board without anything else installed, if you get high current you probably have a short/bad connection to something.
 
Thank you for your answer, you've got me on the right track.

After many tests, i found out that the CLK signal of the accelerometers seems to sink a high amount of current when idle / sleep. ( MCU to sensor com. is done through SPI )
This is probably due to the schematics of the pre-made MPU9250 boards i bough from china : they include extrat unknown components, which i guess consume power.

I'm looking for a solution to programatically "disconnect" the accelerometer when the teensy hibernates.
I'm thinking of setting CLK to High gain Input to reduce the CLK current sink.
Would you have any other better ideas ?

View attachment 10667
 
Thank you for your answer, you've got me on the right track.

After many tests, i found out that the CLK signal of the accelerometers seems to sink a high amount of current when idle / sleep. ( MCU to sensor com. is done through SPI )
This is probably due to the schematics of the pre-made MPU9250 boards i bough from china : they include extrat unknown components, which i guess consume power.
Yes, make the SPI clock a input.
 
Thank you for your answer, you've got me on the right track.

After many tests, i found out that the CLK signal of the accelerometers seems to sink a high amount of current when idle / sleep. ( MCU to sensor com. is done through SPI )
This is probably due to the schematics of the pre-made MPU9250 boards i bough from china : they include extrat unknown components, which i guess consume power.

I'm looking for a solution to programatically "disconnect" the accelerometer when the teensy hibernates.
I'm thinking of setting CLK to High gain Input to reduce the CLK current sink.
Would you have any other better ideas ?

View attachment 10667

Can you provide a link to the ebay unit you are using?
 
That board has a linear regulator on it, are you powering it from 5V?

Also what connections on that board are you using?
 
Last edited:
HTB1NAUXPXXXXXb8XVXXq6xXFXXXJ.jpg
You may consider to power it from the same supply to Teensy. You have to check voltage and cut out the trace.

I am curious who do you make all the pins input instead of input, which may reduce leakage current.
 
That board has a linear regulator on it, are you powering it from 5V?

I am powering it from the Teensy 3.3V regulator output pin.

You may consider to power it from the same supply to Teensy. You have to check voltage and cut out the trace.

Yes, i probably should have done that before drowning my sensor into Epoxy :)

Also what connections on that board are you using?

I have connected the following :
VCC => Pin 3.3V
GND => GND
SCL => Pin 13
SDA => Pin 11
EDA => NC
ECL => NC
ADO => Pin 12
INT => NC
NCS => Pin 2
FSYNC=> NC

I am curious who do you make all the pins input instead of input, which may reduce leakage current.
Not sure what you mean, but if you want to know how to set pins OUTPUT instead of INPUT, you can refer to the firsts lines of Setup() in my code on the original post.
 
Even with setting the outputs to inputs there is still a chance of some high currents being drawn as things are being switched around.
It could over time damage the Teensy.


Edit, if the Teensy is driving the SCLK line high and the MPU wants to pull it down this would cause issues... The only reason for the MPU to pull it down would be if it thinks its in I2C mode and not SPI?
 
Last edited:
Status
Not open for further replies.
Back
Top