ADXL335模拟三轴重力加速度模块使用方法

2025-09-24 11:50:54

1、1.产品介绍

 ADXL335是美国模拟器件公司(ADI)推出的一款带有信号调理电路的高精度模拟三轴加速度传感器,它可以使用于测量倾斜检测应用捕孝中的静态重力加速度,以及运动、冲击或振动导致的动态加速度等近始。

特性

1、工作温度范围:-40 to 85°C      2、灵敏度:300mv/g    

3、灵敏度(%):±10               4、输出类型:模拟量输出

5、工作电压:DC 5V                 6、功耗低

7、典型带宽:500HZ(X,Y,凤哨各Z端上外接100nF的电容)            

8、满量程加速度测量范围为±3 g

ADXL335上有一ST(self test)脚,可以用来测试芯片是否工作正常,把ST脚接Vs,查看三轴的加速度值。

2、2.应用

ADXL335传感器模块水平放置时,X、Y轴方向的加速度为0,Z轴上为1。当你顺着某个方向旋转90度时,其加速度加1,反向则为负1。

注意事项:

(A)该模块VCC供电5V,ADXL335的Vs为3.3V,可以通过明诺林提供的原理图查看。

(B)理解如下几个代码中涉及到的变量,具体细节阅读《产品参考文档》中的“ADXL335.pdf”

zero_G = 512.0;

静止时,输出的加速度等同于电压Vs/2等效值,Manduino UNO 10bit ADC范围是(0~1023),AD最大时,三轴线上的电压时Vs.

scale = 102.3 ;  330*1023/3.3/1000=330(mv/g) *1023/ (3300mv) 330mV/g , 代表的是分辨率

3.3V/1024 代表的是 10bit ADC值所代表的电压,( ADC值 * 3.3V/1024)  代表得到的电压,再将上值 / 0.33 得到它的 g 值,则因子scale单位为1/g

ADXL335模拟三轴重力加速度模块使用方法

3、3.在Manduino UNO板上验证,测试代码如下

/*

ADXL335

note:vcc-->5v ,but ADXL335 Vs is 3.3V

The circuit:

      5V: VCC

analog 1: x-axis

analog 2: y-axis

analog 3: z-axis

*/

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

const int ypin = 2;                  // y-axis

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

void setup()

{

 // initialize the serial communications:

 Serial.begin(9600);

}

void loop()

{

 int x = analogRead(xpin);

 delay(1); //

 int y = analogRead(ypin); //

 delay(1);  

 int z = analogRead(zpin);

float zero_G = 512.0; //ADC is 0~1023  the zero g output equal to Vs/2

                      //ADXL335 power supply by Vs 3.3V

float scale = 102.3;  //ADXL335330 Sensitivity is 330mv/g

                       //330 * 1024/3.3/1000  

                                                                               

Serial.print(((float)x - zero_G)/scale);

Serial.print("\t");

Serial.print(((float)y - zero_G)/scale);

Serial.print("\t");

Serial.print(((float)z - zero_G)/scale);

Serial.print("\n");

delay(500);

}

ADXL335模拟三轴重力加速度模块使用方法

4、模块水平放置,Xg、Yg、Zg理论值(0、0、1)

ADXL335模拟三轴重力加速度模块使用方法

5、顺时针旋转90度

ADXL335模拟三轴重力加速度模块使用方法

6、或逆时针旋转90度

测试到此为止,如果有兴趣,可以自己去摆弄各个状态,测试其加速度。

ADXL335模拟三轴重力加速度模块使用方法

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