ARGOS ARTIC R2 Satellite Transceiver Shield Hookup Guide

Pages
Contributors: PaulZC
Favorited Favorite 2

Arduino Example: Satellite Detection

The SparkFun ARGOS ARTIC R2 Arduino Library contains a full set of tried and tested examples which will run on the Artemis Thing Plus when connected to the ARTIC R2 Shield. The examples will run on other Arduino boards, but you will need to change the pin definitions in the code to match your board.

The code below is a stripped-down version of Example4_SatelliteDetection. Copy and paste the code into a new window in the Arduino IDE:

language:c
#include <SPI.h>
#include "SparkFun_ARGOS_ARTIC_R2_Arduino_Library.h" // http://librarymanager/All#SparkFun_ARGOS_ARTIC_R2
ARTIC_R2 myARTIC;

// Pin assignments for the SparkFun Thing Plus - Artemis
// (Change these if required)
int CS_Pin = 24;
int GAIN8_Pin = 3;
int BOOT_Pin = 4;
int INT1_Pin = 5;
int INT2_Pin = 6;
int RESET_Pin = 7;
int ARTIC_PWR_EN_Pin = 8;
int RF_PWR_EN_Pin = 9;

void setup()
{
  Serial.begin(115200);
  Serial.println(F("ARGOS ARTIC R2 Example"));

  Serial.println(F("ARTIC R2 is booting..."));

  SPI.begin();

  //myARTIC.enableDebugging(); // Uncomment this line to enable debug messages on Serial

  // Begin the ARTIC: enable power and boot from flash
  if (myARTIC.begin(CS_Pin, RESET_Pin, BOOT_Pin, ARTIC_PWR_EN_Pin, RF_PWR_EN_Pin, INT1_Pin, INT2_Pin, GAIN8_Pin) == false)
  {
    Serial.println("ARTIC R2 not detected. Freezing...");
    while (1)
      ; // Do nothing more
  }

  Serial.println(F("ARTIC R2 boot was successful."));

  // Read the Platform ID from flash memory
  uint32_t platformID = myARTIC.readPlatformID();
  if (platformID == 0)
  {
    Serial.println(F("You appear to have an early version of the SparkFun board."));
    Serial.println(F("For the transmit examples, you will need to use the Library Manager to select version 1.0.9 of this library."));
  }
  else
  {
    Serial.print(F("Your Platform ID is: 0x"));
    Serial.println(platformID, HEX);
  }

  myARTIC.setTCXOControl(1.8, true); // Set the TCXO voltage to 1.8V and autoDisable to 1

  myARTIC.setSatelliteDetectionTimeout(600); // Set the satellite detection timeout to 600 seconds

  Serial.println(F("Starting satellite detection..."));

  // Start satellite detection
  // The ARTIC will start looking for a satellite for the specified amount of time.
  myARTIC.sendMCUinstruction(INST_SATELLITE_DETECTION);
}

void loop()
{
  delay(1000);

  // Read the ARTIC R2 status register
  ARTIC_R2_Firmware_Status status;
  myARTIC.readStatusRegister(&status);

  // Check the interrupt 2 flag. This will go high if satellite detection times out
  if (status.STATUS_REGISTER_BITS.DSP2MCU_INT2)
  {
    Serial.println(F("INT2 pin is high. Satellite detection has timed out!"));
  }
  // Check the interrupt 1 flag. This will go high when a satellite is detected
  else if (status.STATUS_REGISTER_BITS.DSP2MCU_INT1)
  {
    Serial.println(F("INT1 pin is high. Satellite detected!"));
  }

  // Check the instruction progress
  // checkMCUinstructionProgress will return true if the instruction is complete
  ARTIC_R2_MCU_Instruction_Progress progress;
  boolean instructionComplete = myARTIC.checkMCUinstructionProgress(&progress);

  if (instructionComplete)
  {
    Serial.println(F("Satellite detection is complete! Freezing..."));
    while (1)
      ; // Do nothing more
  }
}

Save the file and click on the Upload button to upload the example onto the Artemis:

Pictured is the Arduino I D E upload button

Open Tools\Serial Monitor to see the serial messages from the Artemis.

Check that the baud rate is set to 115200:

Pictured is the Arduino I D E serial monitor

The two red power LEDs and the yellow RX LED on the Satellite Transceiver Shield will light up when the code is running.

Once the ARTIC R2 has booted, the code will read the pre-programmed Platform ID from flash memory. If it does not find one, you will see a message reminding you to install v1.0.9 of the ARTIC R2 library.

The ARTIC R2 will try to detect a satellite for up to 10 minutes. You may wish to log into the ARGOS website and predict when the next satellite pass will take place before running this example.