AI Thinker, the makers of my favorite micro controller, the ESP8266 have done it again with the A6 GSM module allowing us to connect to the GSM network and send sms, connect to the internet and even make phone calls!
What you’ll need:
- An A6 module (This is an A6 mini bought you can find on ebay, aliexpress ect.. for 5 to 10€)
- A Sim card with a valid subscription. Remember to remove the pin before starting by inserting it into a phone and deactivating the pin number.
- A breadboard and some jumper wires.
- An FTDI programer (2 to 5€ on Ebay ou aliexpress)
- A micro usb breakout board get power to it all easily
- A relatively powerful wall wart (here I recycled a 5V/2A power supply from a raspberry pi I had laying around ). Sending sms takes quite a lot of power for sending.
- A computer with Windows and CoolTerm
As you can see, I used my awesome artistic skills to come up with this horrible diagram!!
We need to power the module with our phone charger, join the FTDI and A6 module neutrals and then connect the TX of the of the RX pin, of the A6 and vice versa.
To the code!
Once you have pluged the FTDI in, CoolTerm should find the COM port on it’s own. You can also find it in windows device manager :
In CoolTerm, set the baudrate to 115200 and click on Connect. It takes a few seconds but it should come up with something like this (if not, try unpluging and pluging the A6 module power back in again) :
+CREG: 5 means the module was able to conect to the network and is ready to go!
If nothing comes up, check all the connections again, especially that the RX/TX pins.
Snding an SMS
To send an SMS, go to Connection -> Send String ou Ctrl-T. The AT command (for attention) followed by a new line will return the current state :
The module should answer “ok”, however in some cases I got CME 58 errors. I think it means that it temporarily lost the signal, just sending AT again should work.
Next, we need to set the module to SMS mode :
followed with a new line:
And finaly, to send the message :
(replacing the phone number with your’s) It will ask you to enter your message :
Wait a few seconds and you should have youself a new message on your phone!
I had a few problems due the poor quality of my chinese jumper wires… I was also using a faulty usb extender cable.
Here is a document that helped me with certain errors and AT commands : GSM Developer Guide – GSM AT Commands – Rev A
Once all the wiring was in done and checked and the module answers, you only need 3 lines to send an sms! In the next article, I’ll try and send one from an arduino/ESP8266 instead of the computer.