MKRFOX1200

Valerio Vaccaro
4 min readJan 18, 2018

--

Another Arduino?

Yes and no.

MKRFOX1200 is a new board that allows us to deploy new kind of projects due to peculiar characteristics:

  • compatible with battery powered scenarios due to the low power consumption of Cortex-M0+
  • able to communicate short messages without internetconnection
  • 100% compatibles with Arduino ecosystem (same IDE, same libs, …)

If you are interested in technicalities:

  • SAMD21 Cortex-M0+ 32bit low power ARM MCU
  • Many digital and analogic I/O Pins
  • 256 KB of flash memory
  • SigFox radio @868MHz
  • External antenna

Wait! What is SigFox?

SigFox is a French company that developed a UNB-based (UltraNarrowBand) technology in the area of Low-Power Wide-Area Network (LPWAN).

This technology allows long-range wireless communication at a low bit rate compatible with battery powered sensor boards.

The SigFox network allows a subscription service in which you can send 140 messages (around 1 message every 11 minutes) of 12 bytes and you can also receive 4 messages per day. The backend will maintain all the messages and allow the communications from the internet.

OK! Now help me to make it work!

Firmware upload

The first step is to upload a firmware for extract information useful for configuration and for test the board. You can use Arduino IDE adding the support for the MKRFOX 1200 board and some libraries (like Arduino Low Power).

/*
SigFox First Configuration
This sketch demonstrates the usage of MKRFox1200 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) {};
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://backend.sigfox.com/activate with provided ID and PAC”);
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();
}

After upload opens the serial terminal and copies ID and PAC codes, you will need this code in order to register your board.

Register on SigFox backend

Open browser and go to activation website https://backend.sigfox.com/activate, then choose Arduino in the first page …

… then select your country …

… and insert the ID and PAC of your board!

Turn on board, write on serial terminal and you will see new messages on the web interface.

Get data via callback

The easiest way to receive data is to set a Callback, so for each message, the system will send a request to a web service passing the information received.

The creation of a callback is available editing the Device Type tab and following the configuration mask.

In my case, I send this messages to a Node-RED web service in order to process with this platform … but we will see this in another article.

--

--

Valerio Vaccaro

Engineer, Bitcoiner, Data Scientist, IoT Expert and Tech Enthusiast. Co-founder of @scamcoinbot. Dad of @otsproofbot.