Installing the EXP6 library: SPIKE Prime (LEGO Education SPIKE App 3)
For teachers, students and first-time users: follow these steps in order to control the EXP6 with Python in the LEGO Education SPIKE App 3. You install the library only once; every Python project can then use it. Install it again after a hub firmware update.
Using LEGO MINDSTORMS Robot Inventor (51515)? See the Robot Inventor install guide.
What you need
- A SPIKE Prime hub (battery charged)
- A computer or tablet with the LEGO Education SPIKE App 3
- USB cable or Bluetooth, either works
- EXP6 firmware dated 2026-11-03 or later
- MBC_EXP6_Official_App_Lib.zip from this site, unzipped
Install steps
- Turn the hub on and connect it in the SPIKE App by USB or Bluetooth.
- Make a new project and choose Python.
- Open the unzipped
SPIKE_Education\Install_MBC_exp6_Lib.pyin a text editor, select all, copy, and paste it into the App's Python editor (delete what was there). - Press Run (▶) and open the console at the bottom of the App. When it says "安裝成功!(Installation Successful!)", you are done. You can delete this install project; the library stays on the hub.
Tip
Prefer not to copy and paste? Download install_exp6_lib.llsp3 and double-click it on your computer: it opens straight in the SPIKE App (or use File → Open in the App). Press ▶ once. It contains the same program as
Install_MBC_exp6_Lib.py.
Start programming
- Connect the EXP6 battery and plug the EXP6 Host cable into a hub port (for example port F).
- Make a new Python project and start it like this:
from hub import port
import time
from MBC_exp6_SPIKE_App_Lib import MBC_EXP6
exp = MBC_EXP6(port.F) # EXP6 on hub port F
exp.motor_run(1, 50) # motor on EXP6 port 1 at 50% speed
time.sleep(2)
exp.stop_all(1) # stop all motors at the end (on Education they do not stop by themselves)- Press Run. You can also open the 10 examples in the
examplesfolder of the download pack (EXP6 in port F).
Note
The App's editor puts a red underline under
MBC_exp6_SPIKE_App_Lib. Ignore it: the App's syntax check does not know about libraries installed on the hub, and the program still runs.
Try each function in your browser first: LEGO SPIKE App interactive tutorial; everything is explained in the official App guide.
Remove
To remove it: make a new Python project, paste SPIKE_Education\Uninstall_MBC_exp6_Lib.py from the download pack and run it until you see "Uninstall Successful!".
Troubleshooting
| What you see | What to do |
|---|---|
ImportError: no module named … |
Not installed, or a firmware update wiped it → install again |
| "讀不到擴充板資料" (cannot read the expander) | Check the EXP6 battery, and that the port in MBC_EXP6(port.X) is the one it is plugged into |
| The motors keep running after the program ends | Education has no watchdog → end your program with exp.stop_all(1) |
| The official App cannot connect to EXP6 | EXP6 has run a Pybricks program or been on a Robot Inventor hub → take the EXP6 battery out and put it back |
MemoryError |
The program is too big → split it, restart the hub and try again |
Still stuck? Contact us with a screenshot of the console messages.