adxl345 & pullup
Moderators: adafruit_support_bill, adafruit

adxl345 & pullup

by demenag62 on Wed Oct 30, 2013 3:18 am

Hie,
Here is my first post, coming from Paris...I hope you'll be kind with my poor language.

I've got an ADXL345 board, connected to an Arduino Duelmilanove.
I'm using the adafruit library.

first :
I was asking myself about my wiring because I need to add another I2C component.
I didn't find (on internet) the way to determinate the pullup resistance value ... help ! :D

Second:
adafruit library is nice, but I am not sure I ve got the right values from adxl345.
what are values you putted in registers ?
Ox38 : I tried 0x80
Ox32: I tried 0x0B (for 16g)

thanks a lot :D
demenag62
 
Posts: 2
Joined: Wed Oct 30, 2013 2:57 am

Re: adxl345 & pullup

by adafruit_support_bill on Wed Oct 30, 2013 5:31 am

I was asking myself about my wiring because I need to add another I2C component.
I didn't find (on internet) the way to determinate the pullup resistance value ... help !

In most cases the exact resistance value is not critical. Most of our breakout boards have pullup resistors included. If you have very many of them on the same bus, the combined pullup might be too strong, so you can remove some. But in most cases it is not an issue.

Second:
adafruit library is nice, but I am not sure I ve got the right values from adxl345.
what are values you putted in registers ?
Ox38 : I tried 0x80
Ox32: I tried 0x0B (for 16g)

Not sure what you are referring to. Do you mean these registers?
Code: Select all | TOGGLE FULL SIZE
    #define ADXL345_REG_DATAX0              (0x32)    // X-axis data 0
    #define ADXL345_REG_FIFO_CTL            (0x38)    // FIFO control

The library only reads from 0x32 and 0x38 is not used at all. You can see the complete code for the library here: https://github.com/adafruit/Adafruit_ADXL345
User avatar
adafruit_support_bill
 
Posts: 29739
Joined: Sat Feb 07, 2009 9:11 am

Re: adxl345 & pullup

by demenag62 on Wed Oct 30, 2013 6:52 am

Thanks,
(It seems that my english is good enough to be read)

instead of 0x32, i was thinking about 0x31 ... wich is set thanks to 'setRange' function , you're right.

you said "0x38 is not used at all." ... is that mean that whatever the value, it work fine ?
I mean the best way to have the last value mesured is the bypass mode, isn't it ?

datasheet are never written in french ... and sometimes, i m not sure to understand what it means.
demenag62
 
Posts: 2
Joined: Wed Oct 30, 2013 2:57 am

Re: adxl345 & pullup

by adafruit_support_bill on Wed Oct 30, 2013 7:16 am

datasheet are never written in french ... and sometimes, i m not sure to understand what it means.

Sometimes I am not sure if they are written in English either. They can be very difficult to read. :?

you said "0x38 is not used at all." ... is that mean that whatever the value, it work fine ?
I mean the best way to have the last value mesured is the bypass mode, isn't it ?

The library does not read or write to this register. Bypass mode is the default value for this register (see table 22 on page 27): http://www.analog.com/static/imported-f ... DXL345.pdf

instead of 0x32, i was thinking about 0x31 ... wich is set thanks to 'setRange' function , you're right.

0x31 is used by the getRange and setRange functions:
Code: Select all | TOGGLE FULL SIZE
/**************************************************************************/
/*!
    @brief  Sets the g range for the accelerometer
*/
/**************************************************************************/
void Adafruit_ADXL345::setRange(range_t range)
{
  /* Red the data format register to preserve bits */
  uint8_t format = readRegister(ADXL345_REG_DATA_FORMAT);

  /* Update the data rate */
  format &= ~0x0F;
  format |= range;

  /* Write the register back to the IC */
  writeRegister(ADXL345_REG_DATA_FORMAT, format);
}

/**************************************************************************/
/*!
    @brief  Sets the g range for the accelerometer
*/
/**************************************************************************/
range_t Adafruit_ADXL345::getRange(void)
{
  /* Red the data format register to preserve bits */
  return (range_t)(readRegister(ADXL345_REG_DATA_FORMAT) & 0x03);
}


valid range settings are defined in this enum:
Code: Select all | TOGGLE FULL SIZE
/* Used with register 0x31 (ADXL345_REG_DATA_FORMAT) to set g range */
typedef enum
{
  ADXL345_RANGE_16_G          = 0b11,   // +/- 16g
  ADXL345_RANGE_8_G           = 0b10,   // +/- 8g
  ADXL345_RANGE_4_G           = 0b01,   // +/- 4g
  ADXL345_RANGE_2_G           = 0b00    // +/- 2g (default value)
} range_t;
User avatar
adafruit_support_bill
 
Posts: 29739
Joined: Sat Feb 07, 2009 9:11 am