Project tutorial

Publish Any Event to Wia Using Your MKR FOX 1200 © MIT

How to set up a MKR FOX 1200 and publish an event or location through Sigfox to Wia.

  • 168 views
  • 0 comments
  • 0 respects

Components and supplies

Apps and online services

About this project

Components

  • Arduino MKRFox1200
  • Sigfox Antenna
  • Micro USB to USB

Setup Your Environment

If you have not already done, download and install the Arduino IDE for your chosen operating system here

  • Open the IDE and go to `Tools > Boards > Board Manager
  • Search for the Arduino SAMD Boards
  • Install the board's core library

Arduino board manager

Connect the Board to your Computer

Using a micro USB cable, connect the micro USB port on the board to the USB port on your computer.

Install Sigfox Library

  • Go to Sketch > Include Libraries > Manage Libraries
  • Type SigFox into the search bar and click the first option. A button will appear in the bottom right of the box that will allow you to install the library

Sigfox Library

Select Board and Port

In Tools

  • Select the Arduino MRKFox1200 board
  • Select the correct port (Arduino MRKfox1200 should be on the port name):

Once you've got it connected to your computer, get the name of your device using one of the following steps:

Linux and Mac OS X

  • Open a terminal window and run the command ls /dev/tty.*
  • Look for a device with the name that begins with /dev/tty.usbmodem e.g. /dev/tty.usbmodemPy343431 or /dev/ttyACM0.

Windows

  • Download and install the FTDI drivers from here.
  • Open the Windows start menu and search for 'Device Manager'
  • The COM port for the Pycom device will be listed as 'USB Serial Device' or something similar
  • Keep note of the COM port (e.g. COM4)

Note: For Linux, you may need to run the following commands and restart the Arduino Ide to add permissions to upload a sketch to the board

sudo usermod -a -G tty ${USER}sudo usermod -a -G dialout  ${USER}

Create a new Sketch

Create a new file called sketch_sigfox_init.ino and add the code listed at the bottom named "Publish an Event to Sigfox".

*The code just waits until the Serial has begun. This makes sure Sigfox is connected and prints the Device ID and PAC number of the Device.

Upload Code to the Board

Click Sketch > Upload to upload the code to your Device to retrieve the ID and PAC number of the device.

View the Serial Monitor

  • Click the Screen Monitor Icon on the right hand side
  • In the monitor, it should display the ID and PAC for the device

Board ID and Pac Numbers

Register Device with Sigfox

  • Click here to register the Device with SigfoxChoose the providerArduinofrom the list Then, choose the appropriate country

Sigfox providers

Enter Device information

*Enter the ID and PAC of your device into Sigfox

Sigfox Device ID and PAC

Once entered, you must sign in or sign up to a Sigfox account to view your Device on the Sigfox Dashboard.

The Code

Create a new file called sketch_sigfox.ino and add the code below named "Publish an Event to Wia".

Make sure that

  • Tools > Boards is set to Arduino MRKfox1200
  • Tools > Port is set to the port of the board
  • SigFox.beginPacket() & SigFox.endPacket() are the wrappers for the payload
  • The data is placed between the wrappers and has a max size of 12 Bytes
  • Strings will be converted to hexadecimal

Upload the Code

  • Click Sketch > Upload to upload the code for MRKfox1200
  • You can view the output from the serial monitor on the right of the screen

Receiving the Message on Sigfox dashboard

  • Go to the Sigfox dashboard, the link is here
  • On your Sigfox account, click on the Device tab, click on your Device ID and click Messages

Sigfox message

  • The payload will be displayed in hexadecimal
  • Convert to ASCII to view your message

Connecting Sigfox with Wia

First, Sigfox must be integrated with Wia to see your Sigfox messages in Wia.The tutorial can be accessed here

Receiving the message on Wia

If the callback has been properly setup between Sigfox and Wia, the message should also be displayed in Wia

  • Go to your Space that has your Sigfox integration
  • Click on Device that matches the Sigfox device on the Sigfox website
  • Click on the events tab and Sigfox message should be displayed

Code

Publish an Event to SigfoxArduino
#include <SigFox.h>   // must include the SigFox library
  
void setup() {
  Serial.begin(9600); 
  while(!Serial) {}; //waits for Serial to be available
  if (!SigFox.begin()) { //ensures SigFox is connected
    Serial.println("Shield error or not present!");
    return;
  }
  
  String version = SigFox.SigVersion();
  String ID = SigFox.ID();
  String PAC = SigFox.PAC();

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

  delay(100);

  // Send the module to the deepest sleep
  SigFox.end();
}

void loop() {
}
Publish an Event to WiaArduino
#include <SigFox.h>   // must include the SigFox library

void setup() {
  Serial.begin(9600); 
  while(!Serial) {}; //waits for Serial to be available
  if (!SigFox.begin()) { //ensures SigFox is connected
    Serial.println("Shield error or not present!");
    return;
  }
  Serial.print("sending");
  Serial.print(SigFox.internalTemperature())
  SigFox.begin();
  SigFox.beginPacket();
  SigFox.print(SigFox.internalTemperature()); //content of the packet
  
  SigFox.endPacket();
  Serial.print("sent");
}
void loop() {
  while(1);
}

Schematics

Arduino MKR FOX 1200
Mkrfox fritzing bxbxycunhj

Comments

Similar projects you might like

Smart Access [Home/Office Automation]

Project in progress by Ajmal Muhammad P

  • 1,697 views
  • 5 comments
  • 9 respects

Internal Timers of Arduino

Project tutorial by Marcazzan_M

  • 5,180 views
  • 10 comments
  • 35 respects

SPCPM (Solar Powered City Pollution Monitor)

Project tutorial by 5 developers

  • 3,936 views
  • 0 comments
  • 18 respects

Mini CNC Laser Wood Engraver and Laser Paper Cutter

Project tutorial by Maggie Shah

  • 4,836 views
  • 0 comments
  • 29 respects

Smart Talking Humanoid Robot Just with Arduino!

Project tutorial by ashraf_minhaj

  • 837 views
  • 2 comments
  • 10 respects

Sigfox kWh Meter

Project tutorial by jassak

  • 4,894 views
  • 3 comments
  • 12 respects
Add projectSign up / Login