Basics: Project 085c
Project name: Ai Thinker A6 GSM GPRS module – LED control
Tags: Arduino, A6 GSM GPRS module, GSM GPRS module, A6, Ai Thinker, LED, LED control
Attachments: sketch
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. Ai Thinker A6 GSM GPRS module 1 pc

2. Arduino IDE ( you can download it from here )
3. Jumper cables F-F, F-M

4. Micro USB cable 1 pc

5. Micro SIM card 1 pc (unlocked)

6. GSM GPRS antenna 1 pc
7. 5 VDC 2A power wall adapter 1pc
8. Arduino Nano 1 pc

9. Resistor 220 Ohm 1 pc

10. LED 1 pc (red or other color)

11.Breadboard 1 pc

General
We will learn how to control LED with Arduino Nano and the Ai Thinker A6 GSM GPRS module.
Understanding the Arduino Nano
You can read more about it here.
Understanding the A6 GSM GPRS module
You can read more about it here.
You can find A6 datasheet, manuals, AT commands, schematics here.
Signals and connections of the A6 GSM GPRS module
A6 GPS/GPRS IC pinout:


EN – module power control enable pin (can control power switch, default high level enable)
VCC_IN – External power supply (3.4V-4.2V ) maximum power supply current 2A
PWR – used for turning module ON/OFF programmatically. For doing this you must pull it HIGH for a moment (less than 500 ms or around).
INT – used to control the module to enter low-power mode, high exit low level access, in this mode the standby current <1mA ( in this mode the serial port cannot be used)
GND – ground pin. this module has 2 ground pins
U_RXD – serial port for AT commands (receive pin)
U_TXD – serial port for AT commands (transmit pin)
H_TXD – firmware update pin (transmit pin), pin power level 2.8V
H_RXD – firmware update pin (receive pin), pin power level 2.8V
R232_TX – RS232 level control (transmit pin)
R232_RX – RS232 level control (receive pin)
MIC- – microphone –
MIC+ – microphone+
REC- – loudspeaker –
REC+ – loudspeaker +
Wiring

Step by Step instruction
- Do wiring.
- Attach GSM GPRS antenna to A6 GSM GPRS module.
- Insert a active unlocked SIM card to SIM card slot of A6 GSM GPRS module.The workings of the SIM card socket can take some getting used to. To unlock the latch, push the top part of the assembly towards micro USB connector, and then lift it up. Place the SIM card into the bottom part of the socket with the SIM’s notch pointing away from the micro USB connector. Then fold the arm back into the body of the socket, and gently push it forward towards the “LOCK” position.
- We power up A6 GSM GPRS module with external power supply 5VDC 2A through micro USB port.
- Open Arduino IDE.
- Plug your Adruino Nano board into your PC and select the correct board and com port
- By default this module respond on 9600 bps.
- Verify and upload sketch to your Adruino Nano.
- Open up Arduino IDE Serial monitor and set your baud to 9600 baud and select Both NL&CR.
- You can control the LED now. Send On to turn it ON, send Off to turn it OFF, send State to check for the state of LED.




Expanding Arduino SoftwareSerial Buffer Size
If your message is long and you receive it with some missing characters. This is not because of a faulty code. Your SoftwareSerial receive buffer is getting filled up and discarding characters. You are not reading fast enough from the buffer. The simplest solution to this is to increase the size of the SoftwareSerial buffer from its default size of 64 bytes to 512 bytes (or smaller, depending on what works for you).
On a Windows PC, go to C:\Program Files (x86) -> Arduino -> hardware -> Arduino -> avr -> libraries -> SoftwareSerial (-> src for newer version of Arduino IDE) Open SoftwareSerial.h and change the line:
// RX buffer size
define _SS_MAX_RX_BUFF 64
to
// RX buffer size
define _SS_MAX_RX_BUFF 512
Save the file and try your sketch again.

Summary
We have learnt how to control LED with Arduino Nano and the Ai Thinker A6 GSM GPRS module.
Thank you for reading and supporting us.
Libraries:
- SoftwareSerial library included in Arduino IDE. The library has the following known limitations:If using multiple software serial ports, only one can receive data at a time.Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).On Arduino or Genuino 101 the current maximum RX speed is 57600bpsOn Arduino or Genuino 101 RX doesn’t work on Pin 13 The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn’t work on Pin 13. You can read about it here.
Project resources:
- See attachments on the beginning of this project description
Check for more DIY projects on Acoptex.lt and Acoptex.com!
If you are looking for high quality PCBs PCBWay is the best choice:

RELATED POSTS
Guide to LILYGO T-SIM7000G ESP32 development board -How to update a firmware
Guide to LILYGO T-SIM7000G ESP32 development board- AT communication
Arduino guide for microphone sound sensor