[DigiKey "Smart Manufacturing, Non-stop Happiness" Creative Competition] Establishment of M5Paper Development Environment
[Copy link]
This post was last edited by HonestQiao on 2023-10-27 00:12
The main control chip of M5Paper is ESP32-D0WDQ6-V3. Thanks to the improvement of ESP32 ecological environment, multiple development environments can be used, including Arduino, platformio, micropython, circuitpython, and UI Flow provided by M5 Stack. Among the above development environments, Arduino and UI Flow are more fully supported.
1. UI FLow development environment
UI Flow is a low-code visual development tool similar to Scratch that M5 Stack provides specifically for its own products. You can access it directly using a browser:
To use this Ui Flow, you need to first use the official m5burn burning tool to burn the corresponding firmware:
Then follow the interface steps and select the corresponding serial port:
After burning, start the board and it will enter the UI FLow interface by default. The default interface is as follows:
At this time, toggle the pull-wheel switch or press the button of the pull-wheel switch, it will automatically restart and enter the UI Flow remote development interface:
The APIKEY in the above interface needs to be filled in the settings of the UI Flow development interface to associate the two:
Once linked, you can use online development tools for development.
The part of UI Flow on the development board is based on MicroPython, so MicroPython is actually running on the development board.
Unfortunately, UI Flow has developed to version 2.0, but M5Paper only supports version 1.0 and runs micropython version 1.12.
UI Flow 2.0 has been updated to micropython 1.20, keeping up with the mainstream version of micropython.
The UI Flow development tool is relatively easy to use. You can build and run processes by dragging and dropping. It is very friendly to children. I will not explain it in detail here. Students who are interested can read the official UI Flow usage guide.
2. MicroPython Development Environment
Since the UI Flow board is running micropython, you can directly use micropython for development.
The UI Flow development tool also provides a Python development interface:
But it would be much more convenient if you could use local development tools connected to the MicroPython running on the board.
In the UI Flow interface, press the key to enter the mode selection:
In the above interface, if you select USB Mode, you can use vscode to install the M5 Stack plug-in for development.
If you want to use the general MicroPython tool for development, it is more appropriate to choose APP Mode.
After selecting APP Mode, return to the main interface and restart, then use Thonny to connect:
In order to automatically enter APP Mode every time the commuter car restarts, you can open the boot.py file on the development board and add the following code:
After saving, you don't need to reset it every time you restart.
Then, open main.py, write your own code, and run it:
After running, the Thonny Shell window output is as follows:
M5Paper will also refresh the display:
3. CircuitPython Development Environment
The m5burn tool also provides circuitpython firmware for M5Paper, as follows:
After burning, use Thonny to connect:
However, this circuitpython firmware does not provide the relevant M5 Stack support package, so you need to find the corresponding Lib yourself.
Arduino Development Environment
M5 Stack provides a dedicated support package for Arduino. By enabling it in the Arduino IDE, you can see many examples.
The configuration URL of the support package is: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
After installation, select M5Paper from the development board:
If you do not download a dedicated support package, you can use the ESP32 support package to provide support. Although there is no direct M5Papr development board, you can also choose M5Stack-Fire:
In addition, you also need to install M5PED and M5GFX to provide support for the screen:
After installation, you can open the HelloWorld instance of M5EPD and run it to see the effect:
Please refer to the following for modification:
After compiling and downloading, M5Paper displays Hello World:
5. Platformio development environment
First, use git to clone:
Then open it with vscode. If platformio is not installed, install the extension and then open it. After opening, the required support packages will be automatically installed.
On the icon in the toolbar at the bottom, click Build and Upload:
After compiling and burning, you will enter the factory test interface:
Looking at the files of the project, you can see that it only depends on M5EPD:
For other peripheral drivers, refer to Using platformio to Develop Common ESP32 Projects.
VI. Conclusion
Through the above development environment, especially Arduino and Ui Flow, you can quickly start the development of M5Paper and make good use of its various functions.
It is recommended to understand UI Flow first. After all, it provides complete support for various functions of compatible devices and can be called up very conveniently.
On this basis, you can use other development environments to conduct research in comparison to avoid getting into a dead end.
|