Beginner
10 min

Unveil the potential of reliable communication through SIM800H-BT and PIC18F57Q43

Always within reach

GSM3 Click with Curiosity Nano with PIC18F57Q43

Published Feb 13, 2024

Click board™

GSM3 Click

Dev Board

Curiosity Nano with PIC18F57Q43

Compiler

NECTO Studio

MCU

PIC18F57Q43

By embracing the strength of GSM networks, we empower you to communicate with confidence and reliability, shaping a future of endless possibilities

A

A

Hardware Overview

How does it work?

GSM3 Click is based on the SIM800H, a GSM/GPRS module from SIMCom. This module is GSM Phase 2/2+ compliant, featuring a full set of cellular networking and communication options. It has a network status indication, jamming detection, and embedded internet protocols, including TCP/IP, UDP, FTP, PPP, HTTP, E-mail, MMS, and more. It also features advanced voice/audio functions, including the FM radio interface. The GPRS multislot class 12 implementation allows four uplink and four downlink slots, with five open slots. Data communication speed is rated at 85.6 kbps for both uplink and downlink connection. An outstanding feature of this module is the support for the Bluetooth 3.0+ EDR protocol. The SIM800H covers frequencies of 850/900 MHz (2W of TX power) and 1800/1900 MHz (1W of TX power). The module consists of several internal blocks or sections, such as an antenna switching section, RF transceiver section (BT, FM, and GSM), memory, power management, analog section (audio, ADC), and most importantly - the cellular baseband processor. Its interface consists of several lines that report the device and network status, SIM card interface lines, UART interface lines, and device control lines. These lines are routed to the respective elements of the Click board™. The SIM800H is powered by around 4V through the onboard LDO over the 5V mikroBUS™ power rail, no matter the chosen DATA LEVEL. Digital sections of the SIM800H are internally supplied by 2.8V, so it is necessary to condition the communication bus lines that connect the host MCU with the module. For this purpose, the GSM3 comes with the TXB0106, a 6-bit bi-directional level shifting and voltage translator with automatic

direction sensing, from Texas Instruments. To communicate with the host MCU, GSM3 Click uses a UART interface with commonly used UART RX and TX pins, supporting standard baud rates ranging from 1200bps to 115.2kbps. The automatic baud rate detection is supported for baud rates up to 57.6kbps and is set by default. The baud rate settings are stored in the internal non-volatile memory, so once stored, these settings will be retained between power cycles. In addition to the UART interface, the GSM3 Click includes hardware flow control pins RTS and CTS. A red LED labeled NET indicates the network status (network search/not registered, registered to the network, and communication established). A yellow LED labeled STAT is used to indicate the device status. When it is lit, the device is operational. It also signals that the internal module initialization is finished and that the module is ready to work. Besides LED, this status is routed via the STA pin to the host MCU. The PWRKEY pin is routed to the mikroBUS™ PWK pin and is used to manually power up/down the Click board™. Asserting this pin to a LOW logic level for at least 1s will toggle the power state of the SIM800H module. To properly detach from the network and store the working parameters in its non-volatile memory, the module should be safely powered off using the PWK (PWRKEY) pin or by issuing the AT+CPOWD=1 command. Abrupt termination of the power supply might lead to a loss of the current parameter settings and improper detachment from the network. If these methods don't work, the RST pin with the LOW logic state can also reset the module. One of the stand-out features of this Click board™ is the support for the

Bluetooth 3.0+ EDR protocol via the 2.4GHz RUFA SMD antenna from Antenova. For GSM/GPRS communication, the GSM3 Click board comes equipped with the SMA connector, while an appropriate antenna can be purchased at the MIKROE shop. The Micro SIM card holder on the back of the Click board™ is used to install a microSIM card. This device cannot be used without a valid SIM card, which allows connection to the cellular network. Both 1.8V and 3V SIM card types are supported, with fast 64kbps SIM card communication speed (GSM Phase 2+). The SIM800H module also offers extensive audio features, including half rate, full rate, enhanced full rate, adaptive multi-rate voice codecs, superior echo cancellation, and is configurable with the AT commands. The audio DSP section is integrated into the module and requires only a few external components. The headset can be connected via the connection pad on the side of the Click board™. The pad also offers an FM antenna connection, allowing listening to the FM radio transmissions. A headset with an integrated FM antenna inside the cable can be used. The functions of the FM radio receiver can be adjusted via the AT commands. The incoming call interrupts the FM receiver's signal and is redirected to the headset instead. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the DATA LEVEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

GSM3 Click hardware overview image

Features overview

Development board

PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive

mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI

GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.

PIC18F57Q43 Curiosity Nano double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC

MCU Memory (KB)

128

Silicon Vendor

Microchip

Pin count

48

RAM (Bytes)

8196

You complete me!

Accessories

Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.

Curiosity Nano Base for Click boards accessories 1 image

