This project is a Tangible User Interface (TUI) system designed to teach programming concepts by allowing users to control a robot with physical blocks. The system consists of Pico-W-based devices that read physical blocks, a central web server that manages communication, and the robots itself.
Important
This project is configured to work with a router with the SSID NaoBlocks and a server running on 192.168.0.201
To change these settings, the firmware would need to be edited as detailed in the respective README files.
The core of the system is a central web server that acts as a hub between the input devices (TUIs/picos) and the output devices (robots).
- TUIs: Each TUI is managed by a Pico W microcontroller. The Pico reads the arrangement of the blocks, translates them into a sequence of commands, and sends them to the web server via Wi-Fi.
- Web Server: A Next.js application that serves as the central communication hub. It registers Picos and robots, routes commands from a specific Pico to its assigned robot, and provides a web-based UI for monitoring and managing the entire system.
- Robots: The robots connect to the server to poll for new commands sent from their assigned Pico device.
This decoupled architecture allows for flexible pairing of Picos and robots and real-time monitoring of the system's status.
This repository is organised into two main parts: firmware and software.
physical-coding-blocks/
├── firmware/ # Firmware for the Pico W devices and robots
└── software/ # Next.js web server and management UIThe software/ directory contains the Next.js web server. It's built with TypeScript and uses Prisma with SQLite for database management. It provides API endpoints for devices and a real-time web interface for system monitoring.
Key Features:
- Real-time device status monitoring
- Device assignment and management
- Command queue inspection
- Responsive UI with dark/light mode
For detailed instructions on how to set up and run the web server, see the software/README.md.
The firmware/ directory contains the code for both the TUI devices (Pico W) and the robots.
- The TUI firmware is responsible for reading the physical block configurations and sending the corresponding commands to the server.
- The Robot firmware is responsible for connecting to the server, polling for commands, and executing them.
For detailed instructions on building and flashing the firmware, see the relevant READMEs inside the firmware/ directory.
Tip
To take full advantage of the configured workspace settings, modify the project using one of the following approaches:
- Open the
mono-workspace.code-workspacefile at the root of this repository, or - Open each directory in a seperate workspace, e.g.:
firmware/picow/pythonfirmware/mBot2/software/
To get the full system running, you will need to set up both the software and the firmware.
Note
Ensure a router with the SSID NaoBlocks is set up and the server is assigned the static IP address 192.168.0.201 in the router's DHCP address reservation settings
-
Clone the repository:
git clone https://github.com/LennyPK/physical-coding-blocks.git cd physical-coding-blocks -
Set up the Web Server:
- Navigate to the
software/directory and follow the instructions in itsREADME.mdfile.
- Navigate to the
-
Set up the Firmware:
- Navigate to the
firmware/directory and follow the instructions in itsREADME.mdfile to build and upload the firmware to the devices.
- Navigate to the