not logged in | [Login]

Welcome to the MicroPython Wiki!

These pages host community generated documentation and examples of the features of MicroPython and the pyboard. We welcome your contributions.

Are You a New User?

If so, here's the basic stuff you need to read and know:

Dive Deeper

Community Contributed Projects to wet your appetite and spark ideas:

Libraries for External Devices

Usually you will want to connect different devices to your microcontroller, like sensors, displays, actuators and much more. Here you can find modules for different devices.

Official Accessories

  • Bluetooth module HC05

  • Drivers in the MicroPython source tree. These may be found under drivers:

    • NRF24L01 Provides two way checksummed radio communications with auto-retry in the 2.4GHz ISM band.

    • OneWire: generic driver for devices using the OneWire bus

    • CC3000 and CC3100: WiFi drivers

    • Display drivers: The official LCD touch display uses the LCD160CR controller. SSD1306 OLED devices are also supported.

    • DHT11 and DHT22 temperature and humidity sensors

    • SD card: supports SD cards connected by SPI bus.

Sensors

LED's

Character Displays

Graphical Displays

Networking

  • Network Protocol: SNMP, tested WiPy only.

  • MQTT A publish/subscribe protocol for the internet of things. Two projects:

    1. A "resilient" asynchronous client capable of coping with WiFi outages.
    2. Using a cheap ESP8266 as an interface, enables a target lacking a network interface (e.g. Pyboard) to be an asynchronous MQTT client.
  • IOT An alternative approach to IOT applications. ESP8266, ESP32 or Pyboard D nodes communicate with a server on the wired network using a simple serial interface. The interface offers guaranteed message delivery while coping with WiFi and server outages. Internet facing code runs on the server which may be a lightweight device such as a Raspberry Pi.

General Code Examples

Asynchronous programming and device drivers

  • Cooperative scheduling using uasyncio Resources include a tutorial, drivers for debounced switches and pushbuttons with optional push, release, double-click and long press events, and a set of synchronisation primitives. It also provides a modification to uasyncio offering a way to write applications with improved realtime performance. Also supports low current draw applications.
  • HTU21D temperature/humidity sensor
  • IR Remote Control The file aremote.py supports IR remotes using the NEC protocol.
  • GPS An asynchronous driver for GPS devices which connect via a UART. Includes a class to enable the GPS chip's behaviour to be altered (for hardware based on MTK3329/MTK3339 chips).
  • HD44780 LCD displays An asynchronous driver for these popular character-based displays.
  • Communicate via I2C Enables a Pyboard to communicate with another MicroPython device using I2C. The interface is a bidirectional UART-like stream I/O device. Of particular use with ESP8266 as it leaves the ESP8266 UART free.

Utilities

  • rshell Enables access to a MicroPython target via USB or a network connection. Enables maintenance of the filesystem using Unix-like commands. Also provides a REPL prompt.
  • Convert fonts to Python source A PC utility to convert ttf and otf files to MicroPython source which may optionally be frozen as bytecode. The file format is offered as a proposed standard.
  • data_to_py Converts an arbitrary binary data file to Python source which may be frozen as bytecode. This conserves RAM.
  • micropip A PC program for downloading MicroPython packages from PyPi. Runs under Python 3.2 or above. The package is put in a directory of your choice for subsequent transfer to target hardware.
  • WebREPL shell Provides remote MicroPython target REPL prompt, similar to "rshell connect telnet ...", but over enabled WebREPL on the module. Provides raw mode in addition to https://micropython.org/webrepl/ normal and paste modes.
  • mp.js Execute remote MicroPython commands over WebREPL interface.
    $ node mp.js abcd 192.168.4.1 5**4**3
    542101086242752217003726400434970855712890625
    $

Structured Detail

References