This tutorial refers to a product that has reached its end-of-life status.

MKR GSM 1400 Voice Call

Place an outgoing voice call to a number of your choosing.


In this tutorial, we will use an example from the MKRGSM library called MakeVoiceCall. With it, we will set up the MKR GSM 1400 to create outgoing calls to a number of our liking. The example includes a serial interface that allows us to enter a number, place a call, and hang up on the call.

Special thanks to Javier Zorzano for providing the sample code in this tutorial.


The goals of this project are:

  • Make a voice call from the MKR GSM 1400.

Hardware & Software Needed

Enter Component/feature Name Here

As the MKR GSM 1400 board is capable of connecting to the GSM network, we also have the possibility to place and receive calls. This feature can be incredibly useful for controlling devices remotely, particularly those in rural / inaccessible areas.

As most of us know, the past decades has seen a massive increase in the use of smartphones, and with it, the infrastructure for cellular communication has developed significantly. This means more coverage and more reliable services, and an ideal platform to use for IoT projects.

Useful Scenarios

In this tutorial we will focus on just making an outgoing call. There are some scenarios where this might prove useful:

  • Notification - A great way of creating reminders for yourself is to have someone actually call you. We can for example setup the board to call you at exactly 6.30 every morning, or at 17.00 to remind you to walk the dog!

  • System alert - We can also be use it in a more professional capacity. If we are creating an application in a remote location that we cannot access directly, we can set up the board to call you in case something goes wrong. This could for example be overheating, water detected or a gas leak.

  • Security alert - Similar to a system alert, we can set up the board to call you in case a sensor has detected any activity.

Note: The above are suggestions on what to use the MKR GSM 1400's voice call functionality. Please consult an expert if you attempt to build a security system for your home or business.


The circuit of this board is easy. Simply connect the antenna to the MKR GSM 1400 board and you are good to go!

Simple circuit with board and antenna.
Simple circuit with board and antenna.

Programming the Board

We will now get to the programming part of this tutorial.

1. First, let's make sure we have the drivers installed. If we are using the Web Editor, we do not need to install anything. If we are using an offline editor, we need to install it manually. This can be done by navigating to Tools > Board > Board Manager.... Here we need to look for the Arduino SAMD boards (32-bits ARM Cortex M0+) and install it.

2. Now, we need to install the libraries needed. If we are using the Web Editor, there is no need to install anything. If we are using an offline editor, simply go to Tools > Manage libraries.., and search for MKRGSM and install it.

3. We can now go to File > Examples > MKRGSM > MakeVoiceCall in the editor. This will open a new window, which has a sketch tab, but also a header file, called

. Inside this file, we need to enter our pin number between the "".

1#define SECRET_PINNUMBER "" //enter pin code between ""

The pin number is often 1234 or 0000, but for more information, check the SIM plan that you bought.

4. We can now take a look at some of the core functions of this sketch:

  • GSM gsmAccess
    - base class for all GSM functions.
  • GSMVoiceCall vcs
    - base class for GSM voice call functions.
  • remoteNumber.toCharArray(charbuffer, 20)
    - calls a number entered in the Serial Monitor.
  • vcs.hangCall()
    - used to hang up on current calls.

The sketch can be found in the snippet below. Upload the sketch to the board.

1#include <MKRGSM.h>
3#include "arduino_secrets.h"
4// Please enter your sensitive data in the Secret tab or arduino_secrets.h
5// PIN Number
8// initialize the library instance
9GSM gsmAccess; // include a 'true' parameter for debug enabled
10GSMVoiceCall vcs;
12String remoteNumber = ""; // the number you will call
13char charbuffer[20];
15void setup() {
17 // initialize serial communications and wait for port to open:
18 Serial.begin(9600);
19 while (!Serial) {
20 ; // wait for serial port to connect. Needed for native USB port only
21 }
23 Serial.println("Make Voice Call");
25 // connection state
26 bool connected = false;
28 // Start GSM shield
29 // If your SIM has PIN, pass it as a parameter of begin() in quotes
30 while (!connected) {
31 if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
32 connected = true;
33 } else {
34 Serial.println("Not connected");
35 delay(1000);
36 }
37 }
39 Serial.println("GSM initialized.");
40 Serial.println("Enter phone number to call.");
44void loop() {
46 // add any incoming characters to the String:
47 while (Serial.available() > 0) {
48 char inChar =;
49 // if it's a newline, that means you should make the call:
50 if (inChar == '\n') {
51 // make sure the phone number is not too long:
52 if (remoteNumber.length() < 20) {
53 // let the user know you're calling:
54 Serial.print("Calling to : ");
55 Serial.println(remoteNumber);
56 Serial.println();
58 // Call the remote number
59 remoteNumber.toCharArray(charbuffer, 20);
62 // Check if the receiving end has picked up the call
63 if (vcs.voiceCall(charbuffer)) {
64 Serial.println("Call Established. Enter line to end");
65 // Wait for some input from the line
66 while ( != '\n' && (vcs.getvoiceCallStatus() == TALKING));
67 // And hang up
68 vcs.hangCall();
69 }
70 Serial.println("Call Finished");
71 remoteNumber = "";
72 Serial.println("Enter phone number to call.");
73 } else {
74 Serial.println("That's too long for a phone number. I'm forgetting it");
75 remoteNumber = "";
76 }
77 } else {
78 // add the latest character to the message to send:
79 if (inChar != '\r') {
80 remoteNumber += inChar;
81 }
82 }
83 }

Testing It Out

After successfully uploading the code, open the Serial Monitor to initialize the program. After a while, we should see the text

"GSM initialized"
followed by
"Enter phone number to call"
. This means the board has successfully connected to the GSM network.

Enter a phone number to call.
Enter a phone number to call.

Now, we can enter a phone number that we want to call, and hit enter. We should now receive the call (if we entered the number correctly) on our phone. In the Serial Monitor, we can see the message

"Call established. Enter line to end"

Placing a call to a phone number.
Placing a call to a phone number.

We can of course answer the call on our phone, but it will consist only of noise, as we are not using any microphone in this setup.


If the code is not working, there are some common issues we can troubleshoot:

  • We have not installed the MKRGSM library.
  • We have entered the wrong pin number.
  • We are out of coverage (no signal).
  • We have entered the wrong number.
  • SIM card may not be activated.


This simple example demonstrates how to create outgoing voice calls from the MKR GSM 1400 board. Using this feature can be beneficial for various alert systems or for notifications. As it operates over the GSM network, there is typically very good coverage wherever you are, which makes this feature a great option for remote control and feedback.

Feel free to explore the MKRGSM library further, and try out some of the many cool functions in this library.

Contribute to Arduino

Join the community and suggest improvements to this article via GitHub. Make sure to read out contribution policy before making your pull request.

Missing something?

Check out our store and get what you need to follow this tutorial.

Suggest Changes

The content on is facilitated through a public GitHub repository. You can read more on how to contribute in the contribution policy.
The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.