Wednesday, November 14, 2018

Personal Project

Project Introduction

I have started a personal project to implementing a simple Bluetooth Mesh client using the Nordic nRF52832 microcontroller with C++.

Why the nRF52832?

The Nordic nRF52832 is a very popular, multi-protocol wireless MCU. I want to get some experience with this device so I can be confident in my use of it on work projects.

Why Bluetooth Mesh?

Bluetooth Mesh is a relatively new wireless mesh protocol. Others, like Zigbee, Thread, and Z-Wave have been in the market for much longer. I have completed a number of designs with Zigbee and overall, I have been unsatisfied with the implementations I’ve worked with. I think that the Zigbee 3.0 specification is a step in the right direction, however. The research I have done on Bluetooth Mesh has excited me that, perhaps, someone has created a protocol that learned from the mistakes of the others. In addition, the ability to start using a Bluetooth Mesh device straight out of the box with a smartphone or other “Classic Bluetooth” device is very helpful.

Why C++?

In the beginning of my career, I wrote assembly. It was quite satisfying at first. I was able to define the exact behavior of the processor. Eventually, as the problems got more complex, I did move to C. While using C, I often thought, “Why did I ever program in assembly?”. As problems have wont to do, they continue to get more and more complex. In response, I began investigating C++. I now use C++ exclusively if at all possible. Again, I look back at my years with C and often think, “Why did I ever program in C?”.

There are a few key reasons I can point to for my current attitude:

  1. low-cost, zero-cost, and negative-cost abstractions - Abstractions make code easier to read, maintain, and test. Without abstractions, you have spaghetti code in which dependencies are tangled and diffused throughout your application code. C++ allows development of “business logic” at a high level (even using a DSL) while still allowing “opening the hood”, as they say, to optimize the details.
  2. strong typing - Strong types make your code safer and more expressive. Consider the example void setDuration(int duration) vs void setDuration(Seconds duration).

Project Goals

  1. Gain familiarity with the Nordic nRF52832 platform and software utilities.
  2. Exercise design best practices including appropriate documentation, defining system architecture(s), and VCS usage.
  3. Exercise code best practices including appropriate TDD, abstractions, and modern language features.

Written with StackEdit.