AnsweredAssumed Answered

ADXL362 power consumption

Question asked by robertjenkins on Jun 12, 2014
Latest reply on Jun 17, 2014 by robertjenkins

I am having problems with the ADXL362 and getting it into a low power mode. I am using an Arduino Uno, modified to give 3.3V rather than 5 (I changed the voltage regulator on the Uno - a digital high is now 3.3V)

 

I'm using the Sparkfun breakout board.

 

The current readings I get are erratic and seem to depend to some extent on the orientation, but they never go lower than 4uA and are usually around 30uA. This is true even in standby mode.

 

Here is the code I am using:

 

#include <Arduino.h>

#include <SPI.h>

const int slaveSelectPin = 10;

 

void setup(){

  Serial.begin(9600);

  pinMode(slaveSelectPin, OUTPUT);

  SPI.begin();

  SPI.setDataMode(SPI_MODE0); //CPHA = CPOL = 0    MODE = 0

  delay(1000);

 

//soft reset

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0A);  // write instruction

  SPI.transfer(0x1F);

  SPI.transfer(0x52);

  digitalWrite(slaveSelectPin, HIGH);

 

// read Reg 2D before modifying for measure mode

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0B);  // read instruction

  SPI.transfer(0x2D);

  digitalWrite(slaveSelectPin, HIGH);

 

// turn on measurement mode

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0A);  // write

  SPI.transfer(0x2D);  //  Reg 2D

  SPI.transfer(0x02);  // begin measure

  digitalWrite(slaveSelectPin, HIGH);

  delay(100);

 

}

 

 

void loop(){

 

// Read X Value

  int twoRegValue = 0;

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0B);  // read instruction

  SPI.transfer(0x0E);

  twoRegValue = SPI.transfer(0x00);

  int XValue = twoRegValue + (SPI.transfer(0x00) << 8);

  digitalWrite(slaveSelectPin, HIGH);

 

 

// Read Y Value

  twoRegValue = 0;

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0B);  // read instruction

  SPI.transfer(0x10);

  twoRegValue = SPI.transfer(0x00);

  int YValue = twoRegValue + (SPI.transfer(0x00) << 8);

  digitalWrite(slaveSelectPin, HIGH);

 

 

// Read Z Value

  twoRegValue = 0;

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0B);  // read instruction

  SPI.transfer(0x12);

  twoRegValue = SPI.transfer(0x00);

  int ZValue = twoRegValue + (SPI.transfer(0x00) << 8);

  digitalWrite(slaveSelectPin, HIGH);

 

  delay (1000);

  Serial.print("XVALUE=");

  Serial.print(XValue);

  Serial.print("\tYVALUE=");

  Serial.print(YValue);

  Serial.print("\tZVALUE=");

  Serial.println(ZValue);

 

 

}

 

 

I believe that this following code should put it in standby, but it doesn't reduce the current.

 

#include <Arduino.h>

#include <SPI.h>

const int slaveSelectPin = 10;

 

void setup(){

  Serial.begin(9600);

  pinMode(slaveSelectPin, OUTPUT);

  SPI.begin();

  SPI.setDataMode(SPI_MODE0); //CPHA = CPOL = 0    MODE = 0

 

// read Reg 2D

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0B);  // read instruction

  SPI.transfer(0x2D);

  digitalWrite(slaveSelectPin, HIGH);

  delay (100);

 

// turn on standby mode

  digitalWrite(slaveSelectPin, LOW);

  SPI.transfer(0x0A);  // write

  SPI.transfer(0x2D);  //  Reg 2D

  SPI.transfer(0x00);  // standby

  digitalWrite(slaveSelectPin, HIGH);

      

}

 

void loop(){

 

 

Prior to using these sketches, I was using the Arduino library written by Anne Mahaffey and was getting similar results. But by playing around with the timings, and inserting small delays in her code (a few ms) I could make sure the current was about 4uA. With some values of delay(), I could get the current to visibly cycle up and down over a couple of seconds, which makes me think that the ADXL and the Arduino were somehow going in and out of sync. I have never been able to get it into sleep mode.

 

I am very baffled and would appreciate help.

Outcomes