Skip to content

1.1 LEGO Mindstorms Setup

yelu728 edited this page Jan 23, 2021 · 8 revisions

(Optional) Remove Bluetooth widget icon in Raspberry Pi OS

When you connect a Lego Hub to the Raspberry Pi, you are essentially performing a Bluetooth pairing. By default, the Bluetooth widget in the Raspberry Pi OS will pop up a window to ask the user to confirm this pairing. However, we have already simplified the CAIT pairing process and requires no user confirmation. The pop-up window, therefore, becomes useless. We suggest users who are using the Raspberry Pi with a monitor to remove the Bluetooth widget from the Desktop to avoid this pop-up dialogue. The steps listed below show you how to do this.

  1. In the Desktop's upper right corner, right-click on the Bluetooth icon.
  1. Select Remove "Bluetooth" From Panel.
  1. The Bluetooth widget is now removed. You will not see a pop-up window again when connecting a Lego hub to the Raspberry Pi.

1. LEGO Mindstorms EV3 Setup

To control the EV3 motors with the EV3 hub, you will need to download and use the ev3dev image from here: https://www.ev3dev.org/docs/getting-started/. Insert the MicroSD card into the EV3 hub, as shown below.

Once the EV3 hub is up and running, select Wireless and Networks from the menu.

Then select Bluetooth.

In the Bluetooth menu, make sure the Powered option is checked.

Then select Start Scan.

Scroll down to the device list below. Select your Raspberry Pi's hostname when it appears on this list. For example, My Raspberry Pi's hostname is caitv1, so I will select caitv1 from this list.

Then select pair from the pop-up menu and click accept.

Once paired, the device menu will have a set of new options. Select Network Connection.

In the Network Connection menu, select Connect.

Once connected, you should see a screen like the one below.

Next, on your RPi, please follow the screencast below to setup the RPyC service on EV3 hub.

In this setup, the Raspberry Pi 4B controls the EV3 hub using a Bluetooth connection. After the hub is connected to the RPi, you will be able to initialize the EV3 hub in CAIT's visual programming interface. You are now ready to write programs to control the EV3 motors attached to the hub. We recommend an external power HAT such as the PiJuice HAT for better portability. Alternatively, you may connect an off-the-shelf battery bank to the Raspberry Pi's USB-C port to provide power.

2. LEGO Mindstorms Robot Inventor Kit Setup

Before proceeding, make sure you have first set up the Robot Inventor/Spike Prime Hub by following the instructions from the LEGO Inventor mobile app.

Most importantly, make sure you updated the hub's firmware and motors to the latest version using the official LEGO Mindstorms App.

Once the hub is updated correctly, you can connect the hub to a Raspberry Pi 4B using Bluetooth. Press the Bluetooth button on the Robot Inventor Hub. You will see this hub with its MAC address in CAIT's Visual Programming Interface. Once the hub is added into the Initialize Control block, CAIT will take care of the connection and control. Like in the EV3 setup, you can use either a Raspberry Pi Power HAT or a battery bank for power.

Now you are ready to control your Mindstorms robots through CAIT's Visual Programming Interface, read more about how to do this in here.