Put simply, you’ll need a LEGO hub, elements to build a robot, and a computer or tablet to create programs. This page helps you find everything you need. For each of these requirements, you’ll have several options to choose from.

Install the Pybricks firmware.
Sensor
Hub
Motor
LEGO elements
Device to make programs
Example of a LEGO robot with a device for coding. This picture shows a SPIKE Prime robot with an Android tablet, but you can use other hubs and smart devices, as you'll see below.

Tip: If you’ve worked with SPIKE Prime (45678) or MINDSTORMS (51515) before, you’ll have everything you need. Still, read on to get a good overview of the required components. You’ll find other more budget friendly options below too.

Choosing a device for programming

You can create programs on Windows 10 or 11, macOS, Linux, Android, or ChromeOS. You can use a PC, laptop or tablet. Phones work too, but they are often too small to be useful.

Almost all modern laptops and tablets have builtin Bluetooth support. If your device does not support Bluetooth or if it does not work well, you can buy a low cost USB Bluetooth dongle. If you use SPIKE Prime, SPIKE Essential, or MINDSTORMS Robot Inventor, you’ll also need a USB cable (microUSB) to install the Pybricks firmware.

You’ll also need a browser with Bluetooth support. We recommend using Google Chrome or Microsoft Edge. If you prefer open source tools, you can use Chromium.

Note that the Apple iPad and iPhone are not supported, because the iOS Safari browser and Chrome for iOS do not support Bluetooth connectivity. Similarly, Firefox does not support Bluetooth on any platform.

Choosing a LEGO hub

You can learn to code with Pybricks using any of the hubs shown below. Since many LEGO apps support just one kind of hub, that hub is usually just called “the hub”. This can be a bit confusing, so we’ll use the indicated names consistently throughout this user guide when required.

LEGO Powered Up Hubs.
City Hub
Technic Hub
Move Hub
Inventor Hub
Prime Hub
Essential Hub
These LEGO hubs can be used with Pybricks.

Because Pybricks makes the coding interface the same for all hubs, you can select a hub based on your budget and needs for your own project. The differences are outlined below.

You’ll use just two motors for most of the example projects in this introductory guide, so any hub will do.

  Prime hub* Inventor hub Essential hub Technic hub City Hub BOOST Move Hub
MicroPython coding
Block-based coding
Motor/sensor ports 6 2 4 2 2 ports + 2 builtin motors
Buttons 4 1 1 1 1
Battery Builtin Builtin 6 AA 6 AAA 6 AAA
Display 5x5 Lights
Speaker Beeps only
Color status light
Accelerometer
Gyro
Powered Up motors
Powered Up sensors
Powered Up Remote
Hub-to-hub communication
Xbox controller
Math with decimals or random numbers
Total storage** 256Kb 256Kb 16Kb 16Kb 4Kb
Total RAM*** 320Kb 320Kb 64Kb 32Kb 16Kb
User data storage 512b 512b 128b 128b 128b

(*) The SPIKE Prime Hub and MINDSTORMS Robot Inventor Hub are identical, except for the casing color and a device number to tell them apart. With Pybricks, they work the same. The official apps only connect to hubs with the correct color.

(**) The storage is also the maximum size of your program. Technically, the Prime Hub, Inventor Hub and Essential Hub have more storage space than this. This is not used by Pybricks, so that any files you had on it originally remain untouched.

(***) Working memory holds a copy of your program and system variables. The remainder is available for variables in your own code.

Choosing motors

Motors make your creations move. There are two types: motors that can measure their position and motors that can’t.

Motors that can measure their position are very suitable for robotics applications. You’ll need a pair of them to follow along with this guide.

These motors can measure their position, so you can choose exactly
           how many degrees they should turn. The hub adjusts the power to these
           motors to keep them running at a steady speed, even when you try to
           slow them down.
These motors can measure their position, so you can choose exactly how many degrees they should turn. The hub adjusts the power to these motors to keep them running at a steady speed, even when you try to slow them down.

Motors that can’t measure their position can still be useful in some cases due to their unique shape, such as the train engine.

If you’re a train builder, we recommend that you follow this guide with one of the motors shown above first, and resume building with your train motors when you’ve mastered the essential coding techniques. Most of it will still apply!

These simpler motors only run at the power level you choose. If you
           drive a train with many carriages for example, you'll need to pick
           a higher power level yourself to keep it going at the desired speed.
           You can't measure how far they turn exactly.
These simpler motors only run at the power level you choose. If you drive a train with many carriages for example, you'll need to pick a higher power level yourself to keep it going at the desired speed. You can't measure how far they turn exactly.

Choosing sensors

Sensors make your creation aware of its surroundings. Your robot can then respond to different measurements. For example, a vehicle could choose to turn around if it sees an obstacle.

Measuring distance is the simplest way to get familiar with sensors. To follow along with this guide, you can pick any of the sensors below that can measure relative distance (0% to 100%) or actual distance (mm).

We’ll also have a dedicated chapter for color measurement, calibration, and line following. You can skip it if you do not have any color sensors.

Device Measurement or function
Tilt Sensor (45305)
  • Pitch movement: ± °45
  • Roll movement: ± °45
Infrared Sensor (45304)
  • Relative distance: 0% to 100%
  • Reflected light intensity: 0% to 100%
Color and Distance Sensor (88007)
  • Relative distance: 0% to 100%
  • Surface color: Hue, saturation, value
  • Surface color: Customizable colors
  • Reflected light intensity: 0% to 100%
  • Ambient light intensity: 0% to 100%
  • Red, green, or blue lamp function
  • Act as Power Functions 1.0 remote
Color Sensor (45605)
  • Surface color: Hue, saturation, value
  • Surface color: Customizable colors
  • Reflected light intensity: 0% to 100%
  • Ambient light intensity: 0% to 100%
  • Three controllable white lights
Ultrasonic Sensor (45604)
  • Distance: 40mm to 1000mm
  • Four controllable white lights
Force Sensor (45606)
  • Force: 0.0N to 10.0N
  • Button movement in mm
  • Button presses

Technic building pieces

In this guide, you’ll build a small robot vehicle consisting of a hub, two motors, and a sensor. You’ll need a small amount of Technic pieces to put this all together.

If you have any SPIKE, Technic, or MINDSTORMS set, you should have more than enough pieces. You’ll find step by step instructions for a few suggested designs in the next chapter.

Lights (optional)

Lights can be used to decorate your design or indicate useful information about what your code is doing. Each hub also has a builtin light that can be used for this purpose.

Device Function
Light (88005)
  • Brightness from 0% to 100%
  • Both lights have the same brightness
Color Light Matrix (45608)
  • 9 lights, separately controllable
  • 9 different colors per light

Remote control (optional)

A remote can be a fun way to augment your autonomous creation. It also lets you conveniently test the mechanics of your design before diving into more elaborate programs.

With Pybricks you are not limited to predefined remote configurations. Instead, you can think of these remotes as wireless sensors. You can measure button presses or joystick position, and you decide what happens based on those inputs.

Device Measurement or function
LEGO Powered Up Remote (88010)
  • Button presses
  • Controllable color light
  • Works with all hubs
Xbox Controller
or
Xbox Elite Series 2 Controller
  • Button presses and joystick clicks
  • Analog joystick and trigger positions
  • Rumble function
  • Works with SPIKE Prime, SPIKE Essential, MINDSTORMS, and Technic