SwiftIO Playground

The ultimate playground for hardware programming in Swift

Available for pre-order

View Purchasing Options
Sep 28, 2023

Project update 3 of 8

Swift on Microcontrollers: How Our Project Evolved!

by Andy Liu

Hello, I’m Andy Liu and today I’m thrilled to share the story of how our project came to life and evolved.

Before embarking on this project, I spent most of my time working in the embedded world. I’ve always been passionate about various hardware-related endeavors and have spent years tinkering with embedded systems. My journey has taken me from the realm of bare-metal 8-bit 8051 MCUs to the Linux-based MPU platforms.

Previous individual projects

In my "EVB" project in 2014, I successfully ported the LEGO EV3 Linux system to the BeagleBone Black, which was subsequently sent to the International Space Station in 2017.

Many people have wondered why I chose the BeagleBone Black over the Raspberry Pi. The answer is quite simple: I could never find the schematic of the Raspberry Pi, making it impossible for me to perform any significant modifications at that time. In contrast, TI was exceptionally open in its approach. They not only open-sourced everything they could, but also provided incredibly detailed documentation. I am genuinely appreciative of it!

Speaking of this, some people regard open source as a miraculous belief. In my opinion, open source is a form of marketing for a specific project. Open-source software/hardware projects may indeed attract more attention from developers, but the key to generating revenue is solving customers’ problems.

For those familiar with STEM education, "BBC micro:bit" is a well-known name. In 2016, I came across news of their public beta tests in the UK, where they distributed one million boards to Year Seven students. At first glance, I thought it was crazy, as the board seemed useless without additional resources (at least in 2016). However, reality proved me naive. It turned out to be a remarkable marketing success. Many people outside the UK wanted to purchase the board, but they were unable to do so.

I decided to dig deeper. I managed to find the DAPLink source code and the nRF51822 source code online, both of them had friendly licenses for commercial use. The main challenge was that I lacked the precise physical design and schematic. All I had were images I found on the internet. So I spent a few days doing picture reverse engineering using Photoshop. It’s not easy, but I successfully made this "fat:bit" without having access to an actual physical board.

When I began selling this board through various platforms, I unexpectedly received a legal notice from the BBC’s attorneys. Wasn’t this hardware supposed to be open-source? Oh, they said I violated their appearance patent. Well, that did make sense, it proved my Photoshop skills were not so bad!

Why Swift

While I do have some experience programming with C, I’ve never loved it because I’m so forgetful that I have to check the weird rules every time. Especially since today the tasks on microcontrollers are becoming increasingly complex. (The MCU is becoming more powerful in the meantime.)

I was always looking for a better solution, even though there were already Arduino (C/C++), MicroPython, TinyGo, Espruino (JS), Netduino (C#), etc.

There are few modern, industrial-grade languages that can be used in such a context. Until I finally met Rust and Swift. I compared those two and it was very obvious for me to give up Rust since it’s too hard to learn. By contrast, Swift seems pretty promising in their slogan: Safe, Performance, and Modern (easy to learn).

And again, it’s open-sourced by Apple! I don’t think Apple would sue me if I modified their compiler since all the giant companies want to build a positive image to attract more developers.

First Try

February 2019. The Swift compiler is based on LLVM and thus can be easily modified to emit ARM Cortex-M instructions. These pictures mark the beginning of this journey.

March 2019. I tested a DAPLink based on the STM32F103CBT6.

The First Board

June 2019. Four months later, I received the first small batch of prototypes. In this version, I replaced the DAPLink from STM32F103CBT6 ($1.20 USD) with the MK20DX128VFM5 ($4 USD) because a salesperson from NXP gave me some friendly advice, suggesting it wouldn’t be convenient for them to market the board if I used a non-NXP MCU on it.

July 2019. Everything just works.

October 2019. Another updated version, adding USB OTG for fast downloading.

Nov 2019. Implemented Tetrics.

Nov 2019. The Maker Kit was done.

Dec 2019. I did some marketing at the technical conference.

Orders!

Feb 2020. Entering a new era with masks. We didn’t anticipate much impact at the beginning, but reality proved us completely wrong!

April 2020. We began preparations for selling.

April 2020. I discovered an open-source NES simulator written in pure Swift, but it had a significant issue with slow performance. It could only display a few frames before becoming unresponsive.

June 2020. We began shipping! The orders continued to increase…

Aug 2020. We kept developing new expansion boards.

Aug 2020. We received the first customer feedback.

Oct 2020. The last package was sent out.

Dec 2020. We moved to a new office, we were quite naive at that time!

Global Chip Shortage

March 2021. Due to the global chip shortage, everything came to a halt. We couldn’t place orders for the RT1052 MCU, the ISSI SDRAM, the MK20DX128VFM5, and more. Despite our inability to sell, we had no choice but to continue development.

We had fewer than 100 pcs of RT1052, but we still need to evolve. We redesigned the main board, making it compatible with Adafruit Feather.

May 2021. We developed this Playground.

June 2021. We even designed the packaging.

June 2021. The new office became a bit chaotic after a few months. This is the reality of hardware development.

July 2021. I experimented with some SwiftUI-styled code.

Office shrinking

Dec 2021. Without income, we had to move to a cheaper office.

Feb 2022. Based on customers’ feedback, USB compatibility was a big issue. We began to develop a USB-Serial communication protocol, it’s much easier and more stable. Sometimes, keeping stuff simple is the key.

March 2022. Finally, we got a batch of SDRAM.

May 2022. Once again, our office space shrank.

July 2022. We had to do some outsourcing services to get income.

Aug 2022. To save money, we worked at the Starbucks sometimes.

Remote office

Aug 2022. To escape the lockdown and high rent in the big city, we decided to relocate.

Aug 2022. We were constantly changing our office location every day!

Aug 2022. I was really worn out.

Jan 2023. We said goodbye to the city office and all of us began working remotely!

End of Covid

March 2023. We finally received a batch of NXP RT1062 MCUs.

Apr 2023. I started working remotely in Thailand.

June 2023. I joined the WWDC23 in San Jose.

June 2023. I visited Brad at Hawaii University. I truly appreciate his trust.

Starting Again

July 2023. I returned to China to have the first batch manufactured.

Sep 2023. A small batch of the prototype was sent to Hawaii University in a hurry.

Sep 2023. Finally, the campaign is online.

Finally

We want to give a huge shoutout to all of you who’ve been there for us throughout this incredible journey. We’ll continue to work hard on this project, and we can’t wait to bring you even more awesome features in the future. Your support on Crowd Supply would mean the world to us. Thanks a bunch!


Sign up to receive future updates for SwiftIO Playground.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects