ADXL335 3-axis Accelerometer (GY-61) [S057]


* Specs

This is a very low cost break out module for the ADXL335 tripple axis accelerometer. This module includes optional header pins and provides easy access to the X, Y and Z axis analogue outputs from the accelerometer. 

It is capable of sensing forces up to 3g in all axis. A 3.3V on-board regulator is also provided allowing the module to be powered from a 3.3 to 5V power supply source.

Model number: HCMODU0070

Supply Range: 3V ~ 5V

3 Axis sensing

Full scale range: +/-3g

Sensitivity: 300mV/g (Typ)

Pinout, schematic and datasheet available after purchase.

* Contents

- Connect

Arduino Uno 

3.3V ----- VCC 

      ----- AREF


VCC ----- 3.3V 

X-OUT ----- A0 

Y-OUT ----- A1 

Z-OUT ----- A2 

GND ----- GND

- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

const int xpin = A0;                  // x-axis of the accelerometer

const int ypin = A1;                  // y-axis

const int zpin = A2;                  // z-axis (only on 3-axis models)


void setup()


  lcd.init();  // initialize the lcd 


  lcd.print("start LCD2004");



  pinMode(xpin, INPUT);

  pinMode(ypin, INPUT);

  pinMode(zpin, INPUT);







void loop()




  lcd.print("S057:ADXL335 3axisA");


  int x = analogRead(xpin);


  int y = analogRead(ypin);


  int z = analogRead(zpin);

  //zero_G is the reading we expect from the sensor when it detects

  //no acceleration.  Subtract this value from the sensor reading to

  //get a shifted sensor reading.

  float zero_G = 512.0;


  //scale is the number of units we expect the sensor reading to

  //change when the acceleration along an axis changes by 1G.

  //Divide the shifted sensor reading by scale to get acceleration in Gs.

  float scale = 102.3;


  float xp = ((float)x - zero_G)/scale;

  float yp = ((float)y - zero_G)/scale;

  float zp = ((float)z - zero_G)/scale;



  lcd.print("ax="+ (String)x +" x=" + (String)xp);



  lcd.print("ay="+ (String)y +" y=" + (String)yp);



  lcd.print("az="+ (String)z +" z=" + (String)zp);




Posted by RDIoT

댓글을 달아 주세요