Introduction of MaixPy-v1

The new version of MaixPy (v4) is now live, with full Python3 support, and more powerful features, see: wiki.sipeed.com/maixpy
New hardware product MaixCAM, major performance upgrade, see: https://wiki.sipeed.com/maixcam

The Maix-I K210 series is being phased out; if you are planning to purchase a K210, please choose the MaixCAM immediately;
K210 users are also encouraged to upgrade to MaixCAM

In this document (under the path https://wiki.sipeed.com/soft/maixpy/en/), all references to MaixPy specifically refer to MaixPy-v1.



maixpy ​​logo
sipeed logo micropython logo
Site navigation Address
MaixPy-v1 official document website Official website: wiki.sipeed.com
Chinese site: cn.maixpy.sipeed.com
English site: en.maixpy.sipeed.com
MaixPy-v1 demo repository github: github/maixpy_script
Domestic:gitee/maixpy_scripts
MaixPy-v1 source code github: MaixPy-v1
Hardware data download dl.sipeed.com
Sipeed WIKI wiki.sipeed. com

About MaixPy-v1

MaixPy is to port Micropython to K210 (a 64-bit dual-core RISC-V CPU with hardware FPU, convolution accelerator, FFT, Sha256) is a project that supports the normal operation of the MCU and integrates hardware acceleration. AI machine vision and microphone array, 1TOPS computing power core module is less than ¥50, in order to quickly develop intelligent applications in the field of AIOT with extremely low cost and practical size.

MicroPython is a parser based on the grammar of Python3. It contains most of the basic grammar of Python3. It mainly runs on embedded chips with limited performance and memory. (Note that Micropython does not include all the syntax of Python3)

MaixPy makes programming on K210 easier and faster. We also open source the source code on github

There are many interesting things you can do with MaixPy. Specifically, you can look here

Concise code example

For example, if we need to scan the devices on the I2C bus, there is no need for complicated development environment and engineering, just send the following code through the serial port to achieve:

from machine import I2C # Import built-in library

i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29) # Define an I2C object, use I2C0, frequency 100kHz, SCL pin is IO28, SDA pin is IO29
devices = i2c.scan() # call function to scan device
print(devices) # print device

Similarly, we need to implement a breathing light, just the following code:

board_info is related to the board, and different board configurations are different. Manual configuration is required before use.

from machine import Timer,PWM
from board import board_info
import time

tim = Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PWM)
ch = PWM(tim, freq=500000, duty=50, pin=board_info.LED_G)
duty=0
dir = True
while True:
    if dir:
        duty += 10
    else:
        duty -= 10
    if duty>100:
        duty = 100
        dir = False
    elif duty<0:
        duty = 0
        dir = True
    time.sleep(0.05)
    ch.duty(duty)

Real-time photos:

import sensor
import image
import lcd

lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
while True:
    img=sensor.snapshot()
    lcd.display(img)

AI Object Detection:

import KPU as kpu
import sensor

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((224, 224))

model = kpu.load("/sd/mobilenet.kmodel") # load model
while(True):
    img = sensor.snapshot() # take picture by camera
    out = kpu.forward(task, img)[:] # inference, get one-hot output
    print(max(out)) # print max probability object ID

please read doc before run it!

The content of this document

All about MaixPy, including:

  • How to choose and get a suitable module or development board
  • How to get started
  • Library and interface (API) document query
  • Detailed step-by-step tutorial
  • Sharing from the community (tutorial or open source project)

In order to avoid encountering difficult problems during the learning process, please read from top to bottom according to the directory structure on the left, especially the chapters written in the front, do not skip

Can run MaixPy development board

First of all, we need to choose a development board that suits us. For the MaixPy model of each model, please click: Development board and accessories purchase guide, and there are also hardware parameters and corresponding development boards in the catalog. data

To get these boards, you can visit the official website of Sipeed www.sipeed.com, or official Taobao shop

MaixPy source code

MaixPy source code refers to the Micropython parser running on K210, written in C language, source code is hosted on github, if you just want to use MaixPy, you don't need to know the source code, but you can also give MaixPy project a star here;

If you want to participate in the development of MaixPy’s built-in functions, you can download for development, and welcome everyone to submit a PR

This project is mainly maintained by ©Sipeed Co.,Ltd., and accepts contributions from the open source community, For specific contributions, see Contributor List

Feedback

For questions about this document or function or source code, you are also welcome to submit an issue:

communicate with

If you have any questions, try to submit issue to the feedback address above, so that you can leave a record. Others can also check it. Before submitting, search to see if anyone has raised the same issue.

The following communication methods provide assistance:

Communication method Address
issue(recommend) https://github.com/sipeed/MaixPy-v1issues
BBS https://bbs.sipeed.com
MaixPy AI QQ group 862340358
telgram https://t.me/sipeed
E-mail (commercial cooperation)  email