Template: Pico-SIM868-Manual

From Waveshare Wiki
Revision as of 11:57, 28 July 2021 by Waveshare-eng11 (talk | contribs) (Created page with "==Hardware connection== *Pico-SIM868-GSM/GPRS/GNSS x 1 <font color="gray">(Pin header should be soldered)</font> *Raspberry Pi Pico x 1 <font color="gray"></font> *SIM卡...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Hardware connection

  • Pico-SIM868-GSM/GPRS/GNSS x 1 (Pin header should be soldered)
  • Raspberry Pi Pico x 1
  • SIM卡 x 1 (Support supports 2G service)
  • Micro USB cable x 1

Pico-SIM868-GSM-GPRS-GNSS-5.jpg

Description:

If you need to use audio, you need to connect a speaker.
When in use, it is recommended to connect to the lithium battery: when there is no additional USB power supply, turn on the USB to turn off the lithium battery power supply, switch to VBAT to use the lithium battery power supply; When connected to USB power, the USB can be used to charge the lithium battery, power the Pico or write firmware and programs.

Python Examples

Please follow the guides of Raspberry Pi to install and set up Pico for the Pico.

For easy use, we recommend you use the Thonny tool.

  • Thonny website
  • Please set the Thonny development environment to be RaspberryPi when setting
Pico-R3-Tonny1.png

AT Test

This routine is mainly to facilitate the user can through the Thony software, directly test and verify the AT instruction transceiving module. The main program will start the module directly first and then check the network condition. After that, it will check the AT instructions entered by the user, send them to the module through the serial port, and then send the AT instructions back to the Pico serial port for printing.
For more details of AT commands, please check the manual:File:SIM800 Series_AT Command Manual_V1.11.pdf

Expected result

SIM868 AT Test.png

GPS Positioning

This example mainly demonstrates GPS positioning-related tests. To perform this example, the GPS antenna receiver must be placed outside (or in a window where the sky can be seen), and the GPS location cannot be obtained on rainy days。
For more details of AT commands, please check the manual:File:SIM868 Series_GNSS_Application Note_V1.02.pdf

Expected result

SIM868 PICO GPS.png

Taking calls

This example mainly demonstrates the phone call test. The module has an onboard microphone so that calls can be made directly to each other, and speakers are needed to hear the sound.
For more details of AT commands, please check the manual:File:SIM800 Series_AT Command Manual_V1.11.pdf

Expected result

SIM868 Phone call.png

HTTP

Description

In this example, Raspberry Pico is connected to the Internet through NB-IoT and gets the weather information from the weather website through HTTP GET. Meanwhile, the temperature information on Pico is pushed to the server through HTTP POST.
Users can access the website and view the data uploaded in real-time. The software schematic is as follows:
Pico-SIM7020-HTTP-demo-diagram.png

Server Web Page Deployment

User http://pico.wiki/esp-chart.php as example.
Pico-SIM7020-HTTP-Demo-2.png
1、Server setup PHP, mysql and other environment, create database files. For example:

  • Database:example_esp_data
  • Password:your_password
  • user name:your_username
  • Create database table:
CREATE TABLE Sensor (
   id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
   value1 VARCHAR(10),
   value2 VARCHAR(10),
   value3 VARCHAR(10),
   reading_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)

2、Example PHP files on the server are post-data.php and esp-chart.php

  • post-data.php: HTTP POST API that the SIM7080G module can call to POST data to the server.
  • esp-chart.php: The latest data uploaded by SIM7080G can be obtained from a web page accessed by the client and displayed in a graph.

Pico software setup

Download python example:Demo codes ,Part of the HTTP codes:

  • HTTP GET:
# HTTP GET TEST
def http_get():
   send_at('AT+HTTPINIT', 'OK')
   send_at('AT+HTTPPARA=\"CID\",1', 'OK')
   send_at('AT+HTTPPARA=\"URL\",\"'+http_get_server[0]+http_get_server[1]+'\"', 'OK')
   if send_at('AT+HTTPACTION=0', '200', 5000):
       uart.write(bytearray(b'AT+HTTPREAD\r\n'))
       rec_buff = wait_resp_info(8000)
       print("resp is :", rec_buff.decode())
   else:
       print("Get HTTP failed, please check and try again\n")
   send_at('AT+HTTPTERM', 'OK')
  • HTTP POST:
  1. HTTP POST TEST
def http_post():
   send_at('AT+HTTPINIT', 'OK')
   send_at('AT+HTTPPARA=\"CID\",1', 'OK')
   send_at('AT+HTTPPARA=\"URL\",\"'+http_post_server[0]+http_post_server[1]+'\"', 'OK')
   send_at('AT+HTTPPARA=\"CONTENT\",\"' + http_content_type + '\"', 'OK')
   if send_at('AT+HTTPDATA=62,8000', 'DOWNLOAD', 3000):
       uart.write(bytearray(http_post_tmp))
       utime.sleep(5)
       rec_buff = wait_resp_info()
       if 'OK' in rec_buff.decode():
           print("UART data is read!\n")
       if send_at('AT+HTTPACTION=1', '200', 8000):
           print("POST successfully!\n")
       else:
           print("POST failed\n")
       send_at('AT+HTTPTERM', 'OK')
   else:
       print("HTTP Post failed,please try again!\n")

Expected result



Results of web page access on the server:http://pico.wiki/esp-chart.php

SIM868 HTTP POST Result mark.png