Experimenting with Arduino and MikroEektronika’s click boards – Part 2

Part 2 – First attempt with the GSM (Read GSM2!) Click board


  • Step 4 – Try the GSM click board and for the time being see if I can make it work to at least send SMS text
  • Step 5 – Try to make the GSM click board send data over GPRS

In order to be able to work with the GSM click board on the Mega ADK, I had to specifically set the click board to use 5V IO level – since it’s capable of working with both but the Mega ADK not!

02. The GSM Click board

The way this is done, is by re-soldering to the right the small jumper (0Ω SMD resistor) at the bottom of the board. If later on I decide to go with a different board/microcontroller that works with 3.3V logic level, I have to return this jumper back to its original position. Note: Please make sure to remove the SIM PIN lock using a phone 🙂

I connected my GSM click in the first position of the Mega shield (PD2 => RX1 => pin 19) and PD3 => TX1 => pin 18) => the 2nd UART on the Mega ADK enumerated as Serial1 in the Arduino IDE. On ME’s site you will find everything you need (or most of it at least) to work with the click boards.

For example, in my case I was especially interested in the schematic of the GSM click board and this little snippet of code as suggested by ME:

void applicationInit()
    gsm_hfcEnable( true );
    gsm_modulePower( true );

    gsm_cmdSingle( "AT" );
    gsm_cmdSingle( "ATE0" );
    gsm_cmdSingle( "AT+IFC=2,2" );
    gsm_cmdSingle( "AT+CMGF=1" );

I was particularly curious of the two functions gsm_hfcEnable and modulePower and how they are implemented so that I can apply the same using my Arduino Mega ADK. But… not!

Not only I couldn’t find a working example for the Arduino platform (which I guess it could be expected :S ), but I couldn’t find any source to see how those two functions are implemented! I even asked this question on ME’s support page – but nothing! I got ‘an answer’, but definitely not something I was hoping for.

This is something I couldn’t comprehend!? Why would they hold back on that!? It’s not as if I was asking for a source code – just an outline of the procedure to properly power up the GSM modem!

Then I went looking in a different direction. I went looking for the HW User’s Guide on the Telit modem and there, starting from page 17, you will find the procedure for powering and reseting their modem.

I did a couple of reasonable attempts based on that but I was unsuccessful! 😦 So I gave it up – or at least postpone using this GSM Click board and after I accidentally came across an article suggesting using the GSM2 Click board with the Arduino Uno, I decided to give it a shot.

Normally, my first priority was looking at the QUECTEL’s M95 HW User’s Guide.

There, starting from page 25, you will find the procedure to properly power up and reset the GSM modem and to be perfectly honest – I found that this procedure and the entire documentation, was much more clear to follow than the previous one!

This is what I accomplished – powered up the module, sent an AT command, got a reply back! You may also view the entire BitBucket repo on the TrackingSystem proof of concept I am building. I was happy at this point and decided to go further. Note: if you look at the schematic on the GSM2 Click, you will see that the STAT net changes from STAT to !STAT, which IMHO makes no sense because the status LED would then simply not indicate anything when the modem is powered up and initialized!? Furthermore, this net goes to an analog input of the Arduino Mega ADK, hence #define ADC_RES 1024 and the stat = analogRead(STATUS) on A0 in my code!

My next order of business was to try and use the GSM library that comes with the Arduino IDE – if possible at all!?

And while I found it was absolutely possible, due to the fact the library was based on the SoftwareSerial library – which meant using plain digital IO pins to emulate a UART while I was utilizing one of the built-in HW UARTs of the Mega ADK – I decided to ditch that idea. Note: as I go typing more and more, I suddenly realize I’m sounding more and more like GreatScott! – one of my favorite YouTube personas :).

Instead, I found this specific QUECTEL M95 library for the Arduino platform and it’s Git repo!


For starters, I couldn’t even compile the example sketch. The absolute 1st line in the sketch was a typo i.e.

not a qualified comment.

After fixing that, I got an error on the two define directives, so I update the code to this:

#define serial Serial
#define cellular Serial1

guessing that the original intention was the available UARTs?

Then I got a compile error regarding the CM_PWRKEY identifier, so I did this:

#define CM_PWRKEY 49
// And an additional define
#define CM_STATUS A0

Then I got this error (one of few):

..\Arduino\libraries\M2M_Solutions_Quectel_Library-1.0.3\src/M2M_Quectel.h:87:16: error: ‘Uart’ has not been declared

bool begin(Uart* uart);

Uart as a type I couldn’t find defined anywhere. Perhaps HardwareSerial here? Note: I am what some call persistent but most call stubborn! I literally searched through all header files in the Arduino folder and I couldn’t find any type declaration!?

Furthermore, when looking at the default constructor:

QuectelCellular(int8_t powerPin = NOT_A_PIN, int8_t statusPin = NOT_A_PIN);

The line:

QuectelCellular quectel(&serial, CM_PWRKEY);

makes little sense and perhaps should be:

QuectelCellular quectel(CM_PWRKEY, CM_STATUS);


Somewhere in-between, I got a compile error that NOT_A_PIN was already defined prior (in one of the Arduino libraries, but I forgot to take note of which one), so I updated the code (M2M_Quectel.h) to:

#ifdef NOT_A_PIN
#undef NOT_A_PIN
#define NOT_A_PIN -1

And I stopped here. Am I missing something? Note: I decided to write to the original author – and I did – but got no reply. Yet!

Bummer! I decided it would be best if I spend a bit more time and get to know the GSM modem a bit more by learning the different AT commands (I could even use the supplied M2M library as a reference starting point!).

And I did! Checkout the simple Simple_GSM2_Test.ino or the more complete Simple_GSM2_Test2.ino in my BitBucket repo on the TrackingSystem. Neither of the examples are checking back the response from the GSM modem but I plan to address this as I go further!