Wiznet makers

matthew

Published June 26, 2025 ©

84 UCC

9 WCC

30 VAR

0 Contests

0 Followers

0 Following

Real-Time WebSocket Tetris on WIZnet Pico — Fully Embedded HTML5 Game Server

Real-time Tetris server on WIZnet Pico using WebSocket and embedded HTML5. Just connect to the board's IP in a browser and start playing instantly!

COMPONENTS
PROJECT DESCRIPTION

🕹️ Introduction

This project brings a nostalgic game—Tetris—into embedded networking using WIZnet's Ethernet chip and RP2040. No need for Wi-Fi or internet—just plug an Ethernet cable into your PC and start playing Tetris directly in your web browser, powered by a fully embedded web server on the WIZnet Pico board.


🔌 How It Works

This project uses the WIZnet W6300-EVB-Pico2 board (or compatible WIZnet Pico boards) as a fully self-hosted web server. When you power the board and connect it directly to your PC via Ethernet, it serves a playable HTML+JavaScript Tetris game—no router, no internet, and no external software needed.

The embedded HTTP server handles requests and streams the game using WebSocket-style communication, updating the board in real-time via JSON.


🎮 How to Play

You can enjoy Tetris in just a few simple steps:

Connect via Ethernet: Plug the board directly into your PC using an Ethernet cable.

Access the Game: Open your browser and visit http://192.168.11.200.

Play Instantly: The Tetris game loads in your browser—play using your keyboard!

The embedded board hosts all files (HTML/JS) and handles live key inputs via WebSocket-like TCP communication.


🛠️ Hardware & Setup

Board: WIZnet W6300-EVB-Pico2 (or any WIZnet-supported RP2040 board)

Connection: Ethernet cable from board to PC (no router required)

Power: USB connection for power and serial debugging

No Internet or external server required


🧠 Firmware Overview

This project is built with:

Pico SDK

WIZnet ioLibrary Driver for W6300

Custom tetris_logic.c for game state and rendering

Embedded WebSocket-like handler for real-time browser input/output

Precompiled HTML/JavaScript included as C headers using xxd

The game responds to input like "left", "right", "rotate" via JSON over TCP, updating the game board in real time.


✨ Highlights

No internet required: Fully local browser experience

Built-in server: HTML, JS, and WebSocket-like handler all embedded

Plug-and-play: Just connect and open the browser

Playable from any modern browser

Optimized for WIZnet Pico C SDK: Seamless integration

 

✅ Results

With the firmware flashed and the board powered, Tetris loads instantly in your browser. You can play with arrow keys, and the game state updates in real time. The WebSocket-style implementation allows smooth gameplay without needing complex browser/server negotiation.


 🧾 Conclusion

This project is a fun yet powerful demonstration of how embedded devices like WIZnet’s Ethernet-enabled RP2040 boards can host real-time applications like games entirely from onboard memory—no internet, router, or external hardware. It's a proof of concept that embedded systems can be fun, interactive, and nostalgic.

You can build on this foundation to add scores, multiple pages, or even multiplayer in the future!

Documents
  • Tetris C/C++ Source

Comments Write