element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Project Videos
  • Challenges & Projects
  • element14 presents
  • Project Videos
  • More
  • Cancel
Project Videos
Documents How to Control a LEGO Mindstorms kit with AI and Raspberry Pi 5 -- Episode 657
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Project Videos to participate - click to join for free!
Related
Recommended
Engagement
  • Author Author: tariq.ahmad
  • Date Created: 27 Jun 2024 12:20 PM Date Created
  • Last Updated Last Updated: 27 Jun 2024 3:09 PM
  • Views 2928 views
  • Likes 6 likes
  • Comments 1 comment

How to Control a LEGO Mindstorms kit with AI and Raspberry Pi 5 -- Episode 657

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:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

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! 

image

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. 

image

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. 

image

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. 

image

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. 

image

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

element14 presents

element14 presents  |  About Andy West |  Project Videos 

  • python programming
  • Blockly programming
  • Educational robotics
  • raspberry pi 5
  • USB to serial adapter
  • AI vision API
  • e14p_AW
  • raspberry pi projects
  • Pi camera module
  • AI Robot
  • Machine learning robotics
  • stem education
  • Vintage tech revival
  • Trash sorting robot
  • diy electronics
  • friday_release
  • LEGO Mindstorms
  • Share
  • History
  • More
  • Cancel
Actions
  • Share
  • More
  • Cancel
  • Sign in to reply
  • DAB
    DAB over 1 year ago

    Nice episode on creating treasure from trash.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube