The Heltec ESP32 board has a lot of memory and processing power (see below the console from tasmota flasher). Just for the fun sake and maybe an usefull one beside experimenting, I will give a chance to micropython.
The only advantege  I see, is that you can access the files and the code running on the board. While are you programming in Arduino, the code is more stable, but you must keep the source code and maybe to keep some versioning of the code for each board you have.

First of all, to install micropython, download download the proper image for your board, find instruction on the oficial site.

Burn it with the uPyCraft or Tasmota PyFlasher or A lot of tools to choose from.

Connect the board and browse the .py files from the filesystem. At first, you will see only the file.


First of all, we want to connect the board to local wifi lan! That’s why I have ESP32 or ESP8266!

import network
import time

wlan = network.WLAN(network.STA_IF) # create station interface       # activate the interface
wlan.isconnected()      # check if the station is connected to an AP
if not wlan.isconnected():
  print('connecting to network...')
  wlan.connect('homeWlan', 'my-wifi-passwd') # connect to an AP
  while not wlan.isconnected():
print('network config:', wlan.ifconfig())

This will connect to the network and prints the interface information.


Let’s light up the display!

For this, use the library from the oficial repository:

import ssd1306
# Heltec LoRa 32 with OLED Display
oled_width = 128
oled_height = 64
# OLED reset pin
i2c_rst = Pin(16, Pin.OUT)
# Initialize the OLED display
i2c_rst.value(1) # must be held high after initialization
# Setup the I2C lines
i2c_scl = Pin(15, Pin.OUT, Pin.PULL_UP)
i2c_sda = Pin(4, Pin.OUT, Pin.PULL_UP)
# Create the bus object
i2c = I2C(scl=i2c_scl, sda=i2c_sda)
# Create the display object
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
oled.text(wlan.ifconfig()[0], 0, 0)
oled.text('HELLO WiFi ESP32', 0, 25)
oled.text('', 0, 55)
#oled.line(0, 0, 50, 25, 1)

Read the docs from the micropython site, you will find a lot of examples

This solution works, find the discussion here


Support us getting your parts:

ESP32 Lora

Heltec WiFi 32 board

Happy blinking!
Recomended tools:

Breadboard & wires:

Heltec ESP32 display text in micropython
Tagged on:             

5 thoughts on “Heltec ESP32 display text in micropython

  • February 26, 2021 at 21:31

    Hey dude,

    I just bought the same microcontroller and your tutorial helped me a lot. Thank you so much :).

    • February 26, 2021 at 21:49

      thank you!

  • July 4, 2021 at 19:54

    Thank you. Other ssd1306 display codes did not work, this worked well.

  • March 21, 2022 at 07:33

    Very good tutorial.
    Great thanks from Shanghai China

    • March 21, 2022 at 10:04

      Thank you!

      Have fun!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.