All Collections
Step-by-step instructions
Get started with Sigfox development board
Get started with Sigfox development board

This step-by-step tutorial will enable you to start using MKRFox 1200 development board.

Omar Cruz avatar
Written by Omar Cruz
Updated over a week ago

Introduction

The Arduino MKRFox 1200 is a learning and development board which contains the ATMEL SAMD21 micro controller, designed to integrate the core's low power-consumption and high performance with the Arduino's ease-of-use. The MKRFOX1200 brings the Arduino Zero functionalities in the smaller form factor established by the Arduino MKR1000 and adding the SigFox connectivity to the Arduino platform.

Arduino MKRFOX1200 can be programmed using Arduino Software (IDE), the Integrated Development Environment common to all Arduino boards and running both online and offline (you need to download and install it). For more information on how to get started with the Arduino Software visit the Getting Started page.

Note: Please remove the black conductive foam from the MKRFox 1200 board pins before usage. If you don't remove it, the board may behave erratically.

Effort Estimate: 

* Intermediate tutorials require basic understanding of programming & familiarity with command line interface. 

What you will need:

Setup process

Connect the Hardware

  • Once the black foam is removed from MKRFox, you can connect it with USB cable to your PC/laptop. 

  • Once done, the green LED “ON” will be powered on. In case when you’ll use battery as a power source, this LED will be off, to preserve the battery level as it drains significantly faster.

Arduino IDE Setup:

  • After having MKRFox successfully connected to your machine, start the Arduino IDE previously downloaded and installed. You have the link above in the table, within project elements needed.

  • Now, go to Tools > Board > Boards Manager… and write down “Arduino SAMD”. Install the one provided by Arduino. This is needed to be able to choose MKRFox from the Arduino boards listed within the board manager. 

  • After you have installed Arduino SAMD Boards, go back to tab Tools > Board > Boards Manager… and choose “Arduino MKRFox1200”. 

Note: If your machine doesn’t recognise the MKRFox that even has LED powered on, try to press the RST button twice. The yellow LED will start blinking and Arduino will be recognised sucessfully. Just choose it from the related COM port. 

Retrieve ID and PAC numbers for Sigfox Backend

This example for a MKRFox 1200 device allows you to setup the SigFox's backend for your board.

  • After the MKRFox is selected and your machine recognised it, you can continue and copy-paste the code below into the Arduino IDE.

  • In setup() the Serial is initialized. This will allow you to insert your first SigFox message and to get the informations you need to configure the SigFox's backend. Since the MKRFox1200 doesn't have an autoreset function associated to the Serial monitor opening, a Serial while is present. We also check that the SigFox module is present and can be used. 

  • In loop() we have no instructions since we don't need to do something more.

After this, we can read our ID and PAC that you have to use to register your board.

/*

  Retrieve MKRFOX board informations needed for registration:

    * Sigfox ID

    * Sigfox PAC

*/

#include <SigFox.h>

void setup() {

  Serial.begin(9600);

  while (!Serial) {};

  if (!SigFox.begin()) {

    Serial.println("Unable to init the Atmel ATA8520 Sigfox chipset");

    return;

  }

  SigFox.debug();

  String ID = SigFox.ID();

  String PAC = SigFox.PAC();

  // Display module informations

  Serial.println("MKRFOX1200 informations");

  Serial.print("ID\t");

  Serial.println(SigFox.ID());

  Serial.print("PAC\t");

  Serial.println(SigFox.PAC());

  Serial.println("Register your board on https://buy.sigfox.com/activate");

}

void loop()

{

}
  • Upload the code on MKRFox by pressing the button Upload. Once done, it will show on the bottom “Done uploading”.

  • Open the Serial Monitor through tab Tools > Serial Monitor or Ctrl+Shift+M. You will receive very needed ID and PAC numbers for registering MKRFox on Sigfox Backend.

Register your MKRFox 

To register the board you have to navigate to the Sigfox backend. This is one time registration process, needed once for every MKRFox 1200 you own.

  1. Open the link https://buy.sigfox.com/activate and select the country where the user is residing or using it right now.

2. After that, enter your ID and PAC number which was shown on the serial monitor after uploading the above given sketch.

3. Input your credentials to get to the Sigfox portal home page.

4. After successfully created account you will receive the verification e-mail. Click on the link provided to activate your account. Now, log into Sigfox portal home page.

5. Now we have to make sure that our Downlink mode is set to Direct and not Callback! Click on the “DEVICE TYPE” tab and then click on the “Keep Alive” and click “Edit”.

6. So, put the “Downlink mode” to DIRECT to receive messages back and forth.

7. Now you can go back to the main Sigfox portal page and click on the DEVICE on top left, then click on the ID as shown in the image below.

8. Select the “MESSAGES” item on the left menu bar.

9. In this page you can see the messages. If it is sent properly, then you can see the green call back otherwise, you can see callback as a red arrow.

  1. When the configuration for callback is done properly, you can send your first message! If your message is correctly delivered you will get a response from the server similar to:

Otherwise an error message will be printed on the serial monitor.

  • Complete code:

/*

  SigFox First Configuration

  This sketch demonstrates the usage of MKRFox 1200 SigFox module.

  Since the board is designed with low power in mind, it depends directly on ArduinoLowPower library

  This example code is in the public domain.

*/

#include <SigFox.h>

#include <ArduinoLowPower.h>