Rubber Antenna GSM/GPRS Right Angle is the perfect companion for all GSM Click boards™ in our extensive lineup. This specialized antenna is designed to optimize your wireless connectivity with impressive features. With a wide frequency range spanning 824-894/1710-1990MHz or 890-960/1710-1890MHz, it can handle various frequency bands, ensuring a seamless and reliable connection. The antenna boasts an impedance of 50 Ohms and a gain of 2dB, enhancing signal reception and transmission. Its 70/180MHz bandwidth provides flexibility for diverse applications. The vertical polarization further enhances its performance. With a maximum input power capacity of 50W, this antenna ensures robust communication even under demanding conditions. Measuring a compact 50mm in length and featuring an SMA male connector, the Rubber Antenna GSM/GPRS Right Angle is a versatile and compact solution for your wireless communication needs.

GSM3 Click accessories image

Used MCU Pins

mikroBUS™ mapper

Status Indicator
PA0
AN
Reset
PA7
RST
UART RTS
PD4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Power ON/OFF
PB0
PWM
UART CTS
PA6
INT
UART TX
PC3
TX
UART RX
PC2
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

GSM3 Click Schematic schematic

Step by step

Project assembly

Curiosity Nano Base for Click boards front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity Nano with PIC18F57Q43 as your development board.

Curiosity Nano Base for Click boards front image hardware assembly
Charger 27 Click front image hardware assembly
PIC18F47Q10 Curiosity Nano front image hardware assembly
Prog-cut hardware assembly
Charger 27 Click complete accessories setup image hardware assembly
Curiosity Nano with PICXXX Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
PIC18F57Q43 Curiosity MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for GSM3 Click driver.

Key functions:

  • gsm3_set_sim_apn - This function sets APN for sim card

  • gsm3_send_sms_text - This function sends text message to a phone number.

  • gsm3_send_sms_pdu - This function sends text message to a phone number in PDU mode

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * \file 
 * \brief Gsm3 Click example
 * 
 * # Description
 * This example reads and processes data from GSM 3 clicks.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes driver and wake-up module.
 * 
 * ## Application Task  
 * Reads the received data and parses it.
 * 
 * ## Additional Function
 * - gsm3_process ( ) - The general process of collecting presponce 
 *                                   that sends a module.
 * 
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "gsm3.h"
#include "string.h"

#define PROCESS_COUNTER 10
#define PROCESS_RX_BUFFER_SIZE 500
#define PROCESS_PARSER_BUFFER_SIZE 1000

// ------------------------------------------------------------------ VARIABLES

#define DEMO_APP_RECEIVER
//#define DEMO_APP_TRANSMITER

static gsm3_t gsm3;
static log_t logger;

static char current_parser_buf[ PROCESS_PARSER_BUFFER_SIZE ];
static uint8_t send_data_cnt = 0; 

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

static void gsm3_process ( void )
{
    int32_t rsp_size;
    uint16_t rsp_cnt = 0;
    
    char uart_rx_buffer[ PROCESS_RX_BUFFER_SIZE ] = { 0 };
    uint16_t check_buf_cnt;
    uint8_t process_cnt = PROCESS_COUNTER;
    
    // Clear parser buffer
    memset( current_parser_buf, 0 , PROCESS_PARSER_BUFFER_SIZE ); 
    
    while( process_cnt != 0 )
    {
        rsp_size = gsm3_generic_read( &gsm3, &uart_rx_buffer, PROCESS_RX_BUFFER_SIZE );

        if ( rsp_size > 0 )
        {  
            // Validation of the received data
            for ( check_buf_cnt = 0; check_buf_cnt < rsp_size; check_buf_cnt++ )
            {
                if ( uart_rx_buffer[ check_buf_cnt ] == 0 ) 
                {
                    uart_rx_buffer[ check_buf_cnt ] = 13;
                }
            }
            log_printf( &logger, "%s", uart_rx_buffer );

            // Storages data in parser buffer
            rsp_cnt += rsp_size;
            if ( rsp_cnt < PROCESS_PARSER_BUFFER_SIZE )
            {
                strncat( current_parser_buf, uart_rx_buffer, rsp_size );
            }
            
            // Clear RX buffer
            memset( uart_rx_buffer, 0, PROCESS_RX_BUFFER_SIZE );
        } 
        else 
        {
            process_cnt--;
            
            // Process delay 
            Delay_ms( 100 );
        }
    }
}

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    gsm3_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    gsm3_cfg_setup( &cfg );
    GSM3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    gsm3_init( &gsm3, &cfg );

    gsm3_module_power( &gsm3 );

    gsm3_process(  );

    gsm3_send_command( &gsm3, GSM3_SINGLE_CMD_AT );
    gsm3_process(  );

    gsm3_send_command( &gsm3, GSM3_SINGLE_CMD_AT );
    gsm3_process(  );

    gsm3_send_command( &gsm3, GSM3_SINGLE_CMD_AT );
    gsm3_process(  );

    gsm3_send_command( &gsm3, GSM3_SINGLE_CMD_ATE0 );
    gsm3_process(  );

    gsm3_send_command( &gsm3, "AT+IFC=2,2" );
    gsm3_process(  );
    
    gsm3_send_command( &gsm3, "AT+CMGF=1" );
    gsm3_process(  );

    Delay_ms( 2000 );
}

void application_task ( void )
{
    gsm3_process(  );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.