Breathing New Life Into a 1998 Lego Mindstorms Kit with a Raspberry Pi 5 and AI

With a little reverse engineering, e14 Presents' Andy West was able to turn this '90s Mindstorms Robotics kit into a trash-sorting bot.

The Lego kit

Released in 1998, Lego Mindstorms was meant to introduce children and teens to robotics through an easily approachable/familiar interface. The first product was the Robotics Invention System (RIS), which featured a large, yellow brick containing a microcontroller (called the Robotics Command eXplorer or RCX) and screen, as well as an assortment of motors and sensors that could be connected to the control module. The RCX contains a Renesas H8/300 8-bit MCU and features 32KB of both RAM and ROM for running simple programs.

After finding one of these original kits in unopened condition, Andy West from element14 Presents wanted to repurpose both the RCX and one of its sensors into a project fit for the modern age. His idea involved taking a Raspberry Pi 5 and camera, leveraging ChatGPT-4o to detect if an item is trash or recycling, and then instructing the RCX how to place the item into the correct category of trash or recycling.

Preparing the hardware

Unboxing the kit and assembling a simple project was simple, but West discovered one key issue: the rubber material used for the wire insulation had become brittle and flaky. He promptly opened the housing for the motor connector and light sensor before desoldering and replacing the degraded wires. From here, the RCX's IR tower was connected to a Raspberry Pi 5 over USB in addition to a Raspberry Pi Camera Module for capturing images of trash.

Wait, this is for Windows 95?

Given how the RCX was released in 1998, the software meant to control it only enjoyed solid support through Windows XP, leaving West's copy of Windows 11 unusable for the kit. However, thanks to the the Mindstorms community reverse engineering the RCX's firmware, projects such as Not Quite C (NQC) can be used to load new programs from modern devices. With the firmware now loaded, West created a custom graphical programming environment dubbed "Blockstorms" that exposes a Scratch-like interface for sending commands to the RCX. A person can then turn their drag-and-dropped blocks into a list of NQC CLI commands by running the Python code generation tool.

AI vision integration with ChatGPT-4o

On the software side of the project, West was able to add a ChatGPT-4o query block into his Blockstorms environment that sends a prompt to the service along with an image from the Raspberry Pi Camera Module. The instructions tell ChatGPT to focus on the item placed in the center of a conveyor belt and classify if it is trash or recycling in a single word. Depending on the response, the Raspberry Pi will send the "Motor A run" command with a specified direction for three seconds.

Sorting some trash

The entire setup took the form of three main components: the Raspberry Pi 5 + Camera Module, the RCX brick and its IR tower for communication with the Pi, and the belted platform that could move an item into the trash or recycling bin on either side. To see more about how West repurposed this 26 year-old kit into a more modern, AI-enabled trash sorter, you can watch his build log video here on YouTube.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles