(SKU:SEN0095)SD740 Triple Axis Gyro 高精度3轴陀螺仪

来自DFRobot Product Wiki
跳转至: 导航搜索
Tri-Axis Gyro Breakout-SD740

目录

概述

惯性和无线半导体产品制造商SensorDynamics 宣布推出其新型SD740 MEMS陀螺仪。SD740为该公司的传感器系列增添了一款XY角速率和一款XYZ角速率设备。除了拥有两个或三个模拟输出外,它还配有I2C和SPI数字接口以及最大可达±4096°/s的广泛测量范围。这些功能使其应用具有了高度灵活性。SD740为温度补偿型,并且经过了工厂校准,以便将偏移误差和温度漂移最小化。
SD740设计可支持2.6伏至3.3伏的工作电压以及-40°C至+85°C的工作温度。它在室温下的最大偏移误差为10°/s,而室温下的灵敏度误差和灵敏度温度漂移最大为5%。这个数字接口提供了±1024°/s的全刻度标准测量范围。测量值的内部更新速度很快,最低为10 kHz。比率法模拟输出可以根据±64、±128、±256或±512°/s测量范围进行配置。SD740设备还包含一种特别的断电模式(这种模式下不会消耗电力),但是SPI接口依然具有高阻抗,因此传感器无需从总线中去除。
SD740具有低功耗功能以及小而强大的QFN封装(6x6x1.8mm),这使它适用于医疗技术应用以及工业领域的器械和控制应用(例如机器人控制和导航)。这些传感器包含一种持续工作的自检装置,可以在不干扰测量的情况下对二维或者三维角速率传感器元件进行监控。

模块被设计为3个接口:

  • 1、数字SPI
  • 2、数字I2C
  • 3、模拟输出

配置焊盘允许用户选择合适的接口

技术规格

  • 供电电压:+2.6~3.3V
  • 数字总线工作工作电压:1.8~3.3v
  • SD740陀螺仪模块接口:SPI、I2C、模拟电压输出
  • 5.2mA电流损耗
  • 最大偏移误差:10°/s
  • 工作温度范围:-40~+85℃
  • 全刻度标准测量范围:±1024°/s,可配置测量范围,具体可参见数据手册
  • 带温度反馈数据校正
  • 全数字化处理率信号和陀螺仪控制回路
  • 尺寸:21x21x3mm

示意图

SD740 Schematic

连线图


I2C连线图

I2C Connection


SPI连线图

SPI Connection


Analog连线图

Analog Connection


示例代码


I2C模式


/*
Gyroscope SD740 I2C Mode
 
 Version 1.0  Lauren <Lauran.pan@gmail.com>  
 
 Operating Supply Voltage           V    2.6 - 5% - 3.3 + 5%
 Full Scale Range (digital output) °/s  1024
 Sensitivity Accuracy               %    ± 5 
 Sensitivity Error Over Temperature %    ± 5
 Signal Update Rate                 KHz  10
 SPI Communication Speed            KHz  400
 
 Full scale range is factory defined. Please contact SensorDynamics for setting different ranges. Maximum full scale
 factor is 4096°/s
 Bandwidth is factory defined. Please contact SensorDynamics for setting different ranges. Maximum bandwidth is
 150Hz
 
 I2C Address setting 
 
 Pin          state        Device address
 
 MISO/ADDR    LOW          0x4E
 MISO/ADDR    HIGH         0x4F
 
 */

#include <Wire.h>
#define DEVICE 0x4F

byte buff[20] ;    //6 bytes buffer for saving data read from the device
char str[128];                      //string buffer to transform data before sending it to the serial port

//I2C Address A7

void setup(){
  
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(57600);  // start serial for output
  
}


void loop(){
  
  int regAddress = 0x00;    //first axis-acceleration-data register on the ADXL345
  int x, y, z;

  readFrom(byte(DEVICE), regAddress, 8, buff);//receive data
  
  x = (((int)buff[2]) << 8) | buff[3];   
  y = (((int)buff[4]) << 8) | buff[5];
  z = (((int)buff[6]) << 8) | buff[7];
  
//  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.print(10, BYTE);

//  It appears that delay is needed in order not to clog the port
  delay(100);
  
}

