![]() Serial.The aircraft carrier USS George Washington (CVN 73) begins the transit to Newport News, Va., on Aug. SoftwareSerial SWserial( 8, 9) // RX, TX void setup() Gsm_send_serial( "AT+SAPBR=3,1,USER," + apn_u) Gsm_send_serial( "AT+SAPBR=3,1,APN," + apn) Gsm_send_serial( "AT+SAPBR=3,1,Contype,GPRS") Gsm_send_serial( "AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded") Gsm_send_serial( "AT+HTTPPARA=URL," + url) Serial.println( " - Start GPRS & HTTP - ") Gsm_http_post( "param=TestFromMySim800") Serial.println( "ESP32+SIM800L AT CMD Test") String url = "" //URL of Server void setup() * More information at: * ESP32 SIM800 HTTP POST TEST | V 1.0_2020-AUG-18 */ #define SIM800L_RX 27 #define SIM800L_TX 26 #define SIM800L_PWRKEY 4 #define SIM800L_RST 5 #define SIM800L_POWER 23 If there are still problems, the waiting time for answers can be increased. The output is in the Serial Monitor, which is suitable for diagnostic purposes. If the module needs longer with an answer, the function waits until the data has arrived. Via the loop the microcontroller waits about 3 seconds for replies from the SIM800. The function "gsm_send_serial" handles the bidirectional communication with the SIM800. When the data transfer is completed, the GPRS carrier is disconnected again and the microcontroller waits until this function is called again. ![]() Here first the GRPS carrier is activated and then the HTTP function is called. Then the function "gsm_http_post" is called with the corresponding post parameters to be transferred. Important: If the SIM800 is switched off, these parameters must be communicated to the SIM800 again at the next start. All important parameters (connection type, APN, user name, password) are transferred to the SIM800. Then the function "gsm_config_gprs" is called. The software waits about 10 seconds until the SIM800 has connected to the mobile network and is ready for operation. Then the power supply to the SIM800 is switched on and the serial connection is activated. All information is available in the article SIM800 Basics. The pins in the example code are already adapted to the board. First of all, basic parameters (APN.) and pins must be correctly defined in the code for successful operation. The sample code for the ESP32 SIM800 board contains the AT commands mentioned above and passes them in the correct order. This command aborts a running HTTP request. User data are also received via this command, which can be evaluated by the microcontroller for further control settings. This command passes the URL to be called. The response includes the status code from the server and the data length. The following applies: 0=GET, 1=POST, 2=HEAD. With HTTPACTION the transfer method is defined. The POST parameters can now be transferred to the SIM800 within the previously defined time window. Once the previous command has been sent, the SIM800 waits for the user data. Again, 10 seconds (10000 ms) is a generous value. ) and can be a value between one and 120 seconds. This depends on many factors (connection, server, amount of data. The second number indicates the time (milliseconds) in which the data must arrive before the SIM800 aborts the request. The value 192 bytes is usually sufficient to transfer a few parameters (e.g. Here the following applies: Better a little more than too little, but also not too much. This command defines the size of the user data to be transferred in bytes. It tells which media type in the request will be sent to the server. The content type is only relevant for the web server. This command defines the content type of the current request. If the server is not running on port 80, the corresponding port is simply added to the end of the URL or IP. It is the same format as it is entered in a web browser. This command defines the carrier profile. The SIM800 will be informed that an HTTP request starts. ![]() This command initializes the HTTP service.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |