216 Wio: Peripheral Devices on the Wio Terminal for IX systems (216.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.
This article (216.html) began as an extension to Article 198. Because the Wio Terminal contains so many peripheral devices, the author
would like to explore how these devices can be made available to any Raspberry Pi, by simply plugging the Wio Terminal directly into the
40 GPIO pins on any Raspberry Pi. The author realizes that this was not the goal when the Wio Terminal was developed. Apparently the
goal was to create the Wio Terminal as a replacement for a RPi using the microprocessor already built into the Wio Terminal. Then any HAT
designed for the Pi could be controlled by the Wio Terminal. The author wishes to explore using the Wio Terminal as a HAT for any Raspberry Pi. My
previous exploratory work on the Wio Terminal was based on MicroPython code. Two people, lakthanshad and scruss pioneered such an
initiative. Sadly both of them seem to be no longer in the picture. Therefore the author will turn his attention to using Circuit Python, in order
to make use of the large amount of code developed by SeeedStudio and many programmers.
Wio Terminal ToolBox Peripherals for the RPi
The author believes that the Wio Terminal might easily provide a Raspberry Pi with all of the hardware capabilities listed below, a veritable toolbox of additional peripherals. In the first column, the author has rated (10=best) each potential peripheral for this toolbox.
Rate Cnt peripheral
---- --- ----------
9 1 tiny screen: as an output device
5 as a tiny RPi GUI screen
10 3 push-buttons
5 1 tiny joystick
1 1 programmable (blue) led [on the bottom edge :( ]
4 1 audible buzzer (a very poor speaker)
9 1 microphone
2 1 I/R transmitter (sadly on the back)
2 1 I/R receiver (sadly on the back)
6 1 light sensor (the I/R receiver)
10 1 a "second" Real Time Counter
10 1 IMU 3-axis accelerometer (LIS3DHTR)
? 1 WiFi channel (future due to software issues)
? 1 BlueTooth channel (future due to software issues)
8 1 UART (pins GPIO14 and GPIO15 on the Pi)
8 1 software-driven Low Speed "UART"
6 1 software-driven Low Speed simulated digital scope
3 1 software-driven Low Speed simulated analog oscilloscope
10 1 Unique 128 Serial Number
10 2 Grove Connectors
Grove A: PA16,PA17)
Grove B: PB8, Pb9 )
5 1 USB port
9 1 uSD connector: for data storage
4 for code storage
0 1 MCU: micro-processor
7 signal generator
10 1 power supply for the RPi (via the Wio Battery Pack)
8 N more Grove Connectors (via the Wio Battery Pack)
Sadly, there is no audio jack on the Wio Terminal, although one could be connected into a Grove Connector. This could
replace the audio jack that was not designed into the Raspberry Pi 5B. The number of LEDs on the Wio Terminal is limited,
but LED icons could be displayed along the top of the LCD display of the Wio Terminal instead, perhaps aligned with the 3 top buttons.
The MCU is rated very low as a micro-processor because it will be primarily operated in stand-alone mode to tun the necessary code
to provide the "client" services linking each "Wio Terminal" peripheral to the Raspberry Pi. The author has not yet concluded
which communicattions "channel" should be used to handle the RMC (Remote Procedure Calls) from the Raspberry Pi. The first easy choice
would be the USB port on the Wio Terminal, but if another "channel" were to be used, the Wio Termianl's USB port would be available as an additional
USB port "peripheral" for the Raspberry. The "new" non-GPIO UART (J6) on the Raspberry Pi 5B could be such a channel but it would
probably require a dedicated Grove connector. Using GPIO14 and GPIO15 is another alternative RMC channel to use, although it would no
longer be available as a UART for the Raspberry Pi. The author is leaning towards using the main USB port on the Wio Terminal as the RMC channel.
The communications "protocol" to use for the RMC channel between the Raspberry Pi and the Wio Terminal Toolbox "peripherals" has yet to be decided, but
the (as yet undeveloped) ixmRMC (Article 195) is being considered. The ideal protocol would be to emulate an existing RPi software library for similar
peripherals. This could be done in a fashion similar to the partially developed RPi5GPIO library (Article 213). If it were named the RPiWGPIO library, these Wio Terminal ToolBox peripherals would only require a 1 character software conversion. Such a library might add a second life to the Wio Terminal product sales. Perhaps emulation of the gpiozero (Source 03) library (named gpiozeroWioToolBox) would be a better goal, albeit more agressive.
An uptodate guide to the Wio Terminal can be found at Source 04.
Source 05 is a short program that determines whether it is running on a Raspberry Pi or on a Wio Terminal. If it is on a Wio Terminal,
the program determines whether it is running under MicroPython or CircuitPython. Using this same software algorithm, a function will be
created to return a phrase stating on which device/OS it is running.
Wio Terminal Pin Out Overview by Seeed Studio
Click on the photo to enlarge it.
Wio Terminal Pin Out Overview by Seeed c2023CMar22
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 name 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
The K001-V26 (Source 02) by M5Stack
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
Other Related Thoughts
In Source 07, Julian Horsey shows how to install AI on a Raspberry Pi 5. Running AI on a RPi 5 ensures privacy. Using a Coral USB accelerator adds an Edge TPU coprocessor to your system for just US$ 60. But such a solution has limitations with larger language models. Have a look at the video in the article!
The webmaster has just become aware of a good tutorial for new users of the Raspberry Pi computer. Source 08 by Tutorials Point will take you there.
In Source 09 Les Pounder describes the new Pi Moroni dual NVMe SSD board costing US$30.00 . This board attaches to the bottom of the Raspberry Pi 5. There is a catch, though. The catch is that it is impossible to boot from the drives on this board.
In PCWorld (Source 10) Michael Kofler has provided a recent review of the Raspberry Pi 5B including a number of benchmark results. His benchmarks compare the RPi 5 to the RPi 4 with various cooling configurations. Cooling is an important consideration for the RPi 5B models. He describes the Wayland issues for the RPi 5. He notes that the version 6 NAS program OMV is incomptible with the RPi 5. He says that Version 7 NAS will probably fix the problem.
Source 11 is a detailed review of the Raspberry Pi 5B at Wagner's Tech Talk. Video Source 01 takes you to the last 2 minutes of a video by Wagner. It describes a stress test for the Rpi 5B. During this stress test, Wagner was running the RPi 5B in the Raspberry Case including a cooling fan. The review's impressive Table of Contents is shown below:
Click on the photo to enlarge it.
WagnersTechTalk2024C.jpg
Source 12 describes 6 new Pineberry Pi boards just recently announced. These include dual NVMe, AI and 2.5G Ethernet.
Sources
Video Sources
Video Source V216:01:
Raspberry Pi 5 Setup: Getting Started Guide (Step By Step) (2:00 min) By Jon Wagner of Wagners Tech Talk c2023LDec01
Web Sources
Web Source S216:01: www
How to Install AIP
on Github before 2023EMay17
Web Source S216:02: www
K001-V26
by Mouser Electronics before 2023EMay22
Web Source S216:03: www
gpiozero documentation (from github)
by Ben Nuttall and Dave Jones c2021
Web Source S216:04: www
Wio Terminal Guide (from github)
by SeeedStudios before 2024
Web Source S216:05: www
test_device_i.py (.txt)
by D@CC on 2024CMar02
Web Source S216:06: www
Watch.Spectrum.Net
by D@CC on 2024CMar03
Web Source S216:07: www
How to install AI on a Raspberry Pi 5
by Julian Horsey on 2024CMar03
Web Source S216:08: www
RPi tutorialspoint
by Tutorials Point c 2021
Web Source S216:09: www
RPi 5 dual NVMe SSD board
by Les Pounder on 2024CMar06
Web Source S216:10: www
RPi 5: A huge upgrade
by Michael Kofler at PCWorld on 2024BFeb07
Web Source S216:11: www
Raspberry Pi 5 Guide
by Jon Wagner of Wagners Tech Talk on 2024CMar09
Web Source S216:12: www
Six new RPi 5 boards by Pineberry
by Ash Hill of tom's Hardware on 2024CMar09
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: 2024 C Mar 02
Last Updated: 2024 F Jun 30
All rights reserved 2024 by (c) ICH180RR
saved in E:\E\2022\DevE\MyPagesE\Globat\ePhotoCaption.com\a\216\216.html
backed up to ePhotoCaption.com\a\216\216_2024CMar02.html
Font: Courier New 10 (monospaced)
/216.html