How to Send an SMS Text From a GSM Chip Using Putty

by scanos in Circuits > Electronics

13839 Views, 70 Favorites, 0 Comments

How to Send an SMS Text From a GSM Chip Using Putty

IMG_20170811_163407.jpg

I want to be able to program the AI-Thinker A6 GSM module for one of my projects. As part of the learning curve, I set out to send a simple sms text message from the GSm module to my cell phone from a terminal emulator on MS Windows. I was aware that they ran on a 2G network which some may consider redundant, but it will be around in the UK for some time to come.

Required Components

IMG_20170811_163407.jpg

Here is what you need:

1. A6 - GSM/GPRS module - circa 4 dollars from Aliexpress. https://www.aliexpress.com/snapshot/0.html?spm=a2...

2. FTDI basic from Sparkfun or equivalent.

3. Registered sim

4. Male- female Connectors

5. MS Windows Laptop or PC running Putty

Connecting the Hardware

IMG_20170811_162555.jpg
PINOUT_ALS.jpg
IMG_20170811_194725.jpg
IMG_20170812_142355.jpg

Firstly, fit the micro sim into the device. To do this lift the small hinged sim gate and slide in the sim and then lock. Note that the sim gate has two positions - open and locked and be careful, the sim gate can easily break. I also ensured, by using my smart phone, that the sim was registered and had sufficient credit. My UK Vodafone sim met these requirements.

Connect the following

FTDI TX <------> A6 UART_RXd

FTDI RX <------> A6 UART_TXd

FTDI GND <------> A6 GND

=========================

A6 PWR <-----------> A6 VCC 5.0

A6 RST <-------------> A6 GND (Do not connect to ground yet!!!!!)


Power the FTDI Unit and the A6 GSM Unit

1Untitled.jpg
2Untitled.jpg

Firstly, connect the FTDI unit into a usb port on the laptop and then connect the GSM unit to the mains with a micro-usb charger (The official documentation states that 5V / 2A is required to power the GSM unit but I was able to power it with other micro-usb chargers). Next, open Windows Device Manager and find out which comms port the FTDI unit has been assigned.

Next, open up Putty and select the serial option and then type commX where X is the comms port that was shown in the Windows Device Manager. Change the speed to 115200. Click open keep this Putty window.

Operation

3Untitled.jpg
4Untitled.jpg

Now you have the Putty window open, you shoudl see a blank screen. next, connect the cable connected to the RST pin on the A6 GSM unit and touch the GND pin beside the VCC pin. After a few seconds, you should see the following lines appear-

^CINIT: 2, 32, 41891

^STN: 37

^CINIT: 4, 8192, 37

^CINIT: 8, 2048, 1

^CINIT: 16, 0, 1638450

^CINIT: 32, 0, 0

+CREG: 0

After another 5-10 seconds, you should see the following lines appear,

^CINIT: 1, 0, 0

^CINIT: 2, 32, 41891

^STN: 37

^CINIT: 4, 8192, 37

^CINIT: 8, 2048, 1

^CINIT: 16, 0, 1638450

^CINIT: 32, 0, 0

+CREG: 0

+CIEV: service, 1 +CIEV: roam, 0

+CREG: 1

The last command is very important as +CREG: 1 means that the sim/ GSM unit has been registered on your Telecom carrier's network (e.g. Vodafone), and you are able to communicate with other devices.

You need two simple command sets to send your first sms text.

TYPE AT+CMGF=1

YOU SHOULD SEE OK

NEXT TYPE AT+CMGS="+XXXXXXXXXXXX" replacing the number enclosed in quotes with your number

You will be presented with a ">" prompt

Starting typing your message and then hit return. The cursor will move to the left of the line. Now type the "Ctrl" and "Z" keys and then wait.

You should then receive a successful message +CMGS: XX - where XX is a unique code

============================================

Good luck, you have sent your first sms message and are ready to start programming ur GMS/GPRS solution.