In this episode, Andy West takes us on a journey to modernize a classic LEGO Mindstorms kit from 1998 using the latest Raspberry Pi 5. Follow along as Andy transforms this vintage toy into an AI-powered trash sorting robot. Let’s dive into the project!
Watch the Video:
Downloads and Links | Bill of Material | Discussion
What do we Have Here?
Andy kicks off the episode with the discovery of a never-used LEGO Mindstorms Robotics kit from the late '90s. Originally designed for Windows 95 and requiring a serial port for programming, this kit seemed destined for obsolescence. However, Andy sees its potential as a perfect STEM-related project for his kids. If only he can bring it up to date!
Modernizing the LEGO Mindstorms Kit
The first step in this modernization project involves connecting the infra-red tower from the kit to a Raspberry Pi, which supports USB to serial communication right out of the box. Andy replaces the outdated software with a web-based graphical programming interface, enabling real-time robot control. Further enhancement will include a camera to use with image-identification machine learning / artificial intelligence or some other vision API and then build a robot out of the LEGO parts.
Hardware Challenges and Solutions
Upon examining the kit, Andy finds the wires for the motors and sensors in poor condition, with insulation disintegrating. He replaces the cables and carefully cleans the components to ensure everything is in working order. Andy then tests the restored components with the original programmable brick, confirming their functionality.
Programming with Raspberry Pi
Instead of the original Windows 95 software, Andy uses a Raspberry Pi with a USB to serial adapter. He installs the operating system on the Raspberry Pi and sets up NQC (Not Quite C), a C-like language for programming the Mindstorms computer. With the firmware uploaded successfully, it’s time to create a modern programming environment.
Creating a Web-Based Programming Interface
Andy uses Google's Blockly library to build a web-based graphical programming environment like Scratch, aimed at making coding accessible for kids. This custom application, named “Block Storms”, allows users to drag and drop blocks to create Python code for controlling the LEGO motors and sensors.
Adding AI Capabilities
To add intelligence to the robot, Andy connects a Pi camera to the Raspberry Pi and integrates it with GPT-4 or another vision API. This setup enables the robot to capture images and classify them as trash or recycling using AI.
Building the Trash Sorting Robot
Andy combines LEGO parts and 3D-printed components to build the trash sorting robot. He uses a touch sensor as a button to activate the camera, which takes a picture and sends it to GPT-4 for classification. The robot then sorts the item into the correct bin based on the AI’s response.
After several successful tests, Andy’s trash sorting robot proves to be an effective and educational project. Have you ever revived an old toy or device with modern electronics? Share your experiences in the comments below.
Downloads and Links:
- Download Code and CAD Files!
- NQC (Not Quite C): https://bricxcc.sourceforge.net/nqc
- Google’s Blockly: https://developers.google.com/blockly
- Github Repo: https://github.com/andy-west/lego-ai-robot
Bill of Material:
Product Name | Manufacturer | Quantity | Buy Kit |
---|---|---|---|
RASPBERRY-PI RPI5-4GB-SINGLE | RASPBERRY-PI | 1 | Buy Now |
Additional Parts:
Flexible, 24-gauge 2-pin silicone ribbon cable, stranded tinned copper wire |
LEGO Mindstorms Robotics Kit |