Reply to topic  [ 3 posts ] 
GY-291 ADXL345 Triple Axis Accelerometer (HCMODU0060) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 669
Post GY-291 ADXL345 Triple Axis Accelerometer (HCMODU0060)
Image

Description:

The ADXL345 is a small, thin, ultralow power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through either a SPI (3- or 4-wire) or I2C digital interface. The ADXL345 is well suited for mobile device applications. It measures the static acceleration of gravity in tilt-sensing applications, as well as dynamic acceleration resulting from motion or shock. Its high resolution (3.9 mg/LSB) enables measurement of inclination changes less than 1.0°. Several special sensing functions are provided. Activity and inactivity sensing detect the presence or lack of motion by comparing the acceleration on any axis with user-set thresholds. Tap sensing detects single and double taps in any direction. Freefall sensing detects if the device is falling. These functions can be mapped individually to either of two interrupt output pins. An integrated, patent pending memory management system with a 32-level first in, first out (FIFO) buffer can be used to store data to minimize host processor activity and lower overall system power
consumption. Low power modes enable intelligent motion-based power management with threshold sensing and active acceleration measurement at extremely low power dissipation.The ADXL345 is supplied in a small, thin, 3 mm × 5 mm × 1 mm,14-lead, plastic package.


Specification:

Ultralow power: as low as 23 µA in measurement mode and
0.1 µA in standby mode at VS = 2.5 V (typical)
Power consumption scales automatically with bandwidth
User-selectable resolution
Fixed 10-bit resolution
Full resolution, where resolution increases with g range,
up to 13-bit resolution at ±16 g (maintaining 4 mg/LSB
scale factor in all g ranges)
Patent pending, embedded memory management system
with FIFO technology minimizes host processor load
Single tap/double tap detection
Activity/inactivity monitoring
Free-fall detection
Module supply voltage range: 4.0 V to 6 V
I/O voltage range: 1.7 V to 3.6V
SPI (3- and 4-wire) and I2
C digital interfaces
Flexible interrupt modes mappable to either interrupt pin
Measurement ranges selectable via serial command
Bandwidth selectable via serial command
Wide temperature range (−40°C to +85°C)
10,000 g shock survival
Pb free/RoHS compliant
Small and thin: 3 mm × 5 mm × 1 mm LGA package


Pinout:

GND..........0V
VCC..........+5V
CS...........Chip select
INT1..........Interrupt 1 out
INT2..........Interrupt 2 out
SD0..........Serial Data Output (4 Wire mode)
SDA..........Serial Data Input
SCL..........Serial Clock


Example Arduino Sketch:

Code:
/* FILE:    ARD_GY291_ADXL345_Example
   DATE:    02/04/14
   VERSION: 0.1
   
REVISIONS:

02/04/14 Created version 0.1

This is an example of how to use the Hobby Components GY-291 accelerometer module
(HCMODU0060). This module is based on the Analog Devices ADXL345 triple axis
accelerometer device.

This example sketch will demonstrate how perform a basic initialisation and then
will continually read each of the 3 axis registers and output them to the serial port.

PINOUT:

MODULE`                Arduino
GND                    GND
VCC                    +3.3V
CS                     +3.3V*
INT1                   N/A
INT2                   N/A
SD0                    N/A
SDA                    A4*
SCL                    A5*

*Please note that the ADXL345 opperates at 3.3V (via a 3.3V regulator) and these
pins should not be driven above 3.6V therefore you may require level shifters to
ensure safe opperation.

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used for the purpose of promoting or selling products
that directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

/* Include the standard wire library */
#include <Wire.h>

/* Alternate I2C address of the module */
#define I2C_Add 0x53

/* ADXL345 register addresses */
#define POWER_CTL 0x2D
#define DATA_FORMAT 0x31
#define X_Axis 0x32
#define Y_Axis 0x34
#define Z_Axis 0x36

/* Accelerometer range modes */
#define RANGE_2g 0
#define RANGE_4g 1
#define RANGE_8g 2
#define RANGE_16g 3

void setup()
{
  /* Initialise the I2C bus */
  Wire.begin(); 
 
  /* Initialise the serial interface */
  Serial.begin(9600);
 
  /* Initialise the ADXL345 */ 
  Init_ADXL345(RANGE_2g);
}

/* Main program */
void loop()
{
  /* Continually read and output all 3 axis to the serial port */
  Serial.print("X: ");
  Serial.print(Read_Axis(X_Axis));
 
  Serial.print(" Y: ");
  Serial.print(Read_Axis(Y_Axis));
 
  Serial.print(" Z: ");
  Serial.println(Read_Axis(Z_Axis));
}

/* Read one of the 3 axis via the I2C interface */
int Read_Axis(byte axis)
{
  int Data;
   
  Wire.beginTransmission(I2C_Add);
  Wire.write(axis);
  Wire.endTransmission();
 
  Wire.beginTransmission(I2C_Add);
  Wire.requestFrom(I2C_Add, 2);
 
  /* If data is available then read it (2 bytes) */
  if(Wire.available())     
  {
    Data = (int)Wire.read();
    Data = Data  | (Wire.read() << 8);
  }else
  {
    Data = 0;
  }
   
  Wire.endTransmission(); 
  return Data;
}


/* Initialise the ADXL345 */
void Init_ADXL345(byte range)
{
  Wire.beginTransmission(I2C_Add);
 
  /* Set the sensitivity of the module */
  Wire.write(DATA_FORMAT);
  Wire.write(range);
  Wire.endTransmission();
 
  /* Put the module into measurement mode to start taking measurements */
  Wire.beginTransmission(I2C_Add);
  Wire.write(POWER_CTL);
  Wire.write(0x08);
 
  Wire.endTransmission();
}



Datasheet:

Attachment:
ADXL345.pdf


You do not have the required permissions to view the files attached to this post.


Thu Apr 03, 2014 11:58 am
Profile

Joined: Wed Apr 15, 2015 4:11 pm
Posts: 1
Post Re: GY-291 ADXL345 Triple Axis Accelerometer (HCMODU0060)
Looks like a nice piece of kit.
Has anyone tried this out?
Is the level shifter strictly necessary? I know at least some 3.3v i2c's play nicely with 5v arduinos. If not, does hobbycomponents stock anything appropriate?


Wed Apr 15, 2015 7:43 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 669
Post Re: GY-291 ADXL345 Triple Axis Accelerometer (HCMODU0060)
Quote:
Has anyone tried this out?


We do test everything we sell ourselves to make sure they work as advertised however I'll leave this for a customer to answer as they are the ones that use our products in anger.

Quote:
Is the level shifter strictly necessary? I know at least some 3.3v i2c's play nicely with 5v arduinos.


As with most I2C devices, because its the module itself that pulls the I2C pins high (in this case via 4K7 ohm resistors to 3.3V) the pins will not go above 3.3V even when directly connect to a 5V Arduino. This does of course assume you don't have any other 5V I2C devices connected to the same bus.


Thu Apr 16, 2015 8:17 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD