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 whet 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

Remote Control

Character Displays

Graphical Displays

  • Drivers and nano-GUI for non-touch displays Very lightweight output-only GUI which supports a wide range of displays including OLED, LCD, ePaper and Sharp types. Supports hosts including Pyboard, ESP32 and Pi Pico.

  • micro-gui A GUI which handles input via pushbuttons or a navigation joystick. Uses the same drivers as nano-gui, so supports a wide range of displays and hosts.

  • LCD touch screens with SSD1963 Driver for medium sized (4.3 and 7 inch) colour LCD displays.

  • Touch GUI A touch interface library for the above displays.

  • RA8875 Touch GUI Device driver and GUI for 4.3" and 7" Adafruit displays with their RA8875 controller. Cross-platform, uses SPI to minimise pin count.

  • Touch GUI for official Pyboard LCD display For displays using the LCD160CR controller.

  • Driver for OLED displays with SSD1306 Note: there is now an official driver here.

  • e-paper display Supports Embedded Artists (EA) and Adafruit displays. EA support includes drivers for the onboard flash memory and LM75 temperature sensor. Alas hardware now seems to be obsolete.

  • FBConsole Framebuffer console class for MicroPython. You can redirect REPL to any framebuffer device.

Memory device drivers

  • Nonvolatile memory Device drivers for EEPROM and Ferroelectric RAM. Memory with extremely high write endurance. Now also handles Flash chips. Can mount single or multiple chips as a filesystem or treat as a byte array.

Audio

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, a bridge enables a target lacking a network interface (e.g. Pyboard 1.x or Raspberry Pi Pico) 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. Now updated for uasyncio version 3.
  • 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.
  • Schedule Make a callback or coroutine run at specified times and/or dates. Similar in purpose to Unix cron and CPython's schedule module, but designed for small size and efficiency.

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