Rita Yang / ADIS16467

Dependents:   ADIS16467-Tests

You are viewing an older revision! See the latest version

Homepage

ADIS16467 Driver

by Rita Yang / USC Rocket Propulsion Lab

This driver supports all basic functions for Analog Devices' ADIS16467 Precision MEMS IMU Module. It supports all common functions of the chip, such as reading data from the gyroscope and accelerometer, retrieving the integrated angle and delta velocity, burst readingm and setting the sensor's polling rate.

Features

  • Support for reading of sensor data, including angular acceleration and linear acceleration via SPI.
  • Support for sensor's internal integration of angle and velocity.
  • Support for utilizing the Burst Read functionality to poll data in bulk.
  • Ability to adjust integration period.
  • Calibration function for the gyroscope.
  • Provides conversion constants to convert data to human-readable units.

Documentation

Full datasheet is available online here.

Example Code

Example for basic data polling:

#include <mbed.h>
#include <ADIS16467.h>

int main() {
	Serial pc(USBTX, USBRX);

	//Create IMU, passing in all parameters
	//All pins here are arbitrary, you will need to configure them accordingly
	ADIS16467 imu(&pc, PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_ADIS_CS, PIN_ADIS_RST);

	//Initialize the IMU
	imu.initADIS();

	while(1) {
		wait_ms(600);

		float gyroX = (float)(imu.readGyroX()) * imu.GYRO_CONV;
		float gyroY = (float)(imu.readGyroY()) * imu.GYRO_CONV;
		float gyroZ = (float)(imu.readGyroZ()) * imu.GYRO_CONV;
		float accelX = (float)(imu.readAccelX()) * imu.ACCEL_CONV;
		float accelY = (float)(imu.readAccelY()) * imu.ACCEL_CONV;
		float accelZ = (float)(imu.readAccelZ()) * imu.ACCEL_CONV;
		float intTemp = (float)(imu.readInternalTemp()) * imu.TEMP_CONV;
		uint16_t dataCount = imu.readDataCounter();

		pc.printf("Gyro X : %.2f degree/sec\r\n", gyroX);
		pc.printf("Gyro Y : %.2f degree/sec\r\n", gyroY);
		pc.printf("Gyro Z : %.2f degree/sec\r\n", gyroZ);
		pc.printf("Accel X : %.2f mg\r\n", accelX);
		pc.printf("Accel Y : %.2f mg\r\n", accelY);
		pc.printf("Accel Z : %.2f mg\r\n", accelZ);
		pc.printf("Internal Temperature : %.2f C\r\n", intTemp);
		pc.printf("Data Counter : %5d\r\n", dataCount);
		pc.printf("\r\n");
	}

	return 0;
}

Example for utilizing burst read function:

#include <mbed.h>
#include <ADIS16467.h>

int main() {
	Serial pc(USBTX, USBRX);

	//Create IMU, passing in all parameters
	//All pins here are arbitrary, you will need to configure them accordingly
	ADIS16467 imu(&pc, PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCK, PIN_ADIS_CS, PIN_ADIS_RST);

	//Initialize the IMU
	imu.initADIS();

	struct ADIS16467::BurstReadResult result;
	imu.burstRead(result);

	pc.printf("Gyro X : %.2f degree/sec\r\n", ((float)result.gyroX * imu.GYRO_CONV));
	pc.printf("Gyro Y : %.2f degree/sec\r\n", ((float)result.gyroY * imu.GYRO_CONV));
	pc.printf("Gyro Z : %.2f degree/sec\r\n", ((float)result.gyroZ * imu.GYRO_CONV));
	pc.printf("Accel X : %.2f mg\r\n", ((float)result.accelX * imu.ACCEL_CONV));
	pc.printf("Accel Y : %.2f mg\r\n", ((float)result.accelY * imu.ACCEL_CONV));
	pc.printf("Accel Z : %.2f mg\r\n", ((float)result.accelZ * imu.ACCEL_CONV));
	pc.printf("Internal Temperature : %.2f C\r\n", ((float)result.internalTemp * imu.TEMP_CONV));
	pc.printf("Data Counter : %5d\r\n", result.dataCounter);
	pc.printf("Checksum Value : %5d\r\n", result.checkSum);

	return 0;
}

If you want more, a comprehensive, ready-to-run set of examples is available on my ADIS16467-Tests repository.


All wikipages