W55MH32L-EVB MicroPython reference script

In this page, we will show all network and peripheral MicroPython script with simple setup.

Basic Setups

  1. Use a USB type C cable to connect the DAP-LINK Port with your PC to provide power and serial communication with Thonny.

  2. Go to Thonny and select the correct COM port and interpreter (MicroPython generic).

W55MH32L-EVB connection

How to install micropython firmware for W55MH32L-EVB?

YouTube Tutorial: Watch firmware installation video

  1. Connect DAPLINK USB port with your PC

  2. Windows will pop-up a new disc called WIZLINK

  3. Drag and drop the hex file to the WIZLINK window

WIZnet5K Networking

See network.WIZNET5K and socket.

Basic Setup for Networking:
  1. Connect the board and PC with an Ethernet cable.

  2. Set the IP address of the board and PC in the same IP segment.

Network Configuration

Script: GitHub

YouTube Tutorial: Watch Network Configuration demo video

Static IP

Results:

It shows the IP address details set inside the script.

_images/StaticIP.png

DHCP

Results:

It shows the IP address details provided by the DHCP server or router.

_images/DHCP.png

TCP

YouTube Tutorial: Watch TCP Client & Server demo video

TCP Server

Script: GitHub

Setup:
  1. Set your PC’s IP to 192.168.1.100.

  2. Run the script – board gets IP 192.168.1.20 and waits for one client on port 5000.

  3. Connect a TCP client (e.g., WIZnet Socket Tester) to 192.168.1.20:5000 and send any message.

Results:
  1. The board replies with Echo: <your message>.

  2. Send exit to close the connection; the script ends.

  3. Run the script again to accept a new client.

_images/TCPServer.gif

TCP Client

Script: GitHub

Setup:
  1. Set your PC’s IP to 192.168.1.100 and run a TCP server on port 5000 (e.g., WIZnet Socket Tester).

  2. Run the script – board gets IP 192.168.1.21 and connects to server at 192.168.1.20:5000.

Results:
  1. The board sends Hello, World, Test, then exit.

  2. For each message except exit, it prints the server’s echo reply.

  3. After sending exit, the socket closes and the script ends.

_images/TCPClient.gif

UDP

YouTube Tutorial: Watch UDP Client & Server demo video

UDP Server

Script: GitHub

Setup:
  1. Set the board’s IP to 169.254.100.50.

  2. Run the script – it binds to port 5000 and waits for incoming UDP packets.

  3. Send messages from any UDP client.

Results:
  1. The server prints every received message.

  2. When the server receives the word exit, it closes the socket and stops.

  3. Run the script again to restart listening.

_images/UDPServer.gif

UDP Client

Script: GitHub

Setup:
  1. Set the board’s IP to 169.254.100.50 (or modify the script as needed).

  2. Ensure the target server IP (e.g., 169.254.219.97) is reachable on port 5000.

  3. Run the script – it binds to port 5000.

Results:
  1. Type any message in the MicroPython shell; the client sends it to the server.

  2. The client prints Sent: <your message> (no reply expected).

  3. Type exit to close the socket and end the script.

_images/UDPClient.gif

DNS (Domain Name System)

Script: GitHub

YouTube Tutorial: Watch DNS demo video

Setups:
  1. Connect the board and your PC to the same network using Ethernet cables.

  2. Set your PC’s IP address to match the board’s subnet (e.g., 10.0.1.x).

  3. Run the script – it configures the board with static IP 10.0.1.50 and DNS server 8.8.8.8.

Results:
  1. The script resolves docs.w5500.com using Google’s DNS server.

  2. It prints the corresponding IP address on the MicroPython shell.

  3. You can verify the result using any DNS lookup tool (e.g., Google Admin Toolbox Dig).

_images/DNS.gif

NTP (Network Time Protocol)

See machine.RTC

Script: GitHub

tm1637 Library: GitHub.

ntptime Library: GitHub.

YouTube Tutorial: Watch NTP demo video

Setups:
  1. Connect a TM1637 7‑segment display module: CLK → PG7, DIO → PG8, VCC → 5V, GND → GND.

  2. Connect the board and your PC to the same network (Ethernet).

  3. Adjust the static IP configuration in the script to match your network (example uses 10.0.1.50/24).

Results:
  1. The display first shows the wrong time (10:30) for 5 seconds.

  2. The board then fetches the real UTC time from an NTP server and updates the internal RTC.

  3. After sync, the display shows the correct current time (hours:minutes) and continues updating every 0.5 seconds.

  4. The MicroPython shell also prints the time in HH:MM:SS format.

_images/NTP.gif

HTTP Web Server

Script: GitHub

YouTube Tutorial: Watch HTTP server demo

