Interfacing GSM Module with AVR Microcontroller: Send and Receive Messages Using Atmega

Interfacing GSM Module

GSM modules are interesting to use especially when our project requires remote access. These modules could make all actions that our normal mobile phone could do, like making/receiving a call, sending/receiving a SMS, connecting to internet using GPRS etc. You can also connect a normal microphone and speaker to this module and converse on your mobile calls. This will open doors to lot of creative projects if it could be interfaced with a Microcontroller. Hence in this tutorial we will learn how we can Interface the GSM module (SIM900A) with AVR microcontroller ATmega16 and will demonstrate it by sending and receiving messages using GSM Module.

Interfacing GSM Module

Materials Required

  1. Atmega16
  2. GSM module (SIM900 or any other)
  3. LCD display
  4. Push buttons
  5. 10k resistors, Potentiometer
  6. Connecting wires
  7. 12V Adapter
  8. USBasp programmer
  9. 10 pin FRC cable

Software Used

We will use CodeVisionAVR software for writing our code and SinaProg software for uploading our code to Atmega16 using USBASP programmer.

You can download these softwares from the given links:

CodeVisionAVR :

SinaProg :

Before going into the schematics and codes, we learn about GSM module and its working.

GSM Module

The GSM module can be used even without any microcontroller by using the AT command mode. As shown above the GSM module comes with a USART adapter which can be directly interfaced to the computer by using a MAX232 module or the Tx and Rx pins can be used to connect it to a Microcontroller. You can also notice the other pins like MIC+, MIC-, SP+, SP- etc where a microphone or a Speaker can be connected. The module can be powered by a 12V adapter through a normal DC barrel jack.

Insert your SIM card in the slot of the module and power it on, you should notice a power LED going ON. Now wait for a minute or so, and you should see a red (or any other colour) LED Flashing once for every 3 seconds. This means that your Module was capable to establish connection with your SIM card. Now you can proceed with connecting you module with Phone or any Microcontroller.

You can build many cool projects using GSM module like:

Also check all the GSM related projects here.

Communicating with GSM module using AT commands

As you might have guessed it, the GSM module can communicate through Serial communication and could understand only one language and that is “AT commands”. Whatever that you might want to tell or ask to the GSM module it should only be via AT commands. For example if you want to know if your module is active. You should ask (send) a command like “AT” and your module will reply “OK”.

Interfacing GSM Module schematics

These AT commands are well explained in its data sheet and can be found here in its official datasheet. Okay! Okay! It is a 271 page datasheet and you might take days to read through them. So I have given some most important AT commands below for you to get this up and running soon.


Replies with OK for Acknowledgement


Check signal Quality


Find service provider name


Call to the specific number, ends with semi-colon


Find the number of SIM card (might not work for some SIM)


Answer the Incoming Call


Hang off the current Incoming call


Show incoming call number


Send DTMF number. You can use any number on your mobile keypad for (number)


AT+CMGR=1 reads message at first position


Delete message at first position


Delete All messages from SIM


Read all messaged from SIM


Set SMS configuration. “1” is for text only mode

AT+CMGS = “+91 968837XXXX”

>CircuitDigest Text<Ctrl+z>

Sends SMS to a particular number here 968837XXXX. When you see “>” start entering the text. Press Ctrl+Z to send the text.


To check for internet connection on SIM card


To close TCP connection, meaning to disconnect form internet

AT+CSTT = “APN”,”username”,”Pass”

Connect to GPRS with your APN and Pass key. Can be obtained from Network Provider.


Check if SIM card has data pack


Get IP of the SIM network


Used to set a TCP IP connection


This command is used to send data to server

Here we will use AT+CMGF and AT+CMGS command to send messages.

Read more: Interfacing GSM Module with AVR Microcontroller: Send and Receive Messages

Leave a Comment

Your email address will not be published. Required fields are marked *