A collection of miscellaneous libraries and drivers for Micropython
The code is at https://bitbucket.org/thesheep/micropython-oled/overview
See the README for explanation and examples.
This time I wrote drivers for something that mostly already had its drivers in MicroPython — the monochrome OLED displays. I did that, because I wasn't happy with the existing drivers — they are a bit elaborate in terms of indirection and inheritance. Sure, code reuse and so on, but not very nice for constrained platforms. So I did my own, trying to optimize them. I also exposed some useful functions, like flipping and hardware scrolling.
I will hopefully add some more exotic displays there, as I get specimen to test on.
The code is at https://bitbucket.org/thesheep/micropython-max31855
See the docstrings for usage.
The code is at https://bitbucket.org/thesheep/micropython-si7021
See the docstrings for usage.
The code is at https://bitbucket.org/thesheep/micropython-bno055
See the docstrings for usage example.
This is a small infra-red distance sensor with I²C interface. It can measure distances from 4 to 127cm. The source code is available here: https://bitbucket.org/thesheep/micropython-gp2y0e03/src
from machine import I2C, Pin import gp2y0e03 i2c = I2C(Pin(5), Pin(4), freq=100000) s = gp2y0e03.GP2Y0E03(i2c) s.read()
This is a collection of 6 different displays drivers for TFT and OLED RGB displays. I finally took the time to refactor all my drivers, pull out the common parts, and put them all in a single library. Don't worry, each driver is in a separate file, so you can copy only the parts that you are actually using onto your board.
The source is at https://bitbucket.org/thesheep/micropython-display
Here's a library for handling a bunch of popular I2C-based real-time clock chips: https://github.com/adafruit/Adafruit-uRTC
And here is the documentation for it: http://micropython-urtc.readthedocs.io/en/latest/
As you can guess from the naming, I was supported by Adafruit Industries to write this one (but of course it will work with any breakout boards for those chips, not just theirs). I will most likely create more libraries for them.
Another basic display driver. This one uses the framebuf module, as does the SSD1306 driver in Micropython's source tree.
The use is pretty much the same.
This driver is for a monochromatic matrix of up to 144 LEDs, with hardware PWM and blinking. It also has 8 frames of memory, and can fade between them, or play animations with them -- optionally synchronized to music! The code is at https://bitbucket.org/thesheep/micropython-is31fl3731/src/tip/is31fl3731.py
import is31fl3731 from machine import I2C, Pin i2c = I2C(Pin(5), Pin(4)) display = is31fl3731.CharlieWing(i2c) display.fill(127) display.pixel(0, 0, 2, True) display.blink(540)
This is a relatively cheap SPI E-ink display that you can find on tindie. It has 4 shades of grey per pixel, and 172x72 resolution.
from machine import Pin, SPI import ssd1606 spi = SPI(miso=Pin(12), mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT)) display = ssd1606.SSD1606(172, 72, spi, Pin(4), Pin(5), Pin(2), Pin(15)) display.fill(3) display.pixel(10, 10, 0) display.show()
And the display: