Here's an article on how to upload the UF2 project files for the LEGO EV3 brick via USB cable on Linux (Debian/Ubuntu):
Uploading UF2 Project Files for LEGO EV3 Brick via USB Cable on Linux (Debian/Ubuntu)
The LEGO EV3 brick supports the UF2 file system, which allows you to program the brick directly from your computer. In this article, we'll walk you through the process of uploading UF2 project files to your LEGO EV3 brick using a USB cable on Linux (Debian/Ubuntu).
Prerequisites
- A LEGO EV3 brick with a USB cable
- A Linux (Debian/Ubuntu) system
- A text editor (e.g., nano, vim)
- The
ev3devpackage installed (sudo apt-get install ev3dev)
Steps
-
Connect the EV3 Brick to your Linux system
Plug the USB cable into your Linux system and the LEGO EV3 brick. The system should automatically detect the device.
-
Identify the device
Run the following command to list all connected devices:
lsusbLook for a device with a vendor ID of
0x2380(LEGO Group) and a product ID of0x0613(EV3 Brick). Note down the device path, which will look something like/dev/ttyACM0. -
Format the EV3 Brick's storage
Before uploading the UF2 project files, you need to format the EV3 Brick's storage. Run the following command, replacing
/dev/ttyACM0with the device path you noted down:sudo ev3dev-dispatcher --reload sudo ev3devtool formatYou'll be asked to confirm the format operation. Type
yand press Enter. -
Create a new UF2 project file
Open your text editor and create a new file. Save it with a
.uf2extension. For example,my_project.uf2. -
Write the UF3 manifest
The UF2 file system requires a manifest file to describe the contents of the UF2 file. Here's an example manifest for a simple program:
MANIFEST.MF Manifest-Version: 1.0 Name: My Project Specification-Version: 1.0 Implementation-Version: 1.0 Magic: EV3Save this manifest in the same directory as your UF2 project file.
-
Create the UF2 file structure
The UF2 file system consists of a root directory and a
prgdirectory. Theprgdirectory contains the actual program files.my_project.uf2/ ├── MANIFEST.MF └── prg/ └── your_program.ev3Replace
your_program.ev3with the name of your EV3 program file. -
Compile your EV3 program
If you haven't already, compile your EV3 program using the EV3 Software (LEGO Mindstorms EV3 Education) on your computer. Save the compiled program file in the
prgdirectory of your UF2 project file. -
Upload the UF2 project file
Use the
ddcommand to write the UF2 project file to the EV3 Brick's storage:sudo dd if=my_project.uf2 of=/dev/ttyACM0 bs=64K conv=fsyncReplace
my_project.uf2with the name of your UF2 project file. -
Run the program on the EV3 Brick
Disconnect the EV3 Brick from your Linux system and run the program on the brick.
Summary
- Install the
ev3devpackage on your Linux system. - Connect the EV3 Brick to your Linux system via USB cable.
- Identify the device and format its storage.
- Create a new UF2 project file, write the UF2 manifest, and create the UF2 file structure.
- Compile your EV3 program and save the compiled program file in the
prgdirectory of your UF2 project file. - Upload the UF2 project file to the EV3 Brick's storage.
- Run the program on the EV3 Brick.
References