Breadboard
docs
Example project · ESP32

Wi-Fi dashboard (OLED)

Boot the actual Espressif Wi-Fi stack, scan the virtual ether, associate with BreadboardNet and get a DHCP lease, then render the live link (SSID, IP, channel, RSSI) to an OLED. Open the 📡 Sniffer to watch every frame, and click the board for its radio state.

The Wi-Fi dashboard (OLED) circuit as rendered by the simulator

What's on the bench

  • Battery
  • ESP32-C3
  • OLED 128×64

The code

This MicroPython script runs on the emulated board every boot; edit it in the Code tab.

from machine import I2C, Pin
import framebuf, time
i = I2C(0, scl=Pin(9), sda=Pin(8))
buf = bytearray(1024)
fb = framebuf.FrameBuffer(buf, 128, 64, framebuf.MONO_VLSB)
for c in b'\xae\xd5\x80\xa8\x3f\xd3\x00\x40\x8d\x14\x20\x00\xa1\xc8\xda\x12\x81\xcf\xd9\xf1\xdb\x40\xa4\xa6\xaf':
    i.writeto(0x3c, bytes([0, c]))
def show():
    i.writeto(0x3c, b'\x00\x21\x00\x7f\x22\x00\x07')
    i.writeto(0x3c, b'\x40' + buf)

import network
w = network.WLAN(network.STA_IF)
w.active(True)
fb.fill(0); fb.text('WiFi scanning...', 0, 28); show()
rssi = 0; ch = 1
for ss, bssid, c, r, sec, hid in w.scan():
    if ss == b'BreadboardNet':
        rssi = r; ch = c
w.connect('BreadboardNet')
while not w.isconnected():
    time.sleep_ms(100)
ip = w.ifconfig()[0]
print('connected', ip, 'ch', ch, 'rssi', rssi)
while True:
    fb.fill(0)
    fb.text('WiFi CONNECTED', 0, 0)
    fb.hline(0, 10, 128, 1)
    fb.text('BreadboardNet', 0, 16)
    fb.text('IP ' + ip, 0, 30)
    fb.text('ch %d   %d dBm' % (ch, rssi), 0, 44)
    show()
    time.sleep_ms(500)