Working with SSD1306 display through ESP-8266 using Micropython
- ESP-8266 (can work with NodeMCU dev platform or with ESP-01)
- SSD1306 128*64 LCD Display
- Micropython
-
esp_erase.sh
script can be used to easily erase and flash ESP from scratch. Usage:source esp_erase.sh [path_to_micropython_bin]
-
Uploading of files to the board can be easily done using
esp_push.sh
. Usage:source esp_push.sh
This deletes all the files from the board and then uploads everithing from the
esp/
dir.
- Use
img_to_bin.py
script to convert images to binary format. By default it gets all images fromraw_images/
folders and then stores converted files to theesp/images/
. You can change it by changing static variables in the script. Converter accepts any file format supported by Pillow. Usage is simple, just run:Images are stored inpython img_to_bin.py
.bin
files. Encoding is simple each pixel is converted to0-255
using PIL and then from0-255
to0-1
where0
is black and1
is white. Thats done simply by checking is value more than127
or less. File is simply a sequence of0
s and1
s.
Display is a subclass of SSD1306_I2C
that implements some addictional methods.
hardware_scroll
- Allows you to use hardware scroll that supported by SSD1306clear
- Fills display black and refreshesdraw_from_file
- Allows you to draw binary image from file (useimg_to_bin.py
to convert image to supported format).draw_from_sequence
- Allows you to draw image from sequence. I suggest to use generators for better memory optimization.draw_text
- Helper that allows you to easily drow multiline text with auto wrapping