upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Attributes
ADXRS610 Class Reference

DFRobot ADXRS610 Gyro Beakout board. More...

Detailed Description

The ADXRS610 is a MEMS based single axis gyroscope with a range of +/- 300 degrees/sec. It also incorporates a temperature sensing unit that can be used for advanced calibration.

This sensor returns an analog voltage proportional to the rotation about the Z-axis in degrees/sec. The temperature component returns a proportional analog values in degrees C.

This driver was developed using the DFRobot ADXRS610 Gyro Beakout board.

adxrs610.jpg
// Instantiate a ADXRS610 sensor on analog pin A0 (dataout), and
// analog A1 (temp out) with an analog reference voltage of
// 5.0
upm::ADXRS610 *sensor = new upm::ADXRS610(0, 1, 5.0);
// set a deadband region around the zero point to report 0.0 (optional)
sensor->setDeadband(0.015);
// Every tenth of a second, sample the ADXRS610 and output it's
// corresponding temperature and angular velocity
while (shouldRun)
{
cout << "Vel (deg/s): " << sensor->getAngularVelocity() << endl;
cout << "Temp (C): " << sensor->getTemperature() << endl;
usleep(100000);
}

Public Member Functions

 ADXRS610 (int dPin, int tPin, float aref=5.0)
 
 ~ADXRS610 ()
 
float getDataVolts ()
 
float getTemperatureVolts ()
 
void setDeadband (float deadband)
 
void setZeroPoint (float zeroPoint)
 
float calibrateZeroPoint (unsigned int samples=50)
 
float getZeroPoint ()
 
float getTemperature ()
 
float getAngularVelocity ()
 

Protected Attributes

mraa::Aio m_aioData
 
mraa::Aio m_aioTemp
 

Constructor & Destructor Documentation

ADXRS610 ( int  dPin,
int  tPin,
float  aref = 5.0 
)

ADXRS610 constructor

Parameters
dPinAnalog pin to use for DATAOUT
tPinAnalog pin to use for temperature measurement
arefAnalog reference voltage; default is 5.0 V

Here is the call graph for this function:

~ADXRS610 ( )

ADXRS610 destructor

Member Function Documentation

float getDataVolts ( )

Returns the voltage detected on the DATA analog pin

Returns
The detected voltage

Here is the caller graph for this function:

float getTemperatureVolts ( )

Returns the voltage detected on the TEMP analog pin

Returns
The detected voltage

Here is the caller graph for this function:

void setDeadband ( float  deadband)
inline

This method allows you to specify a deadband region around the zero point of the gyro (at rest). This can be used as a primitive filter to ignore movment around the zero point.

Parameters
deadbandThe voltage around the zero point which will be ignored

Here is the caller graph for this function:

void setZeroPoint ( float  zeroPoint)
inline

Set the zero point. This is the point measured and averaged when the sensor is not moving. It is set at construction time (averaged over a number of samples), but can be overriden here.

Parameters
zeroPointThe averaged zero point of the sensor at rest

Here is the caller graph for this function:

float calibrateZeroPoint ( unsigned int  samples = 50)

This method samples the data pin samples times to produce an average. This value can then be used as the zero point (setZeroPoint()).

Parameters
samplesthe number of samples to take an average over. The default is 50.
Returns
the average of the reading over samples times.

Here is the call graph for this function:

Here is the caller graph for this function:

float getZeroPoint ( )
inline

Return the zero point value.

Returns
the current zero point value
float getTemperature ( )

Return the measured temperature in Celcius. Note, the datasheet says that this value is very repeatable, but is not an accurate absolute temperature.

Returns
the current temperature in C

Here is the call graph for this function:

float getAngularVelocity ( )

Return the measured angular velocity in degrees/sec.

Returns
the current angular velocity in degrees/sec

Here is the call graph for this function:


The documentation for this class was generated from the following files: