“(SKU:RB-02S037)ADXL345 三軸加速度計”的版本間的差異

來自ALSROBOT WiKi
跳轉至: 導航、 搜索
?相關推薦
第111行: 第111行:
 
</pre>
 
</pre>
  
?
==相關推薦==
+
==產品相關推薦==
?
購買:[http://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-3667083713.12.MXloI1&id=13280714814 Arduino ADXL345 三軸加速度計 ]<br/>
+
[[文件:erweima.png|230px|無框|右]]
?
論壇地址:[http://www.makerspace.cn/portal.php 奧松機器人技術論壇]
+
===產品購買地址===
 +
[http://item.taobao.com/item.htm?spm=a1z10.3-c.w4002-3667083713.12.MXloI1&id=13280714814 Arduino ADXL345 三軸加速度計 ]<br/>
 +
===周邊產品推薦===
 +
[http://gharee.com/goods-546.html Carduino UNO R3 控制器]<br/>
 +
[http://gharee.com/goods-147.html V5.0傳感器擴展板]<br/>
 +
===相關問題解答===
 +
[http://www.makerspace.cn/forum.php?mod=viewthread&tid=3904&fromuid=10780 如何使用stm8s103f3單片機控制adxl345三軸加速度傳感器]<br/>
 +
 
 +
===相關學習資料===
 +
[http://v.youku.com/v_show/id_XMzkzMjE2NzM2.html?from=y1.7-2 視頻: AS-4WD輪式機器人三軸加速度計操控功能演示]<br/>
 +
[http://www.makerspace.cn/forum.php?mod=viewthread&tid=1733&fromuid=10780 視頻:Arduino ADXL345 三軸加速度計]<br/>
 +
[http://www.makerspace.cn/portal.php 奧松機器人技術論壇]<br/>

2015年9月25日 (五) 16:12的版本


02s03702.jpg

目錄

產品概述

ADXL345 數(shù)字三軸加速度計是一款小而薄的超低功耗3軸加速度計,分辨率高達(13位),測量范圍達± 16g。數(shù)字輸出數(shù)據(jù)為16位二進制補碼格式,可通過SPI(3線或4線)或I2C數(shù)字接口訪問。ADXL345非常適合移動設備應用。它可以在傾斜檢測應用中測量靜態(tài)重力加速度,還可以測量運動或沖擊導致的動態(tài)加速度。其高分辨率(3.9mg/LSB),能夠測量不到1.0°的傾斜角度變化。該器件提供多種特殊檢測功能?;顒雍头腔顒訖z測功能通過比較任意軸上的加速度與用戶設置的閾值來檢測有無運動發(fā)生。敲擊檢測功能可以檢測任意方向的單振和雙振動作。自由落體檢測功能可以檢測器件是否正在掉落。這些功能可以獨立映射到兩個中斷輸出引腳中的一個。正在申請專利的集成式存儲器管理系統(tǒng)采用一個32級先進先出(FIFO)緩沖器,可用于存儲數(shù)據(jù),從而將主機處理器負荷降至最低,并降低整體系統(tǒng)功耗。低功耗模式支持基于運動的智能電源管理,從而以極低的功耗進行閾值感測和運動加速度測量。

規(guī)格參數(shù)

  1. 工作電壓:3.3-5v
  2. 超低功耗:測量模式下40uA電流損耗,待機模式下0.1uA@2.5v
  3. 通訊接口:I2C、SPI(3線or4線)
  4. 接口類型:0.1"插針孔

接線方法

ADXL345 Arduino
VCC 3V3
GND GND
CS 3V3
SDO GND
SDA A4
SCL A5


實物接線圖:

Adxl345jiexian.jpg

例子程序


#include <Wire.h>
 
#define DEVICE (0x53)    //ADXL345 device address
#define TO_READ (6)        //num of bytes we are going to read each time (two bytes for each axis)
 
byte buff[TO_READ] ;    //6 bytes buffer for saving data read from the device
char str[512];                      //string buffer to transform data before sending it to the serial port
 
void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
 
  //Turning on the ADXL345
  writeTo(DEVICE, 0x2D, 0);      
  writeTo(DEVICE, 0x2D, 16);
  writeTo(DEVICE, 0x2D, 8);
}
 
void loop()
{
  int regAddress = 0x32;    //first axis-acceleration-data register on the ADXL345
  int x, y, z;
 
  readFrom(DEVICE, regAddress, TO_READ, buff); //read the acceleration data from the ADXL345
 
  //each axis reading comes in 10 bit resolution, ie 2 bytes.  Least Significat Byte first!!
  //thus we are converting both bytes in to one int
  x = (((int)buff[1]) << 8) | buff[0];   
  y = (((int)buff[3])<< 8) | buff[2];
  z = (((int)buff[5]) << 8) | buff[4];
 
  //we send the x y z values as a string to the serial port
  sprintf(str, "%d %d %d", x, y, z);  
  Serial.print(str);
  Serial.write(10);
 
  //It appears that delay is needed in order not to clog the port
  delay(50);
}
 
//---------------- Functions
//Writes val to address register on device
void writeTo(int device, byte address, byte val) {
  Wire.beginTransmission(device); //start transmission to device 
  Wire.write(address);        // send register address
  Wire.write(val);        // send value to write
  Wire.endTransmission(); //end transmission
}
 
//reads num bytes starting from address register on device in to buff array
void readFrom(int device, byte address, int num, byte buff[]) {
  Wire.beginTransmission(device); //start transmission to device 
  Wire.write(address);        //sends address to read from
  Wire.endTransmission(); //end transmission
 
    Wire.beginTransmission(device); //start transmission to device
  Wire.requestFrom(device, num);    // request 6 bytes from device
 
  int i = 0;
  while(Wire.available())    //device may send less than requested (abnormal)
  { 
    buff[i] = Wire.read(); // receive a byte
    i++;
  }
  Wire.endTransmission(); //end transmission
}

產品相關推薦

Erweima.png

產品購買地址

Arduino ADXL345 三軸加速度計

周邊產品推薦

Carduino UNO R3 控制器
V5.0傳感器擴展板

相關問題解答

如何使用stm8s103f3單片機控制adxl345三軸加速度傳感器

相關學習資料

視頻: AS-4WD輪式機器人三軸加速度計操控功能演示
視頻:Arduino ADXL345 三軸加速度計
奧松機器人技術論壇