Magnetic DeclinationEdit

The wikipedia article talks about what magnetic declination is.

"True Bearing equals Magnetic Bearing plus Magnetic Declination."

GPS probably returns true north. We need to either set up the compass so that it adjusts, or set our code to adjust (probably easier to change since it wouldn't involve looking up the compass manual).


Find "Revolution GS Truenorth Programming Reference.pdf" on dropbox; read Ch. 3 for background. The compass is in SAMPLE mode.

Software%20Manuals/Revolution%20GS%20Software%20and%20Mounting%20User%27s%20Guide.pdf has instructions about how to calibrate with the software, which is on a CD in the bay.

Also, discusses compass Deviation settings; these need to be checked, to see if the compass is already correcting for them, and then perhaps adjusted in code, or changed for different locations on the compass EEPROM.

Changing EEPROM SettingsEdit

Under the plastic covering of the compass there is an 8 pin header. It's pins are detailsed in Cables.pdf on the hardware manuals folder of dropbox.

When connecting to arduino through this header, 9600 baud rate must be used. It also must be connected through the RS232 level shifter. The innermost pin is pin 1 (power, connect to pin 4 of the LS); then pin 2 (RX out, connect to pin 2), pin 3 (TX in, pin 3), and ground is pin 6 (pin 5). The other pins on the header are for RS485.

To modify compass EEPROM settings with this, use the Revolution GS Programming Reference.pdf on the Software Manuals folder of dropbox, and the following code worked (using println is critical to talk to compass):

void setup() {
 // initialize both serial ports:
void loop() {
 // read from port 1, send to port 0:
 int count=0;
 while (count <400){
   while (Serial2.available()) {
     int inByte =;
     Serial.print(inByte, BYTE); 

This also works at 19200 (the present baud rate of the compass) for Serial2 through the RJ12 header (rather than the 8 pin header under the hood).

On arduinoEdit


The following code was used to read in data from the compass to Arduino:

byte input;
void setup()
void loop()
    input =;

Compass Data has sample data from the compass. The compass manual, describing how to change the data settings stored in EEPROM is available on the dropbox.;

Mailing list discussing client/TNT compass interactions


rs232/ttl shifter

compass user guide This is how it was setup:

Compass | Converter  |Arduino
3 | 2 -> TX | RX3
2 | 3 -> RX | TX3
Compass Converter Arduino
3 2->TX RX3
2 3->RX TX3

Wires and power: The compass was connected with a DB9 wire adapter, to put the pins into the breadboard. The compass power was 5V off of the arduino to compass pin 4; ground to pin 5. RS232/TTL converter on RS232 side ground pin 5 to ground on breadboard, using a DB9 to wire adapter. RS232/TTL converter on TTL side ground to arduino, signals as above, Vcc to 5V from arduino.

(image to follow)


TSRevolutionGSCompassCables.pdf on the dropbox/Hardware folder has the compass's required pin connections.

Serial info: 38400 bps, 8N1

The wiring hardness has both a power connector and a signal connector:

  • Power: 5V red, ground white
  • Signal: Ground pin 5, RX pin 2, TX pin 3
  • Internal (to compass, connections inside the DB9): Ground yellow pin 5, power black pin 4, RX red pin 2 (?? connect this to pin 2 to communicate), TX green pin 3

To test compass with hyperterminal, connect the power and signal cable to it; 5V to the power (easy to do with 5V wall adapter and the wall adapter to header connection board with fuse); connect a serial cable to COM1 of computer (serial port on back); connect signals:

  • ground to ground (pins 5)
  • pin 2 to pin 3
  • pin 3 to pin 2

only works if both pin 2, 3 are connected.

The compass is configured and calibrated using a set of commands sent to it via its serial port connection


The compass is programmed with an output rate and it sends sentences at this fixed rate. The rate is programmed with the <esc>R command. Values lower than 1 per second use a negative number, -100 is 0.01hz, -10 is 0.1 hz, -2 is 0.5hz. Values greater than 0 are in sentences per second, HZ. A value of 10 is 10hz, 40 is 40hz and so on. If you program a rate of 0 the compass will cease output but still respond to <esc> commands.

<ESC>R Set the compass output rate, -50 to +40. Rate is in samples per second and negative are seconds per sample. .i.e. 20=20 samples/second, -10=10 seconds per sample. A rate of 0 will stop output

Information comes from Oceanserver Compass Manual

Serial Data FormatEdit


Name Example
Heading 71.3
Heading Status Indicator N
Pitch -0.4
Pitch Status Indicator N
Roll -1.4
Roll Status Indicator N
Dip 75.9
Magnetic Field (?) 2618
Checksum *03

Status indicators can be 'N', 'O', 'M', or 'P'. 'N' seems to be the data valid indicator.

Community content is available under CC-BY-SA unless otherwise noted.