Advanced Wireless Labs
Welcome to Advanced Networking!
In these advanced labs you will explore secure connections and measure how fast your Pico W can send data over WiFi. These topics are used by professional network engineers!
Secure Communications with HTTPS
You have used Hypertext Transfer Protocol (HTTP) to send and receive data in earlier labs. HTTP sends data as plain text — anyone on the network could read it. For passwords and private data, you need a secure version called HTTPS.
The "S" in HTTPS stands for Secure. HTTPS uses a protocol called Transport Layer Security (TLS). TLS scrambles your data before sending it. Only the sender and receiver can unscramble it.
You may have heard HTTPS described as using a "Secure Sockets Layer" or SSL. TLS replaced SSL. They do the same job, but TLS is newer and more secure. When people say SSL today, they usually mean TLS.
Watch Out!
The MicroPython urequests library does not yet fully support HTTPS on the Pico W. This is because TLS needs extra setup with certificates and keys. Use HTTP for lab projects, but use HTTPS for any real project with passwords or private data.
See the MicroPython SSL/TLS Library for the latest status.
Testing SSL/TLS on Standard Python
You can test TLS on a regular computer first. This example uses standard Python (not MicroPython) to connect securely to www.python.org:
1 2 3 4 5 6 7 8 9 | |
What each line does:
ssl.create_default_context()— sets up security rules and certificate checkingsocket.create_connection((hostname, 443))— opens a connection to port 443 (the HTTPS port)context.wrap_socket(...)— wraps the regular connection in a secure TLS layerssock.version()— returns the TLS version being used
Output:
1 | |
This tells you that TLS version 1.3 is being used — the newest and most secure version.
Key Idea
When you visit a website that starts with https:// in your browser, TLS is working behind the scenes. The little padlock icon in your browser means TLS is protecting your data.
Performance Monitoring with uiperf3
iperf3 is a standard tool for measuring internet speed between two devices. For MicroPython, there is a smaller version called uiperf3.
uiperf3 uses a client-server model. One device runs as the server. Another device runs as the client and measures how fast data moves between them. This helps you understand the real networking speed of your Pico W.
It can test several different network protocols:
- User Datagram Protocol (UDP) — fast but does not guarantee delivery
- Transmission Control Protocol (TCP) — slower but guarantees delivery
- Streaming — measures how fast data flows in one direction
You can use uiperf3 to measure the total WiFi throughput your Pico W can achieve.
Installing uiperf3 with UPIP
1 2 | |
Make sure you are connected to WiFi first. See the UPIP lab for setup instructions.
Testing Client Performance
1 2 | |
Run iperf3 in server mode on a computer on the same network. Then run the above code on the Pico W to measure the speed of data moving from the Pico W to the server.
Keep Exploring!
You are now exploring topics that professional network engineers use every day. Secure connections and performance testing are real skills that matter in the industry. Keep going!