A6 GSM Module HTTP Library

Hi guys,

I turned a code, which i found at a A6-intro video by Andreas Speiss, into a library.
I am actually using the code for an A6-GSM module by Ai-Thinkers and found it easyer to implement it that way.

With this library you can easily post data to any website using Http-Post-request.

Here are the files: https://gitlab.me-soldesign.com/Tobias/A6HTTPLibrary

Unfortunately i did not manage to use HTTPS because the A6 only supports clean TCP.
One would have to build a SSL-Layer on top of that before being able to use HTTPS.
Im looking forward for anyone who sees this and takes the challenge to do just that.

Tobias from MicroenergyInternational

Great work Tobias, I'll definitely take a look at that.

I don't suppose you've found any schematic or documentation on how to power the device? I have the development board, which is the one that Mr Speiss uses (love his videos), but it is really unclear you'd build a complete M2M solution for powering it up etc. I've tried almost everything I can think of, and it's all a bit of a mystery.

Have you seen anything out on the interwebs?

Edit : Scratch that, it looks like you've given exactly that information in your instructions!

You da real MVP!

I note in your notes that you've used a voltage divider to step-down the voltage from 5v to 3.3v for the device. I'm curious whether the A6 / A7 also has the internal resistors that negate this requirement, like for the ESP8266. I remember reading a couple of weeks back that that is in fact the case, in that it's undocumented, but true.

I'll probably take the chance of frying on just to find out.

Hey asperks,
I'm pretty sure it really depends on the kind of module you are using. The A6 itself is just the GSM chip which has no resistors whatsoever. You wrote that you are using exactly the same module that Andreas ist using. Those don't support 5V going into their RX, for sure! However if you try it anyways and it works, please let me know :D.
A nicer way to handle the voltage differences is a logiclevel-converter. But that would be another piece one had to buy. Instead I used aome resistors which anyone has.

Dear Tobias, Thanks for sharing, well done !
Going to check this with A7 module, It have same problem.

where is the library? i think http://gitlab.koukei.de is down.. can you upload elsewhere?

Sorry, URL has changed:
Thanks for trying the library.

Hello Tobias,

I just reviewed your code - and I'm sure it can not work :wink:

You wrote in your Readme: "Baudrate: 9600 (Arduino - A6), Baudrate: 112500 (Arduino - PC)"
Obvious things to question are:

  • 112500: should be 115200
  • max speed of SoftwareSerial: 57600bps
  • the default baudrate of the A6 is 115200, you can not communicate with it (initially) with 9600.

Question: Why do you try to communicate with the PC with 115200 - but only with 9600 with the A6?

The code from Andreas Spiess (where your code is based on) has a debug example:

This code works fine when using a Mega 2560, but not on a, for example, a Uno. I'm sure Andreas has never tested it on anything other than a 2560 (although the code is meant to run on other Arduinos too, because it has the proper ifdefs, SoftwareSerial, etc.)

The way your code is right now it does not work (because it tries to communicate with the A6 with 9600baud). When I modify your code to use 115200 instead, it runs unstable (sometimes manages to send an AT to the A6 command, but often errors (-> 57600bps max for SoftwareSerial)).

What are your suggestions?


I used TCP command to send data to the server whose URL is http://(Server IP):Port/test/2000/98/2017-04-14
We have configured server in such way that it will automatically captures the values from the URL e.g. from url http://(Server IP):Port/test/2000/98/2017-04-14 following values are being captured at server end-

I try to send data using following AT commands-

AT+CIPSTART="TCP","Server IP",Port
GET /test/2000/98/2017-04-14 HTTP/1.1

In above commands 2000/98/2017-04-14 is the data which I want to send. Unfortunately I'm not able to send it. Can somebody please help me to resolve this issue. Im new to A6 and not expert for the AT commands. So kindly explain the solution accordingly. If someone can suggest the AT commands to do the same ,then it will be highly appreciated.
Is there any way to access http URL directly using A6 module? As far as I know A6 doesn't support http protocol. Please let me know the solution.

Thanks and Regards,

thought i'd chime in here since I just recently built something for testing the A6 out. the reason being was the modules i bought were junk and had problems with the boards. these problems ranged from the reset pin on the A6 module not actually having any continuity to its corresponding header pin to some others that had the RF antenna shorted to ground. i ended up removing an A6 from one of the modules and building my own device that also incorporated an esp8266.
here's some pics

i supply ~5V to the barrel jack in the side and use a diode to drop the voltage to ~4V to power the A6. The ESP is powered from the 5V through a 3V3 regulator. i don't do any logic level shifting between them and nothing has "blown up" yet :slight_smile:

someone asked about why another person is communicating to the A6 at 9600 baud.

after you start it up just send "AT\n" a couple times and the A6 just sort of auto negotiates to whatever rate you're set at.

i'm using software serial on the ESP to talk to the A6 and have both the hardware and software serial set to 57600 and things work just fine.

oops i forgot to add for the benefit of the person asking about a schematic. there's pretty much a reference schematic floating around that seems to be put out by AI thinker. I just went by that when making the device I mentioned in my last post. I'll attach it here.
also there's some modules that seem to just connect the PWR pin to your supply voltage and others that have a button you can press to start the module. you can just connect it to your supply and leave it connected as it seems to have no adverse effect.

A6_Connector_2016031402_V2.pdf (107 KB)

The 1st comment of me .. for many thank for your library ...
my project has a problem about send data by GPRS A7
i try 3days to solve them but when i found this post ...
i have found the light. ...
thank you ... again and again ...
Khomkrit from THAILAND..

what wrong ? can't use post ?

Yes, but NOT that way.

Did you even look at the HttpPost() method? It takes a String containing the ENTIRE POST body. It does NOT expect to be called over and over with bits and pieces of the POST body.

Yes, but NOT that way.

Did you even look at the HttpPost() method? It takes a String containing the ENTIRE POST body. It does NOT expect to be called over and over with bits and pieces of the POST body.

so how to use post with many string ?

Sir i have a problem with AI-Thinker A7 GSM/GPS/GPRS module. when i connect it to a GPRS using AT Command it return error

please Help me. my sketch is

#include <SoftwareSerial.h>

byte RX = 10;

byte TX = 11;

SoftwareSerial *A7board = new SoftwareSerial(RX, TX);
void print_result()


while( A7board->available() != 0)
Serial.write( A7board->read());



void setup()

Serial.println("Send AT command");
A7board->println("AT+ CRC =?");


void loop() {


Please make sure you have enough balance and internet package is enabled on your SIM

Does it also work with https on Port 443

My A6 is like this

In its connections it does not have any reset pin

How do you reset this module?

Hello I have the same error +CME ERROR:58, you already fix this?

The library looks interesting. But why in the world the post URL is in the constructor is beyond me. So we have to GC the instantiator and make a new constructor if we need to post to different URL's? It appears to be true even with a second post with a different body. Will give it a shot - if it works well I'll rework it.