Basic Mobile Phone Using STM32F407 Discovery Kit and GSM A6 Module

by Sharath_N25 in Circuits > Microcontrollers

7695 Views, 24 Favorites, 0 Comments

Basic Mobile Phone Using STM32F407 Discovery Kit and GSM A6 Module

Cover_Pic.jpg

Have you ever wanted to create a cool embedded project?. If yes, how about building one of the most popular and everyone's favorite gadget i.e Mobile Phone!!!. In this Instructable, I will guide you on how to build a basic mobile phone using the STM32F407 Discovery Kit and GSM A6 module.

This project contains 3 main modules :

  1. GSM A6 Module - This is module is responsible for Making/Receiving Calls and SMS.
  2. LCD 16x02 Display - To see the output
  3. Hex Keypad - To give input

The STM32F407 MCU controls the GSM A6, LCD, and Keypad. So to make programming simple and organized, I developed individual driver code for Interfacing GSM A6 module, LCD and Keypad on STM32F407 MCU. Then I simply included these driver files in the main program and called respective APIs. You can find these driver codes in the Supplies below.

The Entire Keil Project file is included below

Supplies

Components List

Figure_1_STM32F4DISCOVERY.png
Arduino-Project-Working-Interfacing-A6-GSM-Module-Sending-Receiving-SMS-Making-Call.jpg
16x2-lcd-display-green-500x500.jpg
41xi0Y9It3L.jpg
515eZ50iacL._SX425_.jpg
download (1).jpeg
plastic-protoboard-250x250.jpg
InkedSpeaker_LI.jpg
Small Microphone-800x800 (1).jpg

The hardware components required for this project are :

  1. STM32F407 Discovery Kit
  2. GSM A6 Module
  3. LCD 16x02
  4. I2C module
  5. Hex Keypad
  6. A couple of Jumper cables
  7. Bread Board
  8. Speaker (8Ω)
  9. Microphone

Make the Connections

Basic_Mobile_Phoen.png

Connect the components as given in the above picture. This picture/diagram gives you a very realistic and easy way to connect all the components. :-)

Note: GSM A6 Module is powered using a micro USB connector. You can use any mobile charger for powering up the GSM A6.

Open Keil UVision IDE

Screenshot (38).png

Open Keil uVision IDE. Click on a project the select New uVision Project...Then select your working directory and give your preferred project name.

Select the Device

Capture.PNG

Once you have given a name to the project, in the next step you need to add a device. Here we are adding STM32F407VG Micronconroller from STMicroelectronics. Select the STM32F407VG, then Click OK.

Manage Run-Time Environment

in1.PNG
In2.PNG

The next step is to select the library/driver component in the Manage Run-Time Environment Tab. Here select all components as shown in the above picture. Once you check all appropriate field Click Resolve then Click OK.

Copy the Driver Files Int to Project Folder

In3.PNG

Now you have to add driver files for GSM A6 Module, LCD and Keypad. The driver files are :

1. GSM A6 Module :

GSM_A6_Driver_STM32F407.c and GSM_A6_Driver_STM32F407.h


2. LCD :

STM32F407_I2C_LCD16x02_Driver.c and STM32F407_I2C_LCD16x02_Driver.h


3. Keypad

STM32F407_KeypadDriver.c and STM32F407_KeypadDriver.h


Copy all these 6 files into your project folder. I have attached these files below

Add the Driver Files to Your Project

In4.PNG

Once you have copied the Driver files into inside your project folder, you have to add these files to your Project.

In Keil, Select Target1, right-click then select Add new group. Create 4 new groups and Rename them as :

1) User Application - Here add new "main.c" file.

2) GSM_A6_Driver - Add existing "GSM_A6_Driver_STM32F407.c" and "GSM_A6_Driver_STM32F407.h" files to this gorup.

3) LCD_Driver - Add existing "STM32F407_I2C_LCD16x02_Driver.c" and "STM32F407_I2C_LCD16x02_Driver.h" files to this group

4) Keypad_Driver - Add existing "STM32F407_KeypadDriver.c" and "STM32F407_KeypadDriver.h" files to this group

Note: I have included "main.c" file below, you can either directly add this file or copy its contents to the newly created main file.

Downloads

Configure the Path of the Header Files

In5.PNG

Once you have added the driver files, you need to tell the compiler where the respective header files are located. Hence we need to configure the compiler option.

Right Click on Target1--> Option for Target "Target1.." --> C/C++--> Include path. Make sure you include the path of your project folder since we copied the driver files there.

Connect Your STM32F407 Discovery Kit to Your PC/Laptop

Select ST-Link Debugger in Compiler Configuration

in1.PNG

Right Click on Target1, then click on Option for Target "Target1..", then navigate to Debug Tab and select ST-Link-Debugger as shown in the above picture

Configure ST-Link Debugger

in1.PNG

After selecting the ST-Link Debugger in step 10, click on Settings then select Trace and check all the fields as shown in the above picture.

Build and Upload the Code

In3.PNG

After completing all the steps build the project and make sure there are no errors in the code. After successful compilation, upload the code to your Discovery Kit.

Thats It!!! Just Reset the STM32F407 MCU and Use the Mobile Phone

Basic Mobile Phone using STM32F407 and GSM A6 Module

I have included a demo video of this project.

Quick Notes and Debug Informations

In6.PNG
  • I suggest you to power on the GSM Module first and wait for a minute or so. Because once you power on the GSM module it has to connect to the network service provider. Depending upon quality/signal strength GSM module may take some time to get connected.
  • I have tested output in "India". Also for simplicity, I have hardcoded the county code(+91 for India) in the driver file "GSM_A6_Driver_STM32F407.c". If your in another country please add your country code as highlighted in the above picture.