Git Product home page Git Product logo

rp2040-sim868-micropython-library's Introduction

RP2040 SIM868 Micropython Library

  • SIM868L.py: a pure-MicroPython driver for the SIM868 GPRS module with both HTTP(S) GET and POST support. Works out of the box on the RP2040-SIM868.

Example usage of HTTP is in the example_SIM868.py script, just set the APN and change the pins if needed, then run the "example_usage" function.

Example usage of GPS is in the gps_example.py script, run the "example_usage" function.

Example usage of SMS is in the sms_example.py script, run the "example_usage" function.

How to use

Credit

This is a modified fork from Pythings SIM800L HAL Driver. There driver significantly speeded up development of RP2040-SIM868 HAL driver.

Methodes

Modem(uart=None, MODEM_PWKEY_PIN=None, MODEM_RST_PIN=None, MODEM_POWER_ON_PIN=None, MODEM_TX_PIN=None, MODEM_RX_PIN=None)

Brief

Initialize a class of Modem.

Params

  • uart: Hardware uart number to use
  • MODEM_PWKEY_PIN: Pin that the power key is attaced too. N/A for the RP2040-SIM868.
  • MODEM_RST_PIN: Pin that the Reset on the SIM868 is attached too. N/A for the RP2040-SIM868.
  • MODEM_POWER_ON_PIN: Pin that the Power on/off is attached too on the SIM868. PIN 3 on the RP2040-SIM868.
  • MODEM_TX_PIN: Pin that the TX on the SIM868 is attached too. PIN 5 on the RP2040-SIM868.
  • MODEM_TX_PIN: Pin that the RX on the SIM868 is attached too. PIN 4 on the RP2040-SIM868.

Modem.initialize()

Brief

Power on the modem and initialize the uart driver.


Modem.connect( apn, user='', pwd='')

Brief

Connect to the GPRS network.

Note

Set the APN to internet with no username or password. Otherwise please contact your service provider to get these settings.

Params

  • apn: Set SIM868 APN.
  • user: SIM868 APN USERNAME.
  • pwd: SIM868 APN PASSWORD.

Modem.disconnect()

Brief

Disconnect from the GPRS network.


Modem.http_request(url, mode='GET', data=None, content_type='application/json')

Brief

Send a HTTP request via the GPRS network.

Note

Only support for GET and POST method at this time.

Params

  • url: URL to send the HTTP Request too.
  • mode: HTTP method to use.
  • data: Data to be sent on the network via HTTP.
  • content_type: Set the HTTP content type header.

Returns

HTTP Response.


Modem.gps_on()

Brief

Turn on the GPS.


Modem.gps_off()

Brief

Turn off the GPS.


Modem.gps_read()

Brief

Request GPS data from the SIM868.

Returns

GPS data as a dictionary.


Modem.send_sms(number=None,msg='')

Brief

Send a SMS message. (untested)

Note

The number must lead with you international code eg. +27xxxxxxxxx

Params

  • number: Number to send the SMS too.
  • msg: SMS message.


Modem.get_info()

Brief

Get information about the modem

Returns

Modem information.


Untested or Undocumented

Modem.battery_status()

Modem.scan_networks()

Modem.get_current_network()

Modem.get_signal_strength()

Modem.get_ip_addr()

Modem.get_ip_addr()

rp2040-sim868-micropython-library's People

Contributors

alebat avatar amotl avatar devilbinder avatar sarusso avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.