Getting Started Guide for Maixpy

Driver Installation

Connect the device to your PC and open Device Manager to install the FTDI driver . Using Windows 10 as an example, download the driver file that matches your operating system and unzip it. Install the driver through Device Manager. (Note: In some system environments, you may need to install the driver twice for it to take effect. Unrecognized devices typically appear as M5Stack or USB Serial. Windows recommends installing the driver file directly through Device Manager (Custom Update) for proper functionality, as the executable installation method may not work correctly). Click here to download the FTDI driver

For MacOS users, before installation, please check System Preferences -> Security & Privacy -> General -> Allow apps downloaded from -> App Store and identified developers.

EasyLoader

Click to download EasyLoader

  1. EasyLoader is a simple and fast program burner. Each product page in EasyLoader provides a case program related to the product. For users who do not need to customize firmware or perform other operations, using EasyLoader to burn firmware for UnitV will be the simplest solution. (Currently, EasyLoader is only available for the Windows operating system).
  1. After downloading the software, double-click to run the application. Connect the M5 device to the computer via a data cable, select the port parameters, and click "Burn" to start burning.

Firmware Burning

Users who need to specify the burning file can also use Kflash for firmware burning.

Click to download firmware file

  1. Click on the corresponding Kflash_GUI burning tool for your operating system below to download.
Software Version Download Link
Kflash_GUI_Windows Download
Kflash_GUI_MacOS Download
Kflash_GUI_Linux Download
  1. Connect the device to the computer via the Type-C data cable. Double-click to open the Kflash_GUI application, select the corresponding device port, development board type (M5StickV), firmware program, and baud rate. Click download to start burning.

Kflash

  1. For users accustomed to using command-line operations, you can also choose Kflash as the firmware burning tool. Click here for details

Serial Debugging Tool

  1. Programming UnitV requires the use of a serial debugging tool. You can use Putty as a serial debugging tool. Click here to access the Putty resource page, choose the appropriate Putty for your operating system, and download and install it.
  1. After running Putty, connect UnitV to the computer port via the Type-C data cable. Set the corresponding port number and baud rate in Putty, click "open" to start the connection. (You can find the port number used by UnitV by viewing Device Manager)

Once connected successfully, you will automatically enter the MaixPy interactive interface. At this point, the device is running the default program. You can interrupt its operation by pressing the shortcut key "Ctrl+C" and enter the command line.

Editing and Running Files

Editing Files

In the Read-Eval-Print Loop (REPL), we can easily input programs and immediately get running results. However, this is only suitable for verifying short programs. In actual projects, the large code volume necessitates editing the code into individual files.

In MaixPy, there is a built-in open-source editor called Micropython Editor(pye) , which allows us to conveniently modify program files.

Use os.listdir() to view the files in the current directory,

Use pye("hello.py") to create a file and enter editing mode (if a file with the same name exists, it will only enter editing mode). Shortcut key usage instructions can be found here

After editing in the editor, press Ctrl+S > Enter to save, and press Ctrl+Q to exit editing.

Note: This editor has certain requirements for the serial tool used. The BackSpace key must be set to DEL functionality; otherwise, pressing BackSpace will call the same function as Ctrl+H (i.e., character replacement).

Running Files

Use os.chdir() to switch the current directory to the directory of the file, for example os.chdir("/flash")

Method One: import

Then execute import hello

You will see the output hello maixpy

This method is simple and easy to use, but it should be noted that currently import can only be used once. If import is used again, the file will not be executed. If multiple executions are required, it is recommended to use the following method.

Method Two: exec()

Use the exec() function to execute

with open("hello.py") as f:
    exec(f.read())

Running Scripts Automatically at Boot

The system will create a boot.py file in the /flash or /sd directory, and this script will be executed automatically at boot. Edit the contents of this script to achieve auto-startup.

MaixPy IDE

Downloading MaixPy IDE

MaixPy IDE enables convenient real-time editing, uploading, execution of script programs, as well as real-time monitoring of camera images, file transfer, and other functions. Using MaixPy IDE may result in some performance degradation due to data compression and transmission, but it is a very good development tool for developers with not very demanding performance requirements or in the debugging phase.

MaixPy IDE

Installing MaixPy IDE

For Windows platforms, double-click the exe file to run the installation program.

For Linux, give executable permission via the command line, then execute the command

chmod +x maixpy-ide-linux-x86_64-0.2.2.run

./maixpy-ide-linux-x86_64-0.2.2.run

Using MaixPy IDE

Run MaixPy IDE, click the toolbar, select the model of the development board. Tool-> Select Board-> M5StickV (Tools->Select Development Board)

Click the connection button at the bottom left, and select the correct connection port, then click OK.

When the connection button changes from green to red, it means the connection is successful. You can edit code in the editing box at the top and click the run button at the bottom left to execute the code for verification.

WS2812

The firmware has a built-in WS2812 RGB LED driver library. Below is a reference example. Note: Because UnitV's expansion ports do not have driving load capability, this program is only suitable for driving built-in RGB LEDs:

from modules import ws2812
from fpioa_manager import *
fm.register(8)
class_ws2812 = ws2812(8,100)
r=0
dir = True
while True:
    if dir:
        r += 5
    else:
        r -= 5
    if r>=255:
        r = 255
        dir = False
    elif r<0:
        r = 0
        dir = True
    for i in range(100):
        a = class_ws2812.set_led(i,(0,0,r))
    a=class_ws2812.display()

Library

In the library documentation, you can find more APIs to help you build various applications.

Maixpy docs

Github

On This Page