void setup() {

  Serial.begin(9600);

  while (!Serial) {};

  // Uncomment this line and comment begin() if you are working with a custom board

  //if (!SigFox.begin(SPI1, 30, 31, 33, 28, LED_BUILTIN)) {

  if (!SigFox.begin()) {

    Serial.println("Shield error or not present!");

    return;

  }

  // Enable debug led and disable automatic deep sleep

  // Comment this line when shipping your project :)

  SigFox.debug();

  String version = SigFox.SigVersion();

  String ID = SigFox.ID();

  String PAC = SigFox.PAC();

  // Display module informations

  Serial.println("MKRFox1200 Sigfox first configuration");

  Serial.println("SigFox FW version " + version);

  Serial.println("ID  = " + ID);

  Serial.println("PAC = " + PAC);

  Serial.println("");

  Serial.print("Module temperature: ");

  Serial.println(SigFox.internalTemperature());

  Serial.println("Register your board on https://buy.sigfox.com/activate with provided ID and PAC");

  Serial.println("/!\ The displayed PAC is the factory value. It is a throw-away value, which can only be used once for registration.")

  Serial.println("If this device has already been registered, you can retrieve the updated PAC value on https://backend.sigfox.com/device/list");  

  Serial.println("Join the Sigfox Builders Slack community to exchange with other developers, get help .. and find new ideas! https://builders.iotagency.sigfox.com/");

  delay(100);

  // Send the module to the deepest sleep

  SigFox.end();

  Serial.println("Type the message to be sent");

  while (!Serial.available());

  String message;

  while (Serial.available()) {

    message += (char)Serial.read();

  }

  // Every SigFox packet cannot exceed 12 bytes

  // If the string is longer, only the first 12 bytes will be sent

  if (message.length() > 12) {

    Serial.println("Message too long, only first 12 bytes will be sent");

  }

  Serial.println("Sending " + message);

  // Remove EOL

  message.trim();

  // Example of message that can be sent

  // sendString(message);

  Serial.println("Getting the response will take up to 50 seconds");

  Serial.println("The LED will blink while the operation is ongoing");

  // Example of send and read response

  sendStringAndGetResponse(message);

}

void loop()

{

}

void sendString(String str) {

  // Start the module

  SigFox.begin();

  // Wait at least 30mS after first configuration (100mS before)

  delay(100);

  // Clears all pending interrupts

  SigFox.status();

  delay(1);

  SigFox.beginPacket();

  SigFox.print(str);

  int ret = SigFox.endPacket();  // send buffer to SIGFOX network

  if (ret > 0) {

    Serial.println("No transmission");

  } else {

    Serial.println("Transmission ok");

  }

  Serial.println(SigFox.status(SIGFOX));

  Serial.println(SigFox.status(ATMEL));

  SigFox.end();

}

void sendStringAndGetResponse(String str) {

  // Start the module

  SigFox.begin();

  // Wait at least 30mS after first configuration (100mS before)

  delay(100);

  // Clears all pending interrupts

  SigFox.status();

  delay(1);

  SigFox.beginPacket();

  SigFox.print(str);

  int ret = SigFox.endPacket(true);  // send buffer to SIGFOX network and wait for a response

  if (ret > 0) {

    Serial.println("No transmission");

  } else {

    Serial.println("Transmission ok");

  }

  Serial.println(SigFox.status(SIGFOX));

  Serial.println(SigFox.status(ATMEL));

  if (SigFox.parsePacket()) {

    Serial.println("Response from server:");

    while (SigFox.available()) {

      Serial.print("0x");

      Serial.println(SigFox.read(), HEX);

    }

  } else {

    Serial.println("Could not get any response from the server");

    Serial.println("Check the SigFox coverage in your area");

    Serial.println("If you are indoor, check the 20dB coverage or move near a window");

  }

  Serial.println();

  SigFox.end();

}

Libraries needed:

For the code above, you will need additional libraries to install. Just click on the tab Sketch > Include Library > Manage Libraries. Install these three libraries:

  • Arduino Sigfox for MKRFox1200

  • Arduino Low Power

  • RTCZero

Important to read!

In this section we have collected some information that is worth reading to use your MKRFox 1200 board properly. Some behaviours differ from the Arduino Uno board and if you come from a former experience with that board, it is worth spending a few minutes reading through these notes. If this is your first board, we suggest you have a look at them anyway.

Operating Voltage

The microcontroller on the MKRFOX1200 runs at 3.3V. Applying more than 3.3V on any pin may damage the board!

Serial ports on the MKRFOX1200

The MKRFOX1200 has a number of facilities for communicating with a computer or other microcontrollers. 

The USB connector exposes as a virtual serial port that can be controlled by writing and reading to the Serial object. Pins 13/14, instead, expose a Hardware serial port mapped to Serial1 object.

Opening and closing the USB Serial port at a baud rate other than 1200bps will not reset the board. To use the serial monitor, and see what your sketch does from the beginning, you'll need to add few lines of code inside the setup(). 

This will ensure the board will wait for the serial port to open before executing the sketch: 

while (!Serial) ; 

Pressing the Reset button on the MKRFOX1200 causes the microcontroller to reset as well as resetting the USB communication. 

This interruption means that if the serial monitor is open, it's necessary to close and reopen it to restart the communication. 

Drivers

On Windows, drivers are needed to allow the board communication. These drivers will be installed automatically when adding the core

On MacOSX and Linux no driver is needed.

For more details on the Arduino MKRFOX1200, see the product page

Related Articles:

Did this answer your question?