Wiznet makers

ronpang

Published June 24, 2026 ©

199 UCC

109 WCC

35 VAR

0 Contests

1 Followers

0 Following

W55RP20-EVB-MKR Module MicroPython Practice (9): HTTP Client Requests

This article is the 9th part of the WIZnet W55RP20 chip MicroPython tutorial series, written based on the latest official firmware.

COMPONENTS
PROJECT DESCRIPTION

W55RP20-EVB-MKR Module MicroPython Practice (9): HTTP Client Requests

This article is the 9th part of the WIZnet W55RP20 chip MicroPython tutorial series, written based on the latest official firmware. All code has been practically verified and can be directly flashed and run. Copyright Notice: This article is an original technical article from WIZnet. Please indicate the source when reproducing.

Preface

In the previous practical tutorial, we completed the NTP Network Time Synchronization feature development for the W55RP20 chip, achieving precise device timing and automatic Beijing Time calibration.

In this article, we enter the core technology of network data interaction — HTTP Client Requests.

HTTP is the most fundamental communication protocol on the Internet, widely used in scenarios such as API calls, cloud data reporting, web page retrieval, and configuration fetching. HTTP Client allows embedded devices to actively request server data, making it an essential basic capability for IoT devices to access the Internet.

The W55RP20 integrates a hardware TCP/IP protocol stack. Combined with the built-in urequests library in MicroPython, GET/POST requests can be completed in just a few lines of code, without the need to manually handle Socket, DNS, or TCP connections — far surpassing traditional embedded solutions in development efficiency.

This article will guide you through:

HTTP protocol basic principles and request methods

HTTP Client hardware protocol stack workflow

GET request to obtain server data

POST request to upload JSON data

HTTP status codes and response data parsing

Static IP / DHCP dual-mode network configuration

HTTP request exception handling and stability optimization

Series Tutorial Learning Path

This column consists of 16 articles, progressively covering the full process of W55RP20-EVB-Pico module MicroPython development:

Part 1: Static IP Configuration and Network Basics

Part 2: DHCP Auto-Networking and Network Diagnostics

Part 3: TCP Client Communication

Part 4: TCP Server Communication

Part 5: UDP Unicast Data Communication

Part 6: UDP Multicast/Broadcast Data Communication

Part 7: DNS Domain Name Resolution

Part 8: NTP — Getting Time from the Network

Part 9: HTTP Client Requests (This Article)

Part 10: HTTP Server Setup

Part 11: HTTP Protocol and OneNET Platform Cloud Data Upload

Part 12: MQTT Protocol Basic Communication Verification

Part 13: MQTT Protocol Integration with Alibaba Cloud Platform

Part 14: MQTT Protocol Integration with OneNET Platform

Part 15: MQTT Protocol Integration with ThingSpeak Platform

Part 16: Modbus Industrial Protocol Communication

Table of Contents

1. Preparation

1.1 Software Preparation

1.2 Hardware Preparation

2. Flashing W55RP20-EVB-Pico Module Dedicated MicroPython Firmware

3. Hardware Connection and Development Environment Configuration

3.1 Hardware Connection

3.2 Thonny Development Environment Configuration

4. HTTP Protocol Core Principles

4.1 HTTP Introduction

4.2 Common Request Methods

4.3 HTTP Workflow

4.4 Status Code Description

5. WIZnet Hardware Protocol Stack HTTP Advantages

6. Core Code Analysis

6.1 Complete Runnable Code

6.2 Code Feature Description

7. Running Results and Test Verification

8. Common Issues One-Stop Troubleshooting

8.1 HTTP Request Timeout / Failure

8.2 POST Data Upload Failure

8.3 Thonny Cannot Flash

9. Typical Application Scenarios

10. W55RP20 Core Advantages Comparison

11. Summary

12. Series Preview and Resource Access

12.1 Series Preview

12.2 Resource Access


1. Preparation

1.1 Software Preparation

All required software is available in free versions. Download and install as needed — no additional payment required.

Software NameVersion RequirementDownload URLDescription
Thonny4.0 and aboveThonny Official DownloadLightweight MicroPython IDE, supporting code editing, flashing, and serial debugging, beginner-friendly
W55RP20-EVB-Pico Module MicroPython FirmwareLatest stable versionWIZnet Official Firmware DownloadCustom-built for the W55RP20-EVB-Pico module, with integrated WIZnet hardware drivers and protocol stack

1.2 Hardware Preparation

As shown in the figure, the W55RP20-EVB-MKR development board physical image.

The following hardware is required:

W55RP20-EVB-MKR development board × 1

USB data cable × 1

Standard Ethernet cable × 1

Router or switch × 1

Note: The W55RP20-EVB-MKR already has an onboard Ethernet interface, requiring no additional soldering or wiring of other components — plug and play. This significantly reduces the probability of wiring errors and hardware failures.


2. Flashing W55RP20-EVB-Pico Module Dedicated MicroPython Firmware

