FANDOM


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).

SetupEdit

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, 4.2.3.17 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:
 Serial.begin(9600);
 Serial2.begin(9600);
}
void loop() {
 // read from port 1, send to port 0:
 int count=0;
 while (count <400){
   while (Serial2.available()) {
     int inByte = Serial2.read();
     Serial.print(inByte, BYTE); 
     count++;
   }
 }
 Serial2.println("@F0.3?*54");
}


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

SoftwareEdit

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

byte input;
void setup()
{
 Serial.begin(9600);
 Serial3.begin(19200);
}
void loop()
{
  if(Serial3.available()>0){
    input = Serial3.read();
    Serial.print(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. http://www.google.ca/url?sa=t&source=web&cd=3&ved=0CCEQFjAC&url=http%3A%2F%2Fgpsd.googlecode.com%2Ffiles%2Ftruenorth-reference.pdf&ei=jLn-TLaTAtvtnQeE1KGgCw&usg=AFQjCNFKgSCpWdeEoXWtQQiYeHJYXeXQ-g;

Mailing list discussing client/TNT compass interactions

HardwareEdit

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)

InfoEdit

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

SENTENCE OUTPUT RATEEdit

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

Example:

$PTNTHTM,71.3,N,-0.4,N,-1.4,N,75.9,2618*03
Name Example
Message ID $PTNTHTM
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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.