014 - ESP32 MicroPython: SIM800L GSM Module in MicroPython

Introduction

In this tutorial, we will tackle on how to interface SIM800L GSM module to ESP32 in MicroPython.

Circuit Diagram

Hardware Instruction

  1. Connect SIM800L Rx pin to ESP32 GPIO 16 (Tx2).
  2. Connect SIM800L Tx pin to ESP32 GPIO 17 (Rx2).
  3. Connect the SIM800L VCC pin to external positive terminal. In this tutorial, I use external power supply through 1N4001 diode.
  4. Common ground all the ground pins. Refer to this manual for the AT Commands:

https://www.elecrow.com/wiki/images/2/20/SIM800_Series_AT_Command_Manual_V1.09.pdf

Video Demonstration

Call To Action

If you find this tutorial as helpful, please do Subscribe to my Youtube channel by clicking the following link: Click this to Subscribe to TechToTinker Youtube channel.

Thank you and have a good days ahead,
George Bantique, TechToTinker

Source Code

 1import machine
 2gsm = machine.UART(2, 115200)
 3
 4#1. Check for the signal strength
 5gsm.write('AT+CSQ')
 6
 7#2. Get the list of available network operators
 8gsm.write('AT+COPS=?')
 9
10#3. Determine the network operators the sim800l is currently registered
11gsm.write('AT+COPS?')
12
13#4. Determine if the sim800l is currently connected
14gsm.write('AT+CREG?')
15
16#5. Force it to connect
17gsm.write('AT+CREG=1')
18
19#6. Get the current battery level
20gsm.write('AT+CBC')
21
22#7. Turn off the echo of commands, 
23# use ATE0 to turnoff and ATE1 to turnon.
24gsm.write('ATE0')


Posts in this series



No comments yet!

GitHub-flavored Markdown & a sane subset of HTML is supported.