Wiring Cellular/GSM to use with ESPrtk

ESPrtk Cellular/GSM 2G 3G 4G LTE
3.3V out 3.3V
TX_UART3 RX-UART command
RX_UART3 TX-UART command
CS_Ethernet__PWR_GSM PoWeR Key or ReSeT

ESPrtk's PWR_GSM control pin is low level -active (default is HIGH-3.3v and pulls down to LOW-0V when active).

The PWR_GSM pin is usually used only one time to power on (or restart) the Cellular / GSM module by pulls down to 0V.

For some Cellular / GSM module variants there is a high level -active, it is necessary to use the invert logic (Not) port behind the PWR_GSM port of ESPrtk.

During connection with cell towers, Cellular / GSM devices need a higher energy level than normal. Connect large capacitors (2000uF to 1F) in parallel to the power supply to avoid problems related to voltage drop or network connection failure.

Auto configure


ESPrtk contains default AT scripts corresponding to each type of Cellular / GSM module and each configuration type. There are 4 minimum parameters that are required to configure connection registration with network service provider:

  • SIM PIN: used to unlock SIM in case the SIM is locked.
  • APN: Service's name.
  • User name - Password: Name and Password corresponding to that service. You can contact your carrier directly to request these information.

Custom AT configure

In case you need to apply your own configurable AT commands. You need to switch to 'Custom AT' mode.

Here, you can send any AT command with the help of some automated Script commands.

  • A Script command is surrounded and framed by 2 characters '[' and ']'.
  • The data in a Script frame are separated by the '^' character.
  • For example: [AT+CMEE=0^5^10^OK^ok] .
  • ESPrtk 3.9.x allows entering more than one Script command with a storage limit of 1500 bytes.
    • You may need to enable `View AT send/receive TX-RX` flag '' to see the receive and send AT status of ESPrtk during development.



      Custom AT Code



      Retart GSM device by pull-down PWR pin (in a second) and wait until GSM wakeup + ready.



      Retart/Reset GSM device by AT command and wait until GSM ready.



      Try scan to communicate with GSM device at baudrate a bps. If failed, auto select baudrate value and try again.



      Clear all RX buffer UART3.



      Delay in a Second.



      If SIM locked , set PIN SIM is abcd to un-lock SIM.



      Auto send AT to Configure Mode / Band /... for GSM device.



      Auto send AT to Open Network for GSM device.

      APN String Network: a

      GPRS Username: b

      GPRS Password: c



      Connect to Server IP: a,Port: b .

      If connect success , wait respond from Server after send string c .

      ( Auto replace \r \n to 0x0D 0x0A as byte data)

      ( Just for Dev)

      [TCP^google.com^80^GET /search?q=esprtk HTTP/1.1\r\nHost: www.google.com\r\nConnection: close\r\n\r\n]


      Send string a

      Wait until respond contain d

      Max time wait : b

      If not receive, try again, max try : c



      Send string a

      Wait until respond contain d1 or d2

      Max time wait : b

      If not receive, try again, max try : c






      Send string a

      Wait until respond contain d1 or d2 or d3 (or d4 or d5 or d6 .)

      Max time wait : b

      If not receive, try again, max try : c