Nothing gets me more excited about the IoT and embedded development than the opportunity presented by Machine Learning. Case in point (and shameless plug), I've built a Raspberry Pi-based birding project, a speed trap, and an anomaly detection project using thermal images - all using ML.

Well ok, maybe the one thing that does get me even more excited is building a connected IoT + ML project in minutes, writing less code with what is effectively plug-and-play hardware.

In this short tutorial, I'll show you how to use the new Person Sensor from Useful Sensors to relay person-detection data to the cloud using a cellular IoT module: the Notecard from Blues Wireless.

The above hardware pair, combined with a STM32-based host microcontroller and a secure cloud service, combine to form a low code solution for syncing face detection data with the cloud (literally in less than 30 lines of code).

from person sensor to notecard

Introducing the Person Sensor

Pete Warden is considered one of the "founding fathers" of TinyML (ML on constrained devices). He spent years working on TensorFlow Lite at Google and only recently left to form a new company called Useful Sensors.

Their first hardware product is, ahem, an awfully useful sensor:

useful sensors person sensor

The Person Sensor brings ML vision capabilities to virtually any product, in a low code manner. The device itself is pre-programmed with algorithms to detect faces via its on-board camera. These face-detection inferences are returned to a host MCU via an easy to use programming model - and the board itself connects to your host via a Qwiic I2C interface.

Using one of their provided Arduino sketches, you can see facial recognition data fed into your serial monitor:

********
1 faces found
Face #0: 99 confidence, (68, 71), 136x193, facing      

Let's see how we can add IoT to the mix and relay this data to the cloud, from anywhere in the world.

Adding Cellular IoT

While I'm a fan of writing code, I'm an even bigger fan of writing less code. So, much like the Person Sensor, the Blues Wireless Notecard is (IMO) the easiest way to add cellular connectivity to an IoT project.

blues wireless notecard cellular iot

The Notecard is a cellular system-on-module that comes prepaid with 500MB of data and 10 years of global service. It combines with the Blues Wireless cloud service, Notehub, to form a secure device-to-cloud data pump.

And how do we program the Notecard? Not with AT commands!

The Notecard and Notehub live and breathe JSON. Since the Notecard also has an onboard GPS module, you can, for example, ascertain the device's location with a single request:

// request sent to Notecard 👇
{"req": "card.location"}

// response from Notecard 👇
{  "status": "GPS updated (58 sec, 41dB SNR, 9 sats),  "mode":   "periodic",  "lat":    42.577600,  "lon":    -70.871340,  "time":   1598554399
}

The easiest way to prototype with the Notecard is to use a carrier board affectionately known as the Notecarrier. In this case, we are using the Notecarrier-A with Qwiic connectors and onboard antennas:

blues wireless notecarrier-a

The Host Microcontroller

For this relatively simple low code project, you can use virtually any microcontroller or single-board computer you have lying around.

I picked the Blues Wireless Swan for this tutorial, as it's easy to program, inexpensive, supports Arduino and CircuitPython, is the most extensible Feather-based MCU with plenty of I/O, and has a Qwiic connector to connect to the Notecarrier:

blues wireless swan stm32 mcu

Connecting all of the hardware leads to a relatively clean setup (thanks Qwiic!):

final project with notecard and person sensor

Those 30 Lines of Code

In a simple Arduino sketch we are going to perform a few tasks:

  1. Set up the Person Sensor and read face detection data.
  2. Initialize the Notecard to communicate with the cloud, over cellular.
  3. Send accumulated face detection data to the cloud (Notehub) and beyond.

🥁 Here is the full sketch: 🥁...

Read more »