MEVIHUB

How to send SMS with GSM (SIM800) using STM32F1(Bluepill) in Keil IDE

Introduction:

Hi, in this article we will see how to send SMS with SIM800 GSM module using blue pill microcontroller in Keil IDE. SIM800 is a quad-band module 850/900/1800/1900MHz and this module support USART Communication.

Requirements:

Schematic Diagram:

GSM module is connected to USART1 and FTDI is connected to USART2.

Code:

Let’s see how to create code using stm32cubemx.

Step1:

Run stmcubemx software create a new project. Now enter STM32F103C8 in search space.

Step 2:

In SYS, select serial wire in Debug.

Step 3:

In RCC, Select Crystal/Ceramic Resonator in both HSE and LSE.

Step 4:

In UART1, select Asynchronous in mode and change baud rate to 9600 in Parameters Settings.

Step 5:

In UART1, check USART1 global interrupt in the NVIC interrupt table.

Step 6:

In UART2, select Asynchronous in mode and change baud rate to 9600 in Parameters settings.

Step 7:

In Clock Configuration, change with 72MHz in HCLK.

Step 8:

In Project Manager, Enter the project name and location where want to save. Click on Generate Code.

Now, open source code in Keil IDE. Alternatively, You can skip these steps and directly download code.

Note: In code change the mobile number to which number you want to send the message.

Make connections as per schematic and load the code to the microcontroller and see the output in serial with FTDI connected to UART2 of the microcontroller.

Output:

Exit mobile version