Wio Terminal in PlatformIO

Seed Studio offered me a sample device (see specs) for exchange for an article on my blog and I accepted. The device came a few weeks ago so I am fulfilling my part.

When it came, I went to their page and searched for some example code to test and I picked GitHub Stats example. The documentation is pretty good but it describes the usage with original Arduino IDE which is not my weapon of choice. Some time ago I noticed PlatformIO added support for this device so I wanted to use it.

I started by creating a new project.

Then I pasted the source code in but it ended up with an error:

src/main.cpp:2:10: fatal error: WiFiClientSecure.h: No such file or directory

This led mi to following page: https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/. To use WiFi you need to install several libraries to Arduino. In PIO, you do this by adding following code to your platformio.ini :

lib_deps = 
    https://github.com/Seeed-Studio/Seeed_Arduino_atWiFi
    https://github.com/Seeed-Studio/Seeed_Arduino_FreeRTOS
    https://github.com/Seeed-Studio/Seeed_Arduino_atUnified
    https://github.com/Seeed-Studio/esp-at-lib
    https://github.com/Seeed-Studio/Seeed_Arduino_mbedtls
    https://github.com/Seeed-Studio/Seeed_Arduino_atWiFiClientSecure.git

After doing this, I’ve got a new error:

.pio/libdeps/seeed_wio_terminal/Seeed-Arduino-FreeRTOS/src/FreeRTOSConfig.h:54:3: error: #error architecture not support!
#error architecture not support!

After some investigation I found out I’m missing a build flag:

build_flags =
    -DARDUINO_ARCH_SAMD

Next error was:

src/main.cpp:3:10: fatal error: ArduinoJson.h: No such file or directory

This again means a missing library but this one is specific for the example: https://wiki.seeedstudio.com/Wio-Terminal-Reading-Github/#arduino-libraries-needed so the final lib_deps is following:

lib_deps = 
    https://github.com/Seeed-Studio/Seeed_Arduino_atWiFi
    https://github.com/Seeed-Studio/Seeed_Arduino_FreeRTOS
    https://github.com/Seeed-Studio/Seeed_Arduino_atUnified
    https://github.com/Seeed-Studio/esp-at-lib
    https://github.com/Seeed-Studio/Seeed_Arduino_mbedtls
    https://github.com/Seeed-Studio/Seeed_Arduino_atWiFiClientSecure.git
    https://github.com/Seeed-Studio/Seeed_Arduino_LCD
    https://github.com/bblanchon/ArduinoJson

I also needed to download Free_Fonts.h and put it to src/ directory as described here.

Next error was:

src/main.cpp:120:5: error: 'getData' was not declared in this scope
getData();

So I moved setup() and loop() functions to the end of the file, after getData().

After that, the code compiled and uploaded successfully:

