Your IoT Learning Journey with PineTime

The skills that we have learnt today for debugging PineTime Firmware: stepping through code, setting breakpoints, inspecting variables… Are the same skills that I used for creating professional IoT devices (based on STM32 and Nordic nRF52 microcontrollers) connected with Bluetooth, WiFi, NB-IoT and Sigfox networks! (Check out my articles)

Congratulations, you’re now an experienced Embedded IoT Developer!

To sharpen your skills as an Embedded IoT Developer, check out the other articles in the PineTime series to learn hands-on… What really happens inside a real-world IoT gadget like PineTime…

1️⃣ I2C (Inter-Integrated Circuit) is a common way to connect components inside commercial IoT gadgets. In PineTime, I2C connects the nRF52 Microcontroller to the component that detects touching on the screen (called the Touch Controller).

Read on to learn why I2C works like a Light Rail train system (with Ghost Stations, possibly). How do we work with hardware components with incomplete documentation? (Happens frequently with IoT projects) Let me show you how I did it!

2️⃣ SPI (Serial Peripheral Interface) is another type of connection that’s commonly found inside IoT gadgets. In PineTime, SPI is used by the nRF52 Microcontroller to blast graphics at high speeds (8 MHz) to the colour LCD display.

But Speed is meaningless without Control… We’ll learn to group multiple display updates into a single SPI request, for higher throughput. We’ll also learn about the classic Space-Time Trade-Off… The more RAM you throw at the task, the faster it runs!

We’ll also dive into Apache Mynewt, the embedded operating system that shields us from the Bare Metal hardware. And its nifty low-level tricks (like Non-Blocking SPI) that will make PineTime fly. Beware: This article has plenty of fun experiments to optimise PineTime!

PineTime Challenge: Can you make graphics rendering even faster? More details here

3️⃣ PineTime has an interactive touchscreen that supports Watch Apps. This presents an interesting problem… How do we actually program Watch Apps for PineTime?

Programming Watch Apps for PineTime is surprisingly similar to Pebble’s Watch Apps. We apply the same concepts to lay out the user interface and respond to touch… Except that we do them in Rust instead of C.

Discover how complex embedded software (with many layers) can run on a tiny gadget like PineTime… With a bit of memory optimisation.

PineTime Challenge: Can we install Watch Apps on PineTime separately from the OS Firmware, perhaps via Bluetooth download? Here’s my proposed design

Here’s one way to build Watch Apps for PineTime through graphical programming (like Scratch)…

Here’s how we may run Retro Games on PineTime…

4️⃣ Our Raspberry Pi connects to PineTime via an open-source program called OpenOCD (Open On-Chip Debugger). OpenOCD controls the flashing and debugging of PineTime by communicating with the SWD (Serial Wire Debug) protocol. (Created by Arm)

Here we explore the details of the SWD protocol. And learn why we should use I2C or SPI interfaces whenever possible… Not Bit Banging with GPIO.

5️⃣ PineTime is one tiny part of the enormous Open Source Embedded Ecosystem, which includes other open-source projects like FreeRTOS, Zephyr OS, RIOT OS, Mynewt OS, TinyGo, Rust Embedded, …

Learn more about these open-source projects in the “References” section of this article…

6️⃣ And if you’re located in the East, I have a special urgent message for you…

7️⃣ PineTime Challenge: Bluetooth Mesh Programming

Bluetooth Mesh enables a local network of PineTime watches (and other gadgets) to communicate with one another, peer to peer.

Bluetooth Mesh has the potential to do so much good for humankind… Alert nearby swimmers if you’re downing… Fall detection for workers at Construction Worksites… Find lost children (and maybe pets)…

But programming Bluetooth Mesh is incredibly hard, check out this code in C. Can we make mesh coding easier for newbies?

8️⃣ Why did we select Rust and Mynewt? That’s explained here…

9️⃣ We are working on a solution to flash PineTime firmware via Bluetooth LE…