Stephen Smith's Blog

Musings on Machine Learning…

Archive for August 2021

Wio Terminal First Impressions

with 5 comments


I received a Seeed Studio Wio Terminal, an interesting device that contains an Arduino style microcontroller, but packaged with a 320×240 2.4” color screen, buttons, bluetooth, WiFi, microphone, buzzer, microSD card slot, light sensor and infrared emitter. The packaging means you can work with it, without any soldering or breadboarding. It also has two Grove ports and Raspberry Pi compatible 40-pin GPIO pins.

It is built around a ATSAMD51 microcontroller containing a 32-bit ARM Cortex-M4 processor with a Floating Point Unit (FPU), running at 120 MHz. For memory there is 192KB RAM and 4MB flash.

To program the Wio Terminal, the current options are:

  1. Arduino – Use the Arduino IDE and supplied libraries for the integrated devices.
  2. MicroPython – There is a special MicroPython build for device support.
  3. Codecraft’s TinkerGen cloud development which includes TinyML support.

In this article we’ll look at the Arduino support and a simple fractal program to see what is involved. Below is a picture of the Wio Terminal with our fractal Koch snowflake. The screen is better than shown, as there was some interference between my phone’s shutterspeed and the screen refresh rate.

Koch Snowflake on a Wio Terminal

Koch Snowflakes

Koch snowflakes are simple fractals that are a good way to give an idea of how fractals can build complexity out of simplicity. Basically you start with a base shape, in this case a triangle, then you replace each line segment with a new shape, in this case the two lines with a “v” in the middle. Then you do this recursively to get more and more complicated shapes. Below is the progression from level 0, the base shape to level 1, with the base shape lines replaced by the fractal generator and then so on as the level increases.

This is a fractal because in the limit as the level goes to infinity, the shape has a fractal dimension, in that it is somewhere between 1 dimensional and 2 dimensional in a defined mathematical sense.

Turtle Graphics

To me the easiest way to draw fractals is with a turtle graphics library. This is a simple drawing library where you tell a turtle to either turn or move forwards. As he moves he leaves a trail. Hence the base shape for the Koch snowflake is forward 1, turn 60, forward 1, turn -120, forward 1, turn 60 forward 1. This is then really easy to apply recursively to draw fractals.

Programming the Wio Terminal

Drawing Koch snowflakes on the Wio Terminal turned out to be quite easy. The TFT graphics library Seeed Studio provides is quite good and makes programming easy with routines for lines, colors, text, basic shapes, all the way up to higher level objects like histograms. 320×240 may not seem like much resolution by today’s 4k standards, but remember this is about the same as CGA graphics on the original IBM PCs. Besides initialization, the only routine we used is drawLine. The Wio Terminal came with a USB-C to USB cable to connect the device to a regular computer. You program in the Arduino IDE on your PC and download the result to the WIo Terminal to run.

Below is the complete source code to draw the Koch snowflake.


TFT_eSPI tft;
float turtleX;
float turtleY;
float turtleHeading = 0;

void setup() {
  int level = 3;
  int size = 200;

  turtleX = 320/10;
  turtleY = 240/2;

  turn( 60 );
  KockSnowflakeSide( level , size);
  turn( -120 );
  KockSnowflakeSide( level, size);
  turn( -120 );
  KockSnowflakeSide( level, size);
  turn( 180 );

void KockSnowflakeSide(int level, int size)
  if (level == 0)
      forward( size );
      KockSnowflakeSide( level – 1, size / 3 );
      turn( 60 );
      KockSnowflakeSide( level-1, size / 3);
      turn( -120 );
      KockSnowflakeSide( level-1, size / 3);
      KockSnowflakeSide( level-1, size / 3);

void forward(float amount) {
  float newX = turtleX + cos(radians(turtleHeading)) * amount;
  float newY = turtleY + sin(radians(turtleHeading)) * amount;

  tft.drawLine(turtleX, turtleY, newX, newY, TFT_BLACK);
  turtleX = newX;
  turtleY = newY;

void turn(float degrees) {
  turtleHeading += degrees;

void loop() {

I spent most of my professional career as a C programmer, and I really like the Arduino environment. I think learning to program in C is a great skill for any programmer or prospective programmer. It is a great starting point to getting into more technical areas like programming microcontrollers using the GNU GCC tools and all the various low level SDKs you are likely to encounter.


The Wio Terminal is a great way to get into learning about microcontrollers without needing to know soldering or electronics. The Grove system lets you connect all sorts of sensors to the Wio Terminal using standard cables. The screen is good enough to display things like weather station data and the buttons can be used to build simple UIs.

Programming the Wio using the Arduino IDE works well. The provided board and device support are great, making programming the device easy. C programming has its pitfalls and a novice programmer might want to start with MicroPython first, but learning C is worthwhile. The processor is powerful enough for most applications and having an FPU is a nice bonus.

Overall the Wio Terminal is an interesting entry in the microcontroller world, trying to remove the intimidation and difficulty of learning electronics, but still allowing you to learn programming and construct many of the same DIY projects. Seeed Studio’s website contains many tutorials and suggestions for projects. This would be great in a classroom setting, since you don’t need to police youngsters risking burning themselves with improper care while soldering. The price runs at around $37 which makes it accessible to most people and price competitive against Arduino starter kits.

Written by smist08

August 30, 2021 at 11:43 am