SPI Sensors The ASALT vehicle uses the Serial Peripheral Interface (SPI) bus to communicate with two sensing devices. These devices allow the vehicle to acquire information about its tilt and heading. For tilt sensing, the vehicle uses an Analog Devices ADIS16300 Inertial Measurement Unit (IMU). To obtain heading, a PNI V2Xe 2-axis digital compass is used. IMU The ADIS16300 contains a 3-axis accelerometer as well as a gyroscope which allows the device to accurately calculate pitch and roll readings. Pitch is described as the rotation about the y-axis of the vehicle, and roll is described as rotation about the x-axis. The vehicle’s code receives pitch and roll readings from the IMU and converts them to degrees. These readings are used for diagnostic data that will be returned via status updates to the UI as well as for calculating a tilt-compensated heading. Figure X: Pitch and Roll as it relates to the ASALT vehicle We chose the ADIS16300 since it was relatively low cost, and it was capable of calculating pitch and roll internally using its own X,Y,Z-axis acceleration values as well as gyroscope readings. This allows us to quickly query the IMU for these values as they are needed during the navigation routine. Digital Compass We chose a V2Xe to serve as our digital compass since it is low cost and small in size. Typically 3-axis compasses take up a large amount of space. Since the V2XE is a 2-axis sensor, we are able to obtain heading information accurately while conserving space and cost. The digital compass contains two PNI SmartSens magnetometers oriented perpendicular from each other to sense X and Y magnetic field readings from the surrounding environments. Using these readings and an onboard microcontroller, the V2Xe is capable of computing a heading with a resolution of 0.01 degrees when the device is flat. The V2Xe implements hard and soft iron corrections to the raw X and Y readings. This means that it can be calibrated in an environment that may have external magnetic forces. For the ASALT vehicle, the magnetic fields generated from the chassis and motors were significant enough to cause the un-calibrated compass to give false readings. As a result, we included functionality to calibrate the compass in the vehicle’s command mode. By calibrating the compass in its host environment, we were able to obtain accurate heading readings while the compass was exposed to these external magnetic forces. In the future, the iNRG researcher may choose to relocate the compass position, and as a result of the calibration functionality, they will be able to successfully re-calibrate the compass to obtain accurate readings. Tilt Compensation Like with traditional compasses, digital compasses only provide accurate heading information when it is oriented horizontal with the Earth’s surface. When the compass is tilted, the magnetic readings from the X and Y axis sensors provide readings relative to the tilted reference frame. This causes significant error in heading readings. To deal with this issue, we implemented a tilt compensation algorithm described by a paper written by Samsung engineers Seong Yun Cho and Chan Gook Park. Their paper was targeted at mobile applications where a compass unit could be oriented to any direction, but pitch and roll are available. Their equations generate X and Y readings that have been corrected to the horizontal reference frame. The equations are as follows: a Xmag *cos Ymag * sin * sin Zmag * sin * cos b Ymag * cos Zmag * sin b heading arctan( ) a Where and denote pitch and roll, respectively. These values are obtained directly from the IMU and applied to the sensor magnitudes obtained by the digital compass. The V2Xe only provides Xmag and Ymag , fortunately Cho and Park provide the following equation to approximate Zmag : sin Xmag * sin Ymag * cos * sin Zmag cos * cos Where denotes the dip angle at the present location. Using a calculator provided by the National Geophysical Data Center (NGDC), we were able to determine the dip angle for Santa Cruz, CA is about 60.65 degrees. http://www.ngdc.noaa.gov/geomagmodels/Declination.jsp As a result of the compensation algorithm, the heading is improved, although some error still exists. The following graph shows the error of the uncompensated heading and compensated heading for the same sample. For this test, we pointed the compass to 278 degrees, then tilted it to ±20 degrees of roll. Compensated and Uncompensated Compass Readings 60 Heading Error (degrees) 50 40 30 20 Compensated 10 Uncompensated 0 -10 1 51 101 151 201 251 -20 -30 Data Samples The results show that the tilt compensation algorithm reduces the significant error observed with the uncompensated heading. The correction is not perfect, however, it still demonstrates an average error of about 10 degrees, even when compensated. This error is substantial, but satisfactory for our application because the GPS module provides an accurate heading that is independent of vehicle tilt. The compass will still be used when the vehicle is stationary because the GPS heading can only be used when the vehicle is in motion.