Introduction: TCP/IP Connection Over GPRS: How to Send Data to Server Using SIM900A Module

About: Hi all, I'm Pawan Joshi who works on embedded system and IoT. I'm really passionate about embedded system and IoT. Here through this page you will come to know about embedded system from scratch to the latest …

In this tutorial I'm going to tell you about how to send data to TCP server using sim900 module. Also we will see how we can receive data from server to client ( GSM module ).

Step 1: Components Required:

So to achieve this you need to required two Components at least. One is obviously Sim900A/800A Module and another is one USB to TTL converter. Apart from that keep one sim card with you and that should have 2G data pack enabled in it, so that you can test client server communication.

Step 2: Software Required:

So here you need to make client server communication So these software tools you need to required:

1. Socket Test : Using this you can run a server on your PC.

2. Docklight: There are lot of tools to work on serial data on your PC, Dcklight is one of those tools, so you can use teraterm, realterm, hyperterminal etc. So it's up to you, here we are using Docklight for this.

3. Ngrok: This is optional software for those who can't able to do port forwardingon their router. And I also did not do port forwarding as due to some reason it's not working may be because I've two router setup, anyway if you are also one of those who can not able to do port forwarding so this is the great tool for you,

What ngrok actually does, ngrok exposes local networked services behinds NATs and firewalls to the public internet over a secure tunnel.

Step 3: Working:

AT Commands:

AT commands are the basic initilization for any gsm module. And after connecting your GSM module to PC using USB to TTL converter you need to give these AT commands.

So first command is to test weather your GSM module is connected to your PC or not:

( One thing you need to remember that every AT command will be terminated with a Carriage Return character)


After that here are the list of commands you need to execute for making TCP/IP connection.









Please follow the datasheet to understand the use of these commands. Anyhow in my project video for this tutorial, I've explained about the working of these commands.

Now you need to first start server on your PC using socket test. And when in docklight you will execute AT+CIPSTART command then your server will start.

AT+CIPSTART command is like this:


So before applying public IP you need to do port forwarding on your router, there are lot of ways to do that. Just search in google 'how to forward a port on my router'. And you will get lot of links to do that.

Now if you successfully forward the port. then AT+CIPSTART command will give you CONNECT OK Response.

Ok things are going really well till now, but what if you can not able to do port forwarding due to some reason or may be you don't have router setup it means you are connected on your mobile hotspot.

So no problem here comes the role of NGROK. This tool you can use to make your TCP IP publicly accessible. (same thing what we are doing in port forwarding)

Please follow this link to download NGROK

ngrok is a command line interface, so you need to run one command and that is

ngrok tcp

is what you have given in your socket test server.

So after running this command your localhost will be forwarded to one random IP generated by ngrok, so you need to change that IP in your AT+CIPSTART command, also you will get a different port number, so that thing also you need to replace.

So to know more about how things are working please watch the tutorial video given below.

Step 4: Video:

So everything I've explained in the video.

If you have any doubt regarding this tutorial feel free to comment us below.

And if you want to learn more about embedded system you can visit our youtube channel
Please visit and like our Facebook Page for frequent updates.

Thanks & Regards,

Embedotronics Technologies