Before running the static IP example, you need to flash the corresponding MicroPython firmware onto the W55RP20-EVB-MKR first.

Firmware file example:

firmware.uf2

The W55RP20-EVB-MKR is compatible with the Raspberry Pi Pico UF2 firmware flashing method. The steps are as follows:

Use a USB data cable to connect the development board and the computer

Hold down the BOOTSEL button on the development board

Press the RUN button once

Release the buttons after the computer recognizes the RPI-RP2 disk

Drag the .uf2 firmware file into the RPI-RP2 disk

The development board automatically restarts, and firmware flashing is complete

Note: If the computer does not recognize the RPI-RP2 disk, you can try unplugging and replugging the USB data cable, or replace it with a USB cable that supports data transmission.


3. Hardware Connection and Development Environment Configuration

3.1 Hardware Connection

The W55RP20-EVB-MKR connection is extremely simple, requiring only two steps:

Use a USB data cable to connect the development board to the computer (for power supply, code flashing, and serial debugging)

Use an Ethernet cable to connect the development board's Ethernet interface to the router's LAN port

The following figure shows the hardware connection diagram

3.2 Thonny Development Environment Configuration

Open the Thonny software, click the top menu bar "Run" → "Configure Interpreter"

Switch to the "Interpreter" tab

Select "MicroPython (generic)" from the "Interpreter" dropdown list

Select the serial port corresponding to the W55RP20-EVB-MKR from the "Port" dropdown list (usually displayed as Board CDC @ COMx)

Check "Restart interpreter before running code" and "Sync device's real-time clock"

Click "OK" to complete the configuration

The interface after configuration is shown below:

If the development board does not appear in the port list, please try:

Unplugging and replugging the USB data cable

Replacing with a USB data cable that supports data transmission

Closing other software that occupies the serial port (such as serial assistants, Arduino IDE, etc.)

Re-flashing the MicroPython firmware


4. HTTP Protocol Core Principles

4.1 HTTP Introduction

HTTP (HyperText Transfer Protocol) is a hypertext transfer protocol based on TCP, and is the most widely used client/server communication protocol on the Internet.

4.2 Common Request Methods

GET: Retrieve data from the server (query, read)

POST: Submit data to the server (upload, report)

4.3 HTTP Workflow

Device connects to network → DNS resolves domain name → establishes TCP connection;

Sends HTTP request message (method, URL, headers, data);

Server processes and returns response;

Parses status code and response body data;

Closes connection.

4.4 Status Code Description

200: Request successful

404: Page not found

500: Server error


5. WIZnet Hardware Protocol Stack HTTP Advantages

Hardware handles TCP/IP, 0% MCU utilization

Built-in DNS, direct domain name access without manual resolution

Multiple hardware Socket support, can simultaneously run HTTP, TCP, MQTT, and other tasks

High stability, not easily disconnected in weak network environments

MicroPython encapsulates urequests, fully compatible with Python syntax


6. Core Code Analysis

6.1 Complete Runnable Code

# ===== Net Config (edit here) =====
BOARD = "W55RP20-EVB-Pico"
USE_DHCP = True

# Static IP settings (used when USE_DHCP=False)
NET_IP   = "192.168.11.20"
NET_SN   = "255.255.255.0"
NET_GW   = "192.168.11.1"
NET_DNS = "8.8.8.8"

URL     = "http://httpbin.org"
# ==================================

from usocket import socket
import urequests
from wiznet_init import wiznet


def request(url: str):
   # ---------- GET Request ----------
   print("=== GET Request ===")
   r = urequests.get(f"{url}/get")
   print("Status code:", r.status_code)
   print("Response content:")
   print(r.text)
   r.close()

   # ---------- POST Request ----------
   print("\n=== POST Request ===")
   r = urequests.post(f"{url}/post", json={"msg": "WIZnet Test"})
   print("Status code:", r.status_code)
   print("JSON parsing:")
   print(r.json())
   r.close()

def main():
   print("=== W55RP20 HTTP Client ===")

   # Network initialization
   if USE_DHCP:
       nic = wiznet(BOARD, dhcp=True)
   else:
       nic = wiznet(BOARD, dhcp=False, ip=NET_IP, sn=NET_SN, gw=NET_GW, dns=NET_DNS)

   print("IP:", nic.ifconfig()[0])
   request(URL)

if __name__ == "__main__":
   main()

6.2 Code Feature Description

Dual-mode Network Configuration

USE_DHCP=True: Automatically obtain IP

USE_DHCP=False: Use static IP

GET Request

Retrieve server information from httpbin.org

Print status code and raw response text

POST Request

Upload data in JSON format

Automatically parse JSON returned by the server

Automatic Resource Release

Use r.close() to close the request and release Socket resources

High Compatibility

Consistent usage with standard Python requests, very easy to get started


7. Running Results and Test Verification

After flashing the code to the development board, the serial output after running is as follows:

=== W55RP20 HTTP Client ===
IP: 192.168.1.125
=== GET Request ===
Status code: 200
Response content:
{
"args": {},
"headers": {
  "Host": "httpbin.org",
  ...
},
...
}

