198 Wio: Readying A Wio Terminal for IX systems (198.html)
Keywords
REPL minicom MicroPython SeeedStudio Asduino abcdef
"198 Wio: Readying A Wio Terminal for IX systems" K001-V26 M5Stack
ICH180RR AIP ArduPy "Wio Terminal" WioTerminal MicroPython "IX system" flash up2
(To enlarge .....Click it)
IX or DC (IX by DC) or "|><"
This prepIX.py software is a part of the IX family of software.
Introduction
When a Wio Terminal is received new from Seeed Studio, it is ready to be turned on and it will run. But its flash memory has
a volumen named Arduino with a demo game that runs when the Wio Terminal is powered up. It is possible to get into REPL mode by
starting up mimicom and then doing double click down of the on/off switch. We can then see the name of the volume. This article describges the steps that I use to prepare the Wio Terminal so that I can load microPython and my software onto the Wio Terminal. Another interesting similar product is the K001-V26, which unfortunately does not have a 40 pin GPIO interface. The 2x15 pin interface on the K001-V26is NOT compatible with the Raspberry Pi.
Exploring a New Wio Terminal
Click on the photo to enlarge it.
Wio Terminal Game
When a new Wio Terminal is turned on, the game above appears.
But I have been programming my Wio Terminal, so I connect it up to my RPi using the tiny USB cable that comes with it.
When I connect my Wio Terminal to a USB port on my RPi, using the USB-C cable that came with the Wio Terminal. I have already installed minicom on my RPi. After double-clicking the Wio Terminal into flashing mode on my RPi, I start up minicom on my RPi by going into a Terminal window.
I keep a text file named "minicom-o-D|dev|ttyACM0.txt" on my Desktop. I copy and paste that into the terminal window. Then I edit it to become:
minicom -o -D /dev/ttyACM0
I connect minicom to /dev/ttyACM0 because I know that on my RPi, when I plug the Wio Terminal (with its power off) to a USB port on the RPi, it will not yet be connected. But when I "power on" the Wio Terminal
it will automatically be connected to the "/dev/ttyACM0" port. So I "power off" the Wio Terminal, connect it to a USB port on the RPi, then I "power on" the Wio Terminal. In the Terminal window I see nothing.
But when I double-click the Wio Terminal on/off button downwards quickly (this is called "flashing it"), a new RPI window appears saying:
Removable medium is inserted
Type of medium: removable disk
Select the action that you want to perform:
Open in File Manager
Cancel OK
So I click on "OK". Now the RPi File Manager opens a new window that displays the contents of media/pi/Arduino containing 3 fiiles:
INFO_UF2.TXT
INDEX.HTM
CURRENT.UP2
This is what one should expect to see on a new Wio Terminal.
Watch what happens when I do the following:
I close the Terminal windows that are open.
I power off the Wio Terminal.
Then I power it on (but not double-clicking)
Then I open a Terminal window.
The I type the up arrow a few times until the "minicom" command appears which is
minicom -o -D /dev/ttyACM0
If it wasn't typed in previously, I type it in, instead.
Then I hit Enter to start minicom. The minicom program will see that the WioTerminal is connected to the USB port
The following reply from minicom should immediately appear:
Welcome to minicom 2.8
OPTIONS: I18N
Port /dev/ttyACM0, 02:37:18
Press CTRL-A Z for help on special keys.
minicom is now connected to the Wio Terminal but we need to turn on line-wrap.
To do this:
Then I hit Enter, then CTRL-A, then Z, then W to turn line-wrap on, then Enter to exit from the minicom Menu
The Wio Terminal should display its REPL prompt: which is:
>>>
This shows that communication has been established between the RPi Terminal window and the Wio Terminal.
Explore the REPL
Now, return to the RPi Terminal window where minicom was started (but displayed nothing).
Watch what happens when I power off the Wio Terminal.
Then I hit Enter, then CTRL-A, then Z, then W to turn line-wrap on, then Enter to exit from the minicom Menu
Then I power off the Wio Terminal and power it back on again.
Then I see ">>>" which is the REPL. Then the Wio Terminal tried to boot up
I . . .
Press any key to enter the REPL.
REPL will respond to any of the following commands
>>>Enter to redisplay the REPL prompt >>>
CTRL-B to see the MicroPython blurb
CTRL-D to soft reboot. and see the MicroPython blurb
import sys to import the sys modules
then
dir(sys) to display the sys classes
argv, . . . platform . . version, version_info etc
help(sys) lists ~20 commands
sys.version '3.4.0; MicroPython v1.20.0 on 2023-04-26'
import os to import the os modules
then
dir(os) to display the os classes
os.getcwd() displays '/'
help(os) lists the os functions (modules)
os.urandom(1) returns a random character
for s in os.ilistdir():
print(s) prints ('newDC', 16384 , 0, 0 )
#for end
import machine to import the machine modules
dir(machine) lists ADC etc
help(machine) lists obj & modules
import board ********** fails ************
import sys
help(sys)
----------
objext is of type module
__name__--sys
path -- ['','/','.frozen','/lib']
argv -- []
version -- 3.4.0'
version_info -- (3, 4, 0)
implementation -- (name='micropython', version=(1, 11, 0))
platform -- Afmel SAMD51
byteorder -- little
maxsize -- 2147483647
exit --
stdin --
stdout --
stderr --
modules -- {}
print_exception --
import os
help(os)
---------
objext is of type module
__name__ --uos
uname --
chdir --
getcwd --
ilistdir --
mkdir --
remove --
rmdir --
stat --
statvfs --
unlink --
sync --
sep -- /
mount --
umount --
VfsFat --
import machine
dir(machine)
--------------
[ '__name__,,
'ADC'.
'DCA',
'LCD',
'Map',
'PWM',
'Pin',
'Sprite',
'UART']
help(machine)
--------------
objext is of type module
__name__,, machine
Pin -- < class 'Pin'>
ADC -- < class 'ADC'>
DCA -- < class 'DCA'>
LCD -- < class 'LCD'>
Map -- < class 'Map'>
PWM -- < class 'PWM'>
UART -- < class 'UART'>
Sprite -- < class 'Sprite'>
Reboot the Wio Terminal
Currently I have a "bad" main.py program, so I get the following error messages:
Auto load main.py by saving files over USB to execute the ?? r enter REPL to disable.
main.py output
Traceback (most current call last):
File "main.py" line 8, in <module>
import error: cannot import SPI
Micropython e2f4a00-dirty on 2020-08-14; Ardupy with seeed
Type "help() for more information
>>>
The bottom line is the REPL prompt: >>>
When I type
>>>help()
it shows:
Welcome to MicroPython!
For online help please visit http://micropython.org/help/.
S E E E D S T U D I O
For further help on a specific object, type help(obj)
>>>
Reboot with a new main.py program
I have accepted the RPi offer to open the ARDUPY volume which is now in an open window where I see the /home/pi/ARDUPY/ folder.
I have already created a new main.py program on my Desktop. I rename the current main.py to another name such as "main_bad.py" Then I copy and paste (not drag and drop) the new main.py file and paste it onto the ARDUPY folder. I see that it appears in the ARDUPY folder. I am now ready to turn off/on the Wio Terminal. After doing this, the LCD is blank, the minicom Terminal window is blank and nothing immediately happens.
Now a new window opens up saying
Removable medium is inserted
. . .
open in file manager
with buttons Cancel & OK
'
I don't do anything right away
The Terminal Window finally says:
Press any key to enter the REPL, Use CTRL-D to soft reboot
Auto load main.py by saving files over USB to execute them or to use REPL to disable.
main.py output:
B:isInUse0: False
C in loop, monitoring button(s)
device is not yet "Wio Terminal", enter a char eg 'e' then Enter
Starting with "B:isInUse0:" etc, this is valid output from my new main.py program
This output in the Terminal Window gives me some output from my "new" main.py program.
I was expecting it to be printed on the LCD, but this is progress in the debugging of my main.py program.
My program was trying to discover whether it was running on a "Wio Terminal" or on an "RPi". It wrongly
concluded that it was still running on an RPi, so it asked for keyboard input, which is impossible on the
"Wio Terminal". I am trying to read the buttons on the Wio Terminal. When they are read, the main.py
program will "see" a character from each button as shown below:
! @ #
u
l e r
d
The top left row is/are the 3 buttons along the top edge of the Wio Terminal
The 5 lower right buttons represent the micro joyStock buttons.
If no button is touched on the Wio Terminal, the program should
receive an "n" meaning null. The only button that the main.py
program is expecting is the "e", which it will interpret as the
"Enter" key.
I unplugged everything and reran the above steps. This time, after seeing the output from my
main.py program on the Terminal window, I hit Enter on the keyboard of the RPi. What appeared
was the following output from my program:
E after return from anyButton, isInUse0: True
F. in main, after anyButton, saw:
C: In loop, monitoring buttons(s)
device is not yet "wio Terminal", enter a char eg "e" then Enter
This is what I saw when I was running the main.py program during
debugging on the RPi.
This means that the main.py program thinks that it is being run on the RPi, not on the Wio Terminal.
So, now what I need to do is to convince the main.py program to run on the Wio Terminal, not on the RPi.
I used a "try . . except . . . finally" sequence (trying "import board", hoping that it would be successful
when running on a Wio Terminal and not on a RPi. However now I know that I should "try" the
statement "import machine", which would be successful on the Wio Terminal but not on a RPi.
So I will reboot the RPi without the Wio Terminal, then connect the WioT to see what I get.
I now realize that the issue is that the LCD monitor part of the Wio Terminal is "broken".
ArduPy
I found one of my Wio Terminal devices (with and id: ":93" written on it)
I found a copy of "ArduPy_wio_terminal_lastest.uf2" on my RPi.
With it was a main.py containing only:
progName="IX_23E18.py"
print(progName)
Then I connected a cable from the RPi to the WioTerminal.
Then I double clicked (flashed) the Wio Terminal.
Then I accepted for the file manager to open the "Arduino" volume.
Then I used copy-n-paste to copy the "ArduPy_wio_terminal_lastest.uf2" onto the "Arduino" volume name
Then it automatically rebooted the Wio Terminal
Then I accepted for the file manager to open the "new" ARDUPY volume.
The file manager showed the "/media/pi/ARDUPY" volume to contain:
ArduPy_wio_terminal_lastest.uf2
INDEX.HTM
INFO_UF2.TXT
main.py (39 bytes)
I opened a new Terminal window
I started up minicom,
Then I hit CTRL-A Z, then W
and saw no prompt
Then I hit Enter
and saw the REPL prompt: >>>
Then I hit CTRL-D
and saw
Press any key to enter the REPL, Use CTRL-D to soft reboot
Auto load main.py by saving files over USB to execute them or to use REPL to disable.
>>>
Then I hit CTRL-D again
It again said
Press any key to enter the REPL, Use CTRL-D to soft reboot
Auto load main.py by saving files over USB to execute them or to use REPL to disable.
>>>
Then I hit CTRL-D again
It said
soft reboot
e()" for more information
enter REPL for more information
Then I hit CTRL-D again
It said
main.py output:
IX_23E18.py
Micropython e2f4a00-dirty on 2020-08-14; Ardupy with seeed
Type "hel
Then I restarted the reboot process again
I powered off the Wio Terminal
I closed the Terminal window
I opened the Terminal window
I started minicom
I powered on the Wio Terminal
It asked to open the File Manage
I said OK
The Terminal window said
Welcome to minicom 2.8
OPTIONS: I18N
Port /dev/ttyACM0, 02:37:18
Press CTRL-A Z for help on special keys.
I hit CTRL-A Z then W
It showed the menu and then erased it
I hit CTRL-D
It said
IX_23E18.py
Micropython e2f4a00-dirty on 2020-08-14; Ardupy with seeed
Type "help
I hit CTRL-D
it said
soft reboot
enter REPL to disable
main.py output:
IX_23E18.py
Micropython e2f4a00-dirty on 2020-08-14; Ardupy with seeed
Type "help
I hit CTRL-D
It said
soft reboot
enter REPL to disable
main.py output:
IX_23E18.py
Micropython e2f4a00-dirty on 2020-08-14; Ardupy with seeed
Type "help
Apparently, CTRL-D always initiates a soft reboot and then restarts the "main.py" program .
An easy way to tell if MicroPython is usable on a Wio Terminal (instead of CircuitPython) is
to go into the REPL mode, then type
import machine
dir(machine)
then hit CTRL-D numerous times
If dir (machine) lists some objects
and
CTRL-D eventually says
Micropython e2f4a00-dirty on 2020-08-14; Ardupy with seeed
Type "help
Then the Wio Terminal is running MicroPython and "machine" and "try,import machine" should be used
instead of "import board" in "test_waitbuttons_i.py" to test if it indeed is a Wio Terminal not an RPi that is running the code.
The "test_anyButton_i.py program incorrectly uses "import board" with MicroPython to test the buttons.
My current issue/question is: How do I run program: main.py under CircuitPython ?
Conclusion
Other Related Thoughts
For CAD$57.86 (in 2023), Mouser Electronics has a similar product to the Wio Terminal. The K001-V26 (Source 02) by M5Stack is said to have:
32-bit LX6 Microprocessor, 16M FLASH Memory, HD IPS Display Panel, Speaker.
BASIC ESP32 Development Kit
The M5Stack BASIC ESP32 Development Kit is a modular, stackable, scalable, and portable device that is powered with an ESP-32 core. The ESP-32 core makes it open source, low cost, full-function, and easy to handle new product development on all stages. This ESP32-based development board integrates with Wi-Fi and Bluetooth(r) modules contains a dual-core and 16MB of SPI Flash memory. The BASIC kit features extendable pins and holes, a TF card slot, and magnetic suction at the back. This kit operates at a 5V supply voltage and 0 C to 40 C temperature range. The BASIC kit is available in 54mm x 54mm x 18mm dimensions. Typical applications include stem education products, DIY creation, and smart home equipment.
It has a 2x15 female interface. It seems like it was perhaps the product that Seeed Studio used to design their Wio Terminal around (or viceversa). A schematic of this product is available in the pdf in Source 02. The K001-V26 might have been designed around 2019. The K001-V26 is said to support MicroPython.
Click on the photo to enlarge it.
K001-V26
Sources
Video Sources
Video Source V198:01:
Wio Terminal Classroom with Ardupy #5 | AIP Usage & Ardupy Libraries (25:07 min) By Lakshantha of Seeed Studio c2021DApr
Web Sources
Web Source S198:01:www
How to Install AIP
on Github before 2023EMay17
Web Source S198:02:www
K001-V26
by Mouser Electronics before 2023EMay22
WebMaster: Ye Old King Cole
There is a way to "google" any of the part-numbers, words and phrases in all my articles. This "google" search limits itself ONLY to my articles. Just go to the top of "ePC Articles by Old King Cole" and look for the "search" input box named "freefind".
Date Written: 2023 E May 18
Last Updated: 2023 J Oct 11
All rights reserved 2023 by (c) ICH180RR
saved in E:\E\2022\DevE\MyPagesE\Globat\ePhotoCaption.com\a\198\198.html
backed up to ePhotoCaption.com\a\198\198_2023EMay18.html
Font: Courier New 10 (monospaced)
/198.html