> Executing task in folder wio-github: platformio run --target upload --target monitor <
Processing seeed_wio_terminal (platform: atmelsam; board: seeed_wio_terminal; framework: arduino)
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/seeed_wio_terminal.html
PLATFORM: Atmel SAM 4.4.0 > Seeeduino Wio Terminal
HARDWARE: SAMD51P19A 120MHz, 192KB RAM, 496KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
PACKAGES:
framework-arduino-samd-seeed 1.7.6
framework-cmsis 1.40500.0 (4.5.0)
framework-cmsis-atmel 1.2.0
tool-bossac 1.10900.0 (1.9.0)
toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 41 compatible libraries
Scanning dependencies…
Dependency Graph
|-- <Seeed_Arduino_atWiFi> 1.0 #5576591
| |-- <Seeed_Arduino_atUnifed> 1.0 #c4ae417
| | |-- <esp-at-lib> 1.0 #8c3ecc5
| | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| | | |-- <SPI> 1.0
| | | | |-- <Adafruit Zero DMA Library> 1.0.4
| | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
|-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
|-- <Seeed_Arduino_atUnifed> 1.0 #c4ae417
| |-- <esp-at-lib> 1.0 #8c3ecc5
| | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| | |-- <SPI> 1.0
| | | |-- <Adafruit Zero DMA Library> 1.0.4
| |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
|-- <esp-at-lib> 1.0 #8c3ecc5
| |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| |-- <SPI> 1.0
| | |-- <Adafruit Zero DMA Library> 1.0.4
|-- <Seeed_Arduino_mbedtls> 1.0 #4e74341
| |-- <Seeed_Arduino_atUnifed> 1.0 #c4ae417
| | |-- <esp-at-lib> 1.0 #8c3ecc5
| | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| | | |-- <SPI> 1.0
| | | | |-- <Adafruit Zero DMA Library> 1.0.4
| | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
|-- <Seeed_Arduino_atWiFiClientSecure> 1.0 #952bf0b
| |-- <Seeed_Arduino_atUnifed> 1.0 #c4ae417
| | |-- <esp-at-lib> 1.0 #8c3ecc5
| | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| | | |-- <SPI> 1.0
| | | | |-- <Adafruit Zero DMA Library> 1.0.4
| | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| |-- <Seeed_Arduino_mbedtls> 1.0 #4e74341
| | |-- <Seeed_Arduino_atUnifed> 1.0 #c4ae417
| | | |-- <esp-at-lib> 1.0 #8c3ecc5
| | | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| | | | |-- <SPI> 1.0
| | | | | |-- <Adafruit Zero DMA Library> 1.0.4
| | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| |-- <Seeed_Arduino_atWiFi> 1.0 #5576591
| | |-- <Seeed_Arduino_atUnifed> 1.0 #c4ae417
| | | |-- <esp-at-lib> 1.0 #8c3ecc5
| | | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
| | | | |-- <SPI> 1.0
| | | | | |-- <Adafruit Zero DMA Library> 1.0.4
| | | |-- <Seeed-Arduino-FreeRTOS> 1.0.0 #687b036
|-- <Seeed_Arduino_LCD> 1.6.0 #a9341f1
| |-- <SPI> 1.0
| | |-- <Adafruit Zero DMA Library> 1.0.4
|-- <ArduinoJson> 6.15.2 #7e58347
Building in release mode
Checking size .pio/build/seeed_wio_terminal/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [===== ] 48.2% (used 94724 bytes from 196608 bytes)
Flash: [===== ] 47.9% (used 243168 bytes from 507904 bytes)
Configuring upload protocol…
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
Looking for upload port…
Warning! Your /etc/udev/rules.d/99-platformio-udev.rules are outdated. Please update or reinstall them.
Mode details: https://docs.platformio.org/en/latest/faq.html#platformio-udev-rules
Auto-detected: /dev/ttyACM0
Forcing reset using 1200bps open/close on port /dev/ttyACM0
Waiting for the new upload port…
Uploading .pio/build/seeed_wio_terminal/firmware.bin
Write 243168 bytes to flash (475 pages)
[==============================] 100% (475/475 pages)
Done in 2.738 seconds
Verify 243168 bytes of flash
[==============================] 100% (475/475 pages)
Verify successful
Done in 1.506 seconds
======================================================================== [SUCCESS] Took 12.44 seconds ========================================================================
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on /dev/ttyACM0 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
No ACK, R00
Device reset detected!
ESP-AT Lib initialized!
Attempting to connect to SSID: yourNetworkName
…………

Finally the code was working! So I quickly created file wifi_pass.hwith contents:

#define WIFI_SSID "ssid"
#define WIFI_PASS "password"

and included it in main.cpp like this:

#include "wifi_pass.h"
const char* ssid     = WIFI_SSID;
const char* password = WIFI_PASS;

After this, I got the code to work:

--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on /dev/ttyACM0 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
No ACK, R00
No ACK, R00
Device reset detected!
ESP-AT Lib initialized!
Attempting to connect to SSID: homestead5
………Connected to homestead5
Starting connection to server…
Connected to server!
headers received
closing connection
3
1
17

You can see the result screen here:

You can find my project in this repo: https://github.com/danielkucera/wio-github-stats

One negative note though, to use the WiFi, I had to upgrade it’s firmware as described here. The problem is, that the utility works under Windows only so I spent some time installing Windows. But the guide mentions Linux version coming soon so hopefully it will come soon.

To conclude, I like the device, it’s nice big display and that it works with 5GHz WiFi. It’s ideal for displaying some quick info downloaded from the Internet or smart home data.

OpenShift 4: Automatic LDAP group synchronization

If you need to use LDAP for authentication in OpenShift 4, the documentation is pretty clear and everything works nicely [1].

But if you need to grant privileges based on LDAP groups [2], the situation gets complicated.
The synchronization from [2] works ok but you need to run it manually. I was searching for an automated solution and I have found a definition [3] which works for OpenShift 3.x so I updated it work with OpenShift 4 and here it is [4]:

Continue reading OpenShift 4: Automatic LDAP group synchronization

CometBlue teardown

Chips used:

Links