//---------------- Functions
//Writes val to address register on device
void writeTo(int device, byte address, byte val) {
  
  Wire.beginTransmission(device); //start transmission to device 
  Wire.send(address);        // send register address
  Wire.send(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.send(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.receive(); // receive a byte
    i++;
  }
  Wire.endTransmission(); //end transmission
  
//  for(int j = 0;j < i;j ++){    //output all received bytes
//    Serial.print(buff[j],HEX);
//    Serial.print("\t");
//  }
//  Serial.print(10, BYTE);
  
}

SPI模式

/*
Gyroscope SD740 SPI connection 
 
 Version 1.0  Lauren <Lauran.pan@gmail.com>  
 
 Pin connection to the Arduino board:
 
 CSN         ->   digital pin 10(D10) 
 MOSI/SDA    ->   digital pin 11(D11)
 MISO/ADDR   ->   digital pin 12(D12)
 SCL         ->   digital pin 13(D13)
 
 Operating Supply Voltage           V    2.6 - 5% - 3.3 + 5%
 Full Scale Range (digital output) °/s  1024
 Sensitivity Accuracy               %    ± 5 
 Sensitivity Error Over Temperature %    ± 5
 Signal Update Rate                 KHz  10
 SPI Communication Speed            MHz  40
 
 Full scale range is factory defined. Please contact SensorDynamics for setting different ranges. Maximum full scale
 factor is 4096°/s
 Bandwidth is factory defined. Please contact SensorDynamics for setting different ranges. Maximum bandwidth is
 150Hz
 
 */


#include <SPI.h>

#define DataRegister 0x00
#define CS_Pin 10            //chip selection pin

char receiveData[128];        //data array
int x,y,z;
float xg,yg,zg;
float absHeading = 0;         // calculate the absolute heading
unsigned long iTime = 0;      

void setup(){

  Serial.begin(57600);

  SPI.begin();
  SPI.setDataMode(SPI_MODE0);

  pinMode(CS_Pin, OUTPUT);// init the chip selection pin
  digitalWrite(CS_Pin, HIGH);

  checkGyroStatus();
  
}

void checkGyroStatus(){

  readRegister(20,1,receiveData);
  Serial.print("check lock state:\t");
  Serial.println(receiveData[0],BIN);//bin; 110 means works well
  
  if(bitRead(receiveData[0],1) == 0 || bitRead(receiveData[0],2) == 0){
    Serial.println("Chip start error! You could reset the arduino board");
    while(1){
    }
  }

  readRegister(70,1,receiveData);
  Serial.print("check standby bit:\t");
  Serial.println(receiveData[0],BIN);//check bit0 0->normal 1->standby
  
}

void loop(){
  
  readRegister(DataRegister, 6, receiveData);

  x = ((int)receiveData[0]<<8)|(int)receiveData[1];
  y = ((int)receiveData[2]<<8)|(int)receiveData[3];
  z = ((int)receiveData[4]<<8)|(int)receiveData[5];

  float scale = 0.03125;// scale: 1024 / 2^15

  xg = x * scale;
  yg = y * scale;
  zg = z * scale;
  float pastTime = float(micros() - iTime) / float(1000000);
  absHeading += zg * pastTime;
  iTime = micros();

  /*
  Serial.print(x, DEC);
  Serial.print(',');
  Serial.print(y, DEC);
  Serial.print(',');
  Serial.println(z, DEC); 
  Serial.print((float)xg,2);
  Serial.print("\t");
  Serial.print((float)yg,2);
  Serial.print("\t");
  Serial.print((float)zg,2);
  Serial.println(" °/s");
  */
  Serial.print("Heading:");
  Serial.println(absHeading);//Axis Z absolute heading 
  

  delay(10);

}

void writeRegister(char registerAddress, char value){

  digitalWrite(CS_Pin, LOW);
  SPI.transfer(registerAddress);
  SPI.transfer(value);
  digitalWrite(CS_Pin, HIGH);

}


void readRegister(char registerAddress, int numBytes, char * values){

  char address = 0x80 | registerAddress;
  digitalWrite(CS_Pin, LOW);
  SPI.transfer(address);
  for(int i=0; i<numBytes; i++){
    values[i] = SPI.transfer(0x00);
  }
  digitalWrite(CS_Pin, HIGH);

}

模拟模式

/*
Gyroscope SD740
Analog output mode
Display the gyro output volts

Version 1.0  Lauren <Lauran.pan@gmail.com>

Full Scale Range (analog outputs)   °/s   - 64, 128, 256, 512 -
Operating Supply Voltage              V     2.6 - 5% - 3.3 + 5%

Analog Output Range             Vdd * 0.1       -       Vdd * 0.9
Analog Output Sensitivity       V / (°/s)      (Vdd / 2) / Full Scale
Analog Output @ 0°/s           Vdd/2 – 0.05    -       Vdd/2 + 0.05
Analog Output Resolution bit    10

Full scale range is factory defined. Please contact SensorDynamics for setting different ranges. Maximum full scale
factor is 4096°/s
Bandwidth is factory defined. Please contact SensorDynamics for setting different ranges. Maximum bandwidth is
150Hz
*/


void setup(){
  
  Serial.begin(57600);
  
}

void loop(){
  
  float voltX,voltY,voltZ;
  
  voltX = analogRead(0) * 5.0 / 1024.0; 
  voltY = analogRead(1) * 5.0 / 1024.0; 
  voltZ = analogRead(2) * 5.0 / 1024.0; 
  
  Serial.print("x: ");
  Serial.print(voltX,5);
  Serial.print(" v\ty: ");
  Serial.print(voltY,5);
  Serial.print(" v\tz: ");
  Serial.print(voltZ,5);
  Serial.println(" v\t Reference: 3.3v");
  
  delay(50);
  
}

Aditional文件

简单案例


Nextredirectltr.png购买SD740 Triple Axis Gyro 高精度3轴陀螺仪(SKU:SEN0095)

个人工具
名字空间

变换
操作
导航
工具箱