Setups:
  1. Connect an RGB LED (common cathode) to pins PA6 (red), PB9 (green), PA0 (blue) with appropriate resistors.

  2. Connect the board and your PC to the same Ethernet network.

  3. Run the script – it assigns static IP 169.254.100.20 and listens on port 8080.

Results:
  1. Open a web browser and go to http://169.254.100.20:8080.

  2. Three range sliders appear (red, green, blue). Drag any slider.

  3. The RGB LED changes colour instantly without page reload (using JavaScript fetch).

  4. The MicroPython shell prints the RGB values for each request.

_images/http.gif

Adafruit IO

Adafruit IO is a cloud IoT platform by Adafruit that provides a free MQTT broker, customizable dashboards, and data visualization tools.

MQTT

Script: GitHub

umqtt.simple Library: GitHub

YouTube Tutorial: Watch Adafruit IO MQTT demo

Setups:
  1. Create an Adafruit IO account and obtain your username and AIO key.

  2. Create two feeds: led (for control) and status (for feedback).

  3. Place your credentials in a secrets.py file (ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY).

  4. Connect an LED to pin PG8 (with a current‑limiting resistor).

  5. Run the script – the board gets an IP via DHCP and connects to io.adafruit.com.

Results:
  1. The board subscribes to the led feed and waits for commands.

  2. In the Adafruit IO dashboard, click an ON/OFF button on the led feed.

  3. The LED turns on/off instantly; the board publishes a status message to the status feed.

  4. The MicroPython shell prints received commands and published status.

_images/Adafruit_mqtt.gif

HTTP Client

Script: GitHub

urequests Library: GitHub

YouTube Tutorial: Watch Adafruit IO HTTP demo

Setups:
  1. Create an Adafruit account and visit Adafruit IO.

  2. Obtain your username and AIO key.

  3. Create two feeds: temperature and humidity.

  4. Place your credentials in a secrets.py file.

  5. The onboard AHT20 sensor is used (I2C pins PB7 = SDA, PB6 = SCL).

  6. Run the script – the board gets an IP via DHCP.

Results:
  1. Every 3 seconds, the board reads temperature and humidity from the AHT20.

  2. It sends an HTTP POST request to Adafruit IO’s REST API with the sensor values.

  3. The dashboard updates automatically with new data points.

  4. The MicroPython shell prints the HTTP status code (200 = success).

_images/Adafruit_http.gif

GPIO (General Purpose Input Output)

See machine.Pin.

Script: GitHub

YouTube Tutorial: Watch GPIO demo video

Setup:

Press the onboard button (PG6) to turn on and off the onboard LED (PD14).

Results:

The onboard LED will turn on and off based on the button state.

_images/GPIO.gif

ADC (Analog to Digital Conversion)

See machine.Pin and machine.ADC.

Script: GitHub

YouTube Tutorial: Watch ADC demo video

Setup:

Connect PA4 with a potentiometer for ADC testing

Results:

It shows the different results during changing the resistance value of the potentiometer.

_images/ADC.gif

DAC (Digital to Analog Conversion)

See machine.Pin and machine.DAC.

Script: GitHub

YouTube Tutorial: Watch DAC demo video

Setup:

Connect PA4 with a multimeter for DAC testing

Results:

The multimeter should show ~1.65V result

_images/DAC.gif

Bitstream

See machine and machine.Pin.

Script: GitHub

YouTube Tutorial: Watch Bitstream demo video

Setup:
  1. Connect a WS2812 LED strip (12 LEDs) to pin PD5.

  2. Provide power to the strip (5V) and common ground with the board.

Results:

The script cycles through red, green, and blue colors, each lasting 1 second. Each color is printed on the MicroPython shell.

_images/bitstream.gif

RTC (Real time clock)

See machine.RTC.

Script: GitHub

YouTube Tutorial: Watch RTC demo video

Setup:

Input the datetime into the script.

Results:

It shows the updated time every 3 seconds.

_images/RTC.gif

Timer

See machine.Timer.

Script: GitHub

YouTube Tutorial: Watch Timer demo video

Setups:

The script has set TIM4 into 1HZ

Results:

It shows the print result to show the timer is ticking

_images/timer.gif

UART (Serial Bus)

See machine.UART.

Script: GitHub

YouTube Tutorial: Watch UART demo video

Setups:
  1. Connect a USB-TTL module with W55MH32L-EVB’s PA2(TX) and PA3 (RX) for USART2 to communicate with the PC.

  2. Open a serial terminal to receive and send data using UART

Results:
  1. The USB-TTL module serial terminal shows 10 sets of “abc” data.

  2. The MicroPython serial terminal shows 1 set of “123” data.

_images/uart.gif

I2C

See machine.I2C.

