This project is a tutorial about how to create a IoT device with Azure Sphere MT3620 Development Kit that uses the Sigfox Network to send data to Azure IoT Hub. Sigfox is an LPWAN (Low power wide area network) design for IoT solutions, many companies assembly modem to talk with this network, but the development kits are expensive. Because of that, we design an open source PCB to soldering the Wisol Sigfox modem, and we did an end-to-end to test if it was working correctly.
This board layout could be download here: https://easyeda.com/walter.coan/sigfoxSFM10R2
The Wisol Sigfox modem needs to be register into Sigfox backend website, this process is explained in detail on my other tutorial: https://www.hackster.io/waltercoan/open-source-breakout-board-sigfox-to-send-data-to-azure-iot-74a3f5
Connecting Azure Sphere to Wison Sigfox ModemThis two devices uses the RS232 protocol to comunicate, and they TX and RX port use 3.3v as logical level. This make very easy to wire the modules, from Azure Sphere Dev Kit we use this ports:
H2 (Header 2)pin 1 - RXpin 3 - TX
H3 (Header 3)pin 2 - GNDpin 3 - 3.3v
The connections will be like that:
Azure Sphere GND - Sigfox board GNDAzure Sphere 3.3v - Sigfox board VCCAzure Sphere TX - Sigfox board RXAzure Sphere RX - Sigfox board TX
SoftwareTo write a new program into your Azure Sphere Dev Kit you need Visual Studio 2017 and the Azure Sphere SDK Preview for Visual Studio. Then you can create a new project using the example code to send data through serial UART ports. To do that, on the Visual Studio select the options File -> New -> Project and in the wizard screen select Visual C++ -> Azure Sphere -> UART Sample... and cofirm with OK.
This sample code creates an application that connect using serial UART to a device and send messages. Just simple modifications needs to be done to Azure Sphere send messages using Sigfox, the first change is the InitPeripheralsAndHandlers method, the Sigfox modem works with the baudrate 9600, and you need to specify that.
This constant MT3620_RDB_HEADER2_ISU0_UART define what serial port on the board will be used to comunicate with the another device.
The last modification on the code, is to set our message using the AT serial command from Wisol modem manual. We use two commands,
AT$RC\n\r - this command inicialize the comunicationAT$SF=ByteSequence - this command send a byte sequence to Sigfox Network
When you run your code in Visual Studio they will be transfered to Azure Sphere, and if you press the A button you will see the output messages confirmation.
If you are logged on Sigfox backend you can see the message arrives and then callback the Azure IoT Hub, using the Device Explorer Twin app, you see that this message takes only a fell seconds to travel through Sigfox server to Azure IoT Hub and then to the Device Explorer.
This is the final demonstration!!!
This tutorial shows how easy is to use serial UART from Azure Sphere MT3620 to send data through Sigfox Network and than receve this into Azure IoT Hub.
Comments