Things used in this project
|SORACOM Air Global IoT SIM||× 1|
|Arduino MKR GSM 1400||× 1|
Software apps and online services
|SORACOM Air IoT Connectivity Platform||× 1|
|SORACOM Harvest||× 1|
As IoT progresses, we see more and more developers taking advantage of ready-made boards that include everything from processing units to wireless connectivity modules.One such board is Arduino’s recently released MKR GSM 1400, based on the popular Arduino MKR family. The board includes a Cortex-M0+ 32-bit microcontroller, USB Serial port for development and debugging, and most importantly a pre-integrated cellular modem compatible with global 2G and 3G GSM networks. It also features low-power functionality, allowing us to build solutions that can run solely on battery.
Let's look at how to use the MKR GSM 1400 to collect and visualize data from a battery operated IoT sensor over a cellular connection.
To build this project, you will need the following items:
1. Activate the SIM and set up the data environment
We’ll start by activating the SIM card:Once you have the SORACOM SIM in hand, go to the Soracom User Console: https://console.soracom.ioGo to SIM Management and select REGISTER
Now we can prepare the data storage and analytics environment. First, we’ll create a Group and attach the SIM to it. Groups allow you to activate and configure specific services for specific SIMs. In this case, we’ll use SORACOM Harvest, which allows for quick data storage and visualization from connected devices.
2. Connect the MKR GSM 1400 and sensor
Now that the Soracom platform side has been configured, let’s assemble the sensor device.
This project wiring is as follows (you can see the pin names/numbers on the side of your MKR board):RED: MKR GSM 1400 VCC to DHT11 VCC BLACK: MKR GSM 1400 GROUND to DHT11 GROUND BLUE: MKR GSM 1400 pin 0 to DHT11 DATA
Once your Arduino and Sensor have been assembled, connect your the Micro-USB cable to it and to your computer. The end product should look like the one below:
3. Load the IDE and sensor library
Now that our SIM card & Soracom Platform have been configured and Arduino MKR GSM assembled, we’ll write the device software and upload it to the Arduino Board.To get started, download the Arduino IDE at https://www.arduino.cc/en/Main/Software?Once the Arduino IDE has been installed on your computer, you’ll need to download additional board support. Start the Arduino IDE and install it from the top menu Tools > Board > Boards Manager:
4. Code the board and connect to SORACOM HarvestNow the fun starts. With all the Libraries installed, we’re ready to code the Arduino board. You can find sample code in our Github project athttps://github.com/alexissusset/soracom-mkrgsm1400Click on “Clone or Download” button to get a copy of and double click on MKRGSM_1400_DHT_HARVEST.ino to open it in Arduino IDE.
The console will look as shown below and will show you if the device is working as expected:
As you can see in the above console, our DHT11 sensor is working and we were able to send data to Soracom Harvest.
5. Visualise the dataNow to visualise your data, go back to Soracom Console, select your SIM card in the list and click on top menu Actions > Harvest Data.
You will be presented with a graph showing your sensor data along with the full list of collected data points.
That’s it! You now have a cellular-connected MKR GSM 1400 Sensor that will work anywhere you have coverage. If you’d like to run the device independently from a computer, you can plug it directly to a USB power source such as a phone charger or USB Battery.
As well as automatically visualising you data on single or multiple devices, Harvest will also let you query the data via our APIs and CLI so you can integrate it into your applications and processes.