smôl ARTIC R2 Hookup Guide

Contributors: PaulZC
Favorited Favorite 0

Arduino Example: Satellite Detection

If you are using the smôl ESP32 Processor Board, you are going to want to install the CP210x USB Driver and Arduino Boards Package for the ESP32 first. Please see the smôl ESP32 Hookup Guide for more details.

The smôl ARTIC R2 peripheral board is fully compatible with the SparkFun ARGOS ARTIC R2 Arduino Library. You can install the library through the Arduino IDE Library Manager by searching for SparkFun ARGOS ARTIC. Alternatively, you can grab the library from GitHub or can download it as a zip file by clicking the button below:

The library contains tried-and-tested dedicated examples for the smôl ARTIC R2. The code below is a stripped-down version of Example3_SatelliteDetection. Copy and paste the code into a new window in the Arduino IDE and upload to the ESP32. 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.

#include <Wire.h> //Needed for I2C to ARTIC R2 GPIO
#include <SPI.h>
#include "SparkFun_ARGOS_ARTIC_R2_Arduino_Library.h" // http://librarymanager/All#SparkFun_ARGOS_ARTIC_R2

int CS_Pin = 5;            // smôl CS0 = ESP32 Pin 5
int ARTIC_PWR_EN_Pin = 27; // smôl GPIO0 = ESP32 Pin 27

void setup()
  Serial.println(F("ARGOS smôl ARTIC R2 Example"));

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

  Wire.begin(); // Needed to communicate with the I2C GPIO chip on the smôl ARTIC R2

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

  // Begin the ARTIC: enable power and boot from flash
  if (myARTIC.beginSmol(CS_Pin, ARTIC_PWR_EN_Pin) == false)
    Serial.println("ARTIC R2 not detected. Please check the smôl stack-up and flexible circuits. Freezing...");
    while (1)
      ; // Do nothing more

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

  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.

void loop()

  // Read the ARTIC R2 status register
  ARTIC_R2_Firmware_Status status;

  // Check the interrupt 2 flag. This will go high if satellite detection times out
    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
    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