Basics: Project 085d
Project name: Ai Thinker A6 GSM GPRS module, ESP8266 ESP-12E module – Motion detection
Tags: Arduino, A6 GSM GPRS module, GSM GPRS module, A6, Ai Thinker, ESP8266 ESP-12E module, Motion detection, Nodemcu v3, Lolin, PIR sensor HC – SR 501 or HC – SR 505
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. Mini PIR Motion Sensor Module SC0322 1pc
9. ESP8266 ESP-12E module with micro USB cable 1pc
We will learn how to use the Ai Thinker A6 GSM GPRS module with ESP8266 ESP-12E module to detect motion.
Understanding the PIR sensor module
You can read more about it here.
Understanding the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)
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 PIR sensor module
We are goinig to use Mini PIR Motion Sensor Module SC0322 in this project.
Signals and connections of the ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3)
TX – transmit pin. GPIO pin
RX – receive pin. GPIO pin
3V3 (or 3V or 3.3V)- power supply pin (3-3.6V).
GND ( or G) – ground pin.
RST – reset pin. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.
EN – Chip enable. Keep it on high (3.3V) for normal operation.
Vin – External power supply 5VDC.
D0-D8 – GPIO (General Purpose Input Output) pins
D5-D8 – SPI interface
D1-D2– I²C/TWI Interface
SC (or CMD) – (Chip Select) – the pin that the master can use to enable and disable specific devices. GPIO pin
SO (or SDO) – Master In Slave Out (MISO) – SPI communication. The Slave line for sending data to the master. GPIO pin
SK (or CLK) – SCK (Serial Clock) – SPI communication.The clock pulses which synchronize data transmission generated by the master. GPIO pin
S1 (or SD1) – Master Out/Slave In (MOSI). SPI communication. The Master line for sending data to the peripherals. GPIO pin
S2 (or SD2) – GPIO pin
S3 (or SD3) – GPIO pin
VU (or VUSB) – external power 5VDC.
A0 – ADC output.
RSV – reserved
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 +
A6 GSM GPRS module Nodemcu 1.0
GND G (GND)
U_RXD TX (GPIO1)
Nodemcu 1.0 PIR sensor
G (GND) GND
3V VIN (3.3VDC)
D5 (GPIO14) SIGNAL
Step by Step instruction
1. Adding ESP8266 platform to Arduino IDE
The Arduino environment has to be set up to make it compatible with the ESP8266 ESP-12E module. We are using PC with Windows 7 64 bit OS.
Download and install the Arduino IDE. You can download it here
Open Arduino IDE.
Open the Preferences window from the Arduino IDE. Go to File -> Preferences.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field and click the “OK” button. If you already have a URL in there, and want to keep it, you can separate multiple URLs by placing a comma between them. (Arduino 1.6.5 added an expanded text box, separate links in here by line.)
Open Boards manager. Go to Tools -> Board -> Boards Manager…
There should be a couple new entries in addition to the standard Arduino boards. Look for esp8266. or scroll down to the ESP8266 entry (usually at the bottom). Select the ESP8266 entry. When you click it an install option will appear. Select the latest version and click install.
The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other reasonably large, compiled binaries, so it may take a few minutes to download and install (the archived file is ~110MB). Once the installation has completed, an Arduino-blue “INSTALLED” will appear next to the entry.
2. Uploading sketch to ESP8266 ESP-12E development board
If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer.
Before use ESP8266 ESP-12E WI FI module (LoLin NODEMCU V3), you need to download the manufacture’s driver (CH340) for this chip and install it in your PC. Here is the link. See the description of driver installation package below: CH340 / CH341 USB to serial WINDOWS driver installation package that supports 32/64 bit Windows 10 / 8.1 / 8/7 / VISTA / XP, SERVER 2016/2012/2008/2003, 2000 / ME / 98, through Microsoft digital signature authentication, support USB to 3-wire and 9-wire serial port, with the product release To the end user. Applicable scope: CH340G, CH340C, CH340B, CH340E, CH340T, CH340R, CH341A, CH341T, CH341H chips.
If you have CP2102 chip then you need to download the manufacture’s driver for this chip and install it in your PC. Driver for Mac, Windows, Linux or more..
- 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 ESP8266 ESP-12E module into your PC USB port.
- Choose your NodeMCU board. Go to Tools -> Board -> NodeMCU 1.0 (ESP-12E Module)
- Select the correct com port.
- Verify and upload sketch to your ESP8266 ESP-12E module. delayTime = 15000; //you can set time delay (in ms) between detection here
- Open up Arduino IDE Serial monitor and set your baud to 9600 baud and select Both NL&CR.
- When the motion detected with PIR sensor you will get the message Motion detected on your smartphone.
We have learnt how to use the Ai Thinker A6 GSM GPRS module with ESP8266 ESP-12E module to detect motion.
Thank you for reading and supporting us.
- See attachments on the beginning of this project description
Installing the ESP8266 NodeMCU Board in Arduino IDE 2.0 (Windows, Mac OS X, Linux)
How to flash NodeMCU ESP8266 firmware
How to control servo with joystick PS2 using NRF24L01 2.4GHZ RF transceiver module