=== POST Request ===
Status code: 200
JSON parsing:
{'json': {'msg': 'WIZnet Test'}, ...}

Verification Results

GET/POST requests all successful

Status code 200

Data sending and receiving normal

JSON parsing successful

Demo Video (Screen Recording 2026-04-29 145551 — HTTP Client request test)

HTTP Client request test GIF

8. Common Issues One-Stop Troubleshooting

8.1 HTTP Request Timeout / Failure

Troubleshooting CategorySpecific Troubleshooting Steps
Network ConnectionCheck if the Ethernet cable is firmly plugged in, confirm the device can normally access the external network
DNS ConfigurationConfirm DNS is available, try using 8.8.8.8 or 114.114.114.114
Firewall SettingsTurn off the router firewall (temporarily disable for testing)
URL FormatConfirm the URL starts with http://, avoid missing the protocol

8.2 POST Data Upload Failure

Troubleshooting CategorySpecific Troubleshooting Steps
Data FormatCheck if the uploaded JSON data format is correct, avoid syntax errors
Connection ReleaseUse r.close() in the code to release connections in a timely manner, avoid resource occupation

8.3 Thonny Cannot Flash

Troubleshooting CategorySpecific Troubleshooting Steps
Hardware & DriversReplace with a USB data cable that supports data transmission, reinstall the corresponding drivers
Flashing ModeHold down the BOOTSEL button on the development board, re-enter flashing mode, then try flashing the firmware again

9. Typical Application Scenarios

IoT sensor data cloud reporting

Fetching configuration information from servers

Obtaining weather, time, announcements, and other public API data

Device remote upgrades, log uploads

Embedded network interface debugging tools


10. W55RP20 Core Advantages Comparison

Comparison DimensionW55RP20 Integrated SolutionExternal PHY Chip SolutionExternal Serial-to-Ethernet Module Solution
BOM CostLow (single chip)Medium-High (MCU + module + peripheral components)High
PCB AreaSmall (only Ethernet port circuitry needed)Large (need to reserve chip and routing space)High
Development DifficultyLow (one line of code to connect to network)Medium-High (debug protocol stack, write drivers)Low
Network StabilityExtremely High (WIZnet has focused on hardware TCP/IP protocol stack for 25 years)Variable (requires high expertise from R&D personnel, must be proficient in protocol stack and network development to debug stably)Variable (depends on the R&D company's capability level)
CPU Resource Utilization0% (protocol stack network processing entirely handled by hardware)Over 50% (protocol stack runs entirely on MCU, occupying related resources)0%
Hardware Socket Count8 independent hardware SocketsDepends on MCU capability, theoretically supports multi-channel expansionGenerally single-channel transparent transmission
Network ThroughputUp to 15MbpsDepends on MCU capabilityApproximately 3-5Mbps
Interface Ease of UseSingle-chip integrationMCU needs MII/RMII or similar interfacesTTL interface
Deployment DifficultyLow (mature MicroPython firmware, most application-layer protocols have library files available, can be flexibly added and deployed)High (application-layer protocols require manual porting of open-source libraries for adaptation)Depends on module integration; features without integration require self-encapsulation and parsing

11. Summary

This article detailed the complete process of implementing HTTP Client requests on the W55RP20-EVB-MKR development board using MicroPython. From firmware flashing, hardware connection, and development environment configuration, to the core code implementation and running result verification, we completed the HTTP Client communication setup step by step.

Through this article, you should have mastered:

How to flash the dedicated MicroPython firmware for the W55RP20-EVB-MKR

The basic working principles of the HTTP protocol (GET/POST methods, status codes, etc.)

Using the urequests library to implement HTTP GET/POST request core code logic

Verifying whether HTTP communication is successful through serial output and response data parsing

Troubleshooting methods for common HTTP request issues (timeout, upload failure, etc.)

The W55RP20 chip, with its integrated Ethernet MAC+PHY high-integration design and hardware TCP/IP protocol stack, demonstrates significant advantages in IoT data interaction. Whether as a sensor data cloud reporting device, configuration fetching terminal, or embedded network debugging tool, it can achieve stable and reliable HTTP communication at extremely low cost.

The next tutorial will guide you through HTTP Server Setup, implementing the development board as a web server, providing LAN web page access, form submission, and device control features.


12. Series Preview and Resource Access

12.1 Series Preview

The next tutorial: HTTP Server Setup will implement the development board as a web server, providing LAN web page access, form submission, and device control features.

12.2 Resource Access

Complete code for this article: WIZnet Official Gitee Repository

W55RP20 chip manual: WIZnet Official Documentation Website

Next article: W55RP20-EVB-MKR Module MicroPython Practice (10): HTTP Server Setup

If this article was helpful, please like, bookmark, and follow — your support is our motivation for continuous updates! If you have any questions, feel free to leave a comment in the comment section, and we will reply as soon as possible.

Documents
Comments Write