Script: GitHub

ahtx0 Library: GitHub

YouTube Tutorial: Watch I2C demo video

Setups:
  1. Using I2C(1) to communicate with the board’s AHT sensor.

  2. Pin PB6 (SCL) and PB7 (SDA) has connected internally with the sensor.

  3. ahtx0.py library needs to be save in W55MH32’s Flash

Results:

It shows the Temperature and Humidity result.

_images/I2C_temp.gif

SPI

See machine.SPI.

SPI bus (WIZ850io)

Script: GitHub

YouTube Tutorial: Watch SPI demo video

Setups:
  1. Connect the SPI(1) with WIZ850io module.

  2. Please based on the follow table to connect the WIZ850io with W55MH32.

WIZ850io

W55MH32

GND

GND

VCC

3V3

SCLK

PA5 (SPI1_SCK)

MOSI

PA7 (SPI1_MOSI)

MISO

PA6 (SPI1_MISO)

SCSn

PA4

RSTn

PA3

Results:

It shows the correct chip version from W5500 chip’s register.

_images/spi_wiznet.png

SPI bus (ST7789)

Script: GitHub

st7789py Library: GitHub

Setups:
  1. Connect the SPI(1) with a 1.54 inch TFT ST7789 (240 x 240) display.

  2. Please include the st7789py and the VGA text file.

  3. Please based on the follow table to connect the display with W55MH32.

ST7789

W55MH32

GND

GND

VCC

3V3

SCL

PA5 (SPI1_SCK)

SDA

PA7 (SPI1_MOSI)

RST

PD6

DC

PD5

CS

PA4

BL

3V3 (100% brightness)

Results:

It will display the following result.

_images/st7789.gif

SD Card

See machine.SDCard.

Script: GitHub

YouTube Tutorial: Watch SD Card demo video

Setups:

Insert a microSD card into the SD card slot on the W55MH32 board.

Results:
  1. A file named “testing.txt” is written to the “/sd/” directory on the SD card.

  2. The content “Hi from W55MH32!” is written to the file.

  3. The script reads the content back from “testing.txt”.

  4. The content is printed on the MicroPython shell.

_images/sd_card.gif

USB

Setups: Connect the USB cable to the USB device port on W55MH32.

YouTube Tutorial: Watch USB demo video

USB VCP Mode (Virtual COM Port Only)

See machine.USB_VCP.

Script: GitHub

Setups:
  1. Turn on PuTTY (or any serial terminal).

  2. Type and send a message from PuTTY to the board.

Results:

The board will echo back whatever message was received.

_images/usb_vcp.gif

USB MSC Mode (Mass Storage Only)

Script: GitHub

Setups:
  1. Run the script to enable USB MSC mode.

  2. The board will appear as a USB flash drive on your computer.

Results:
  1. A file named “test.txt” is written to the USB flash drive.

  2. The script reads the content back from “test.txt”.

  3. The content is printed on the MicroPython shell.

_images/usb_msc.gif

WDT (Watchdog Timer)

See machine.WDT.

Script: GitHub

YouTube Tutorial: Watch WDT demo video

Setups:
  1. Run the script to enable the hardware watchdog with a 3‑second timeout.

  2. Observe the first demo (with wdt.feed()) – the program runs all 6 iterations.

  3. Comment out the wdt.feed() line and rerun to see the unsafe behaviour.

Results:
  1. Safe demo – The watchdog is fed every second. No reset occurs.
    Safe demo – feeding watchdog
  2. Unsafe demo – Without feeding, the watchdog expires after 3 seconds and forces a system reset. The board reboots automatically.
    Unsafe demo – no feed, reset triggered

PWM (Pulse Width Modulation)

See machine.PWM.

Script: GitHub

YouTube Tutorial: Watch PWM demo video

Setups:
  1. Connect the servo: signal wire to PA0, power to 5V, ground to GND on the W55MH32L-EVB.

  2. Run the script to initialise PWM on PA0 at 50 Hz.

  3. Watch the servo move to 0°, then 90°, then 180°, and finally sweep back and forth.

Results:
  1. The servo moves precisely to each angle (0°, 90°, 180°) and holds the position.

  2. After the fixed positions, the servo sweeps smoothly back and forth in 10° increments.

  3. The MicroPython shell prints the current angle and duty cycle for each step.

_images/pwm.gif

Music

See : Music and machine.Pin.

Script: GitHub

YouTube Tutorial: Watch Music demo video

Setups:
  1. Connect a passive buzzer (or small speaker) to pin PD15.

  2. Provide common ground between the buzzer and the board.

Results:

The script plays the built‑in melody music.PUNCHLINE through the buzzer. The playback is blocking – the program waits until the melody finishes before printing Done..