TCP with Gprs Gsm A6 Module

Good news for the A6, there is a simple way for TCP, i wrote in the previous article the long way with AT+CGACT=1,1 because AT+CIICR did not work for me but Simon f found the good order for use it, so i give you his code:

 

**Power Up**

AT+CSTT=”free”,””,””

 

OK

AT+CGDCONT=1,”IP”,”free”

 

OK

AT+CIICR

(we can wait a lot of time, if you see COMMAND NO RESPONSE! do nothing, this mess is send if a command don’t return a message after a while)

 

+CTZV:16/6/8, 1:33:8:8

 

+CGREG:5

 

OK

 

+CGREG:5

AT+CIPSTART=”TCP”,”speedtest.tele2.net”,21

 

+CDNSGIP:1,”speedtest.tele2.net”,”90.130.70.73″

 

OK

 

CONNECT OK

 

OK

 

AT+CIPCLOSE               (If you want to close the actual tcp connection)

AT+CIPSHUT                 (If you want to stop the internet connection)

I invite you to go to see his comments for more info and his article!

Advertisements

A6 Gsm/Gprs Module PinOut and data

There is a new module, very cheap around 4$( Here). We can call/send sms and normaly connect to the website and surly use MQTT(i will explain why after). The good thing is we don’t need to spend more money for use it, there is a antenna and we just need to connect the speakers and a mic on the pins for use it. So it’s very close to the SIM800L(Here with bluetooth and rf in it!).

I recieved the module a week ago but i found nothing about the pinout, and the only things writed on it was 1, 12 and chineses things, maybe rx, tx ? No, with google translation i discovered it was like “made in shenzhen”…  I tried different combination based on the videos, but nothing worked. On the official page they write for AT Commands “Included in the download link” so maybe the solution is in this file ? But i can’t find the link :(.

I finaly found the Holy link here yesterday:    http://www.dx.com/fr/p/gprs-a6-serial-gprs-gsm-module-core-developemnt-board-for-arduino-433790#.V037dZGLSUk

https://drive.google.com/folderview?id=0B6uNNXJ2z4CxcWZ0N2ZVNTFnVFk&usp=sharing

We find everything even the software used in the video!

A6PinOutGsmGprsModule
A6 Gsm/GPRS Module Pinout

How use it:

  1. Connect UART_TXD to RX of the FTDI
  2. Connect UART_RXD to TX of the FTDI
  3. Connect GND to the GND of the FTDI
  4. Connect VCC5.0 To the PWR_KEY pin
  5. Connect a Micro Usb for the power(with any smartphone charger)
  6. After 4-5 second you can remove the connection between VCC5.0 and PWR_Key

You can open The arduino software, in tools select the good port(not COM1), open the serial monitor and choose 115200baud. Write “AT”, and if you see “OK” it works!

If you don’t know how exacly to do the connections, you can see how the Esp8266 works with a FTDI, it’s very close, for exemple:

esp8266-reflash-firmware

The good new is the AT commands are very close to the Commands for others Gprs/Gsm modules like SIM800/SIM900 so it’s surly possible to use the same library.

I’ve noticed the CIPMUX command can’t be used, maybe it’s CMUX ?

 

How call ?

ATD+the phone number

For exemple: ATD0785957436

Push enter and you will recieve the call.

 

How send a message ?

AT+CMGF=1

AT+CMGS=”0785957436″   (It’s the phone number)

>(write the message here)                (push Ctrl-Z and Enter, it doesn’t work in the Arduino Serial monitor but you can do it in SSCOM, the software in the Zip)

 

You can see all your previous message with:

AT+CMGR=1

for an another message change the number

AT+CMGR=2

AT+CMGR=10

AT+CMGR=12

AT+CMGR=18

AT+CMGR=24

Etc

 

And TCP/IP Connection ?

If i’m right this is the key for the MQTT connection to website etc so the most interesting part. I tried to do like in this page:

https://vsblogs.wordpress.com/2013/11/28/tcp-connection-over-gprs-using-sim900-and-at-commands/

/** First test if everything is okay **/

=> AT

<= AT /** This should come back. SIM900 default is to echo back commands you enter **/

<= OK /** This string should tell you all is well**/

=>AT+CPIN? /**This is to check if SIM is unlocked. This sample assumes unlocked SIMs**/

<= +CPIN: READY /** If your response contains this, then it means SIM is unlocked and ready**/

=>AT+CREG? /**This checks if SIM is registered or not**/

<=+CREG: 0,1 /**This string in the response indicates SIM is registered**/

=>AT+CGATT? /**Check if GPRS is attached or not**/

<=+CGATT: 1 /**A response containing this string indicates GPRS is attached**/

//if you have CGATT:0, write CGATT=1 and even if you have an error check again

=>AT+CIPSHUT /**Reset the IP session if any**/

<=SHUT OK /**This string in the response represents all IP sessions shutdown.**/

//It Never works for me, i’ve +CME ERROR:50

=>AT+CIPSTATUS /**Check if the IP stack is initialized**/

<=STATE: IP INITIAL /**This string in the response indicates IP stack is initialized**/

=>AT+CIPMUX=0 /**To keep things simple, I’m setting up a single connection mode**/

//Not really important, i think for the A6 it’s AT+CMUX=0

<=OK /**This string indicates single connection mode set successfully at SIM 900**/

//I think it’s better to write that before:AT+CGDCONT=1,”IP”,”your_apn”

=>AT+CSTT= “APN”, “UNAME”, “PWD” /**Start the task, based on the SIM card you are using, you need to know the APN, username and password for your service provider**/

<= OK /**This response indicates task started successfully**/

=> AT+CIICR /**Now bring up the wireless. Please note, the response to this might take some time**/

<=OK /**This text in response string indicates wireless is up**/

//It never works for me :/

=>AT+CIFSR /**Get the local IP address. Some people say that this step is not required, but if I do not issue this, it was not working for my case. So I made this mandatory, no harm.**/

//It never works :/

<= xxx.xxx.xxx.xxx /**If previous command is successful, you should see an IP address in the response**/

=>AT+CIPSTART= “TCP” , “http://www.vishnusharma.com”, “80” /**Start the connection, TCP, domain name, port**/

//You can also use something like AT+CIPSTART=”TCP”,”www.google.fr”,”80″

<= CONNECT OK /**This string in the response indicates TCP connection established**/

=>AT+CIPSEND /**Request initiation of data sending (the request)**/

<= > /**The response should be the string “>” to indicate, type your data to send**/

=> xxxxxx /**Just type anything for now**/

=>#026 /**Now type the sequence #026. This tells the terminal.exe to send the hex code 0x1a (which is Ctrl+Z) to indicate end of data sending**/

<= xxxxxxxxxx /**You should get some response back from the server…it would generally be a complain that the request string was not valid…but that is a different subject…you have established the connection**/

/**To close the connection**/

=>AT+CIPSHUT /**Request shutting down of the current connections**/

<=SHUT OK /**Indicates shutdown successful**/

I think i can’t connect because my operator sends a message for activate internet on the phone, i need to install something after that so i can’t do it with this kind of module :/.

Let’s me know if it works for you!

Here an another page wich can be useful if you want to use the arduino and A6:

http://arduino.stackexchange.com/questions/3993/atcstt-throws-an-error

EDIT:

I bought a new Sim card it works but it’s different than in my previus exemple(and the doc exemple).

*POWER UP*

AT+CPIN=1234           (only if you have a Sim code)

AT+CREG?

(+CREG:1,5         CREG should be like 0,1 or 0,5 so we need to change that)

AT+CREG=0

AT+CGATT?

(+CGATT:0 it’s not attach to the GPRS network, +CGATT:1 It’s attach)

AT+CGATT=1

(it can take a lot of time and write COMMAND NO RESPONSE, everytime it worked for me, just check again with AT+CGATT?)

AT+CGDCONT=1,”IP”,”free”            (free is the apn name of my operator, for your operator search in google “apn settings youroperator”)

(Maybe you will need to add AT+CSTT if you need to use your username and password for use internet with your phone:

AT+CSTT=”free”,”raymond”,”password”          Because i don’t have username and  password i write like that:

AT+CSTT=”free”,””,”” )

AT+CGACT=1,1

AT+CIPSTART=”TCP”,www.google.com”,80

(>+CDNSGIP: 1,”www.google.com”,”216.58.209.36″

OK

CONNECT OK)

AT+CIFSR                          (The IP Adresse)

>10.27.156.148

 

So for the MQTT ?

I found here a library for the Sim800 with MQTT: https://github.com/rmap/rmap/tree/master/arduino/sketchbook/libraries/sim800

The commands seems to be the same exept for few of them, so it can works surly easily but i have not tried because i can’t do TCP connection, i will try it soon with an another sim card.

 

Power Consumption

I used a usb meter so the result are not great but it can give you an interesting overview:

Idk how much it is for the Sim800L, maybe the A6 is better for that.

If i change nothing, so i can call, send message etc, the power is around 0.06w/0.13w/0.20w and when i call it can reach 2W.

It’s for 5v so it’s around 0.03A

There is a low-power mode and they say it use only <1mA, but they don’t explain how to use it.