There seems to have been a lot of activity recently in cellular IoT - webinars and contests, etc. Or maybe I've just started to notice it. There was a webinar on E14 a couple of months ago on the Nordic Thingy:91 which is an amazing fully integrated cellular prototyping platform that is ready to use out-of-the-box. It comes with a built in battery, a wealth of sensors, GNSS, and even a pre-flashed asset tracker application. The Thingy:91 has been around a couple of years and featured in a few articles and quizzes on E14. I'm surprised that members that got these devices haven't blogged more about them (or maybe I haven't been paying attention).
Earlier this year I saw a few articles on Blues Wireless Notecards and last month I attended a webinar put on by Blues Wireless. I was pretty impressed by the apparent ease of development using the Notecards and decided to try it out. One thing that I liked is that included in the cost is an integrated SIM that provides up to 10 years or 500MB of data and is reloadable. The Thingy:91 by comparison includes a replaceable SIM that provides 10MB worth of data.
The Notecard form factor is similar to the SparkFun MicroMods that I've used and has the same M.2 edge connector. It does need a carrier card to be used effectively and requires external antennas, but that actually adds to the application flexibility. The module is really a cellular modem with GNSS capability and can be paired with most MCUs over serial UART or I2C. I could see building a very small custom carrier for tracking applications.
I decided to buy a Cellular and WiFi Feather Kit that includes a Cellular Notecard, a WiFi NoteCard, and a Swan Feather Board (STM32 MCU). I have a number of different Feather Dev Boards, so this seemed like a good starter choice and it also has 3 I2C sockets (2 Grove, 1 Stemma QT) and has battery and solar inputs and external Cellular and GNSS antennas.
The Cellular Notecard and Swan Feather Board mounted on the carrier with antennas attached.
Initial setup was pretty easy as Blues.io has a "In-Browser" Terminal that allows connection to the Notecard through the carrier card micro USB interface. The Terminal automatically discovers the Notecard and you just have to select it to connect
The Notecard is designed to be a device-to-cloud data pump which communicates bi-directionally to the Notehub.io cloud using JSON packets.
The "Getting Started" example connects to the cloud and sends data by using the "In-Browser" Terminal. That worked successfully, but I'm going to skip ahead to showing the Sensor Tutorial example that uses the Feather board with the Notecard since that is a more realistic demo.
Sensor example using MS8607 temperature/humidity/pressure sensor with a Adafruit Huzzah ESP32 Feather and Notecard using the Arduino IDE for coding.
The Blues sensor example uses a BME680 sensor, but I don't have a Grove or Stemma version of that so I modified the code to use an MS8607 instead. Both use I2C interfaces, so it just required switching libraries and library functions.
Blues has a great set of documentation and I especially like that they have examples of the tutorials that support different hardware and software combination - selected from a pulldown menu. The tutorial updates based on your choices.
You can see below that not all selections are available yet for this Sensor tutorial:
Development software choices:
Development Board Choices:
Notecarrier Choices:
I decided to use the Huzzah ESP32 Feather because I have a lot of experience with it and haven't actually used a Swan STM32 Feather yet. Or maybe the biggest reason is that I don't have the STM32 software installed on this particular computer yet.
Adding the code to support the Notecard was very straightforward.
1. Add the library:
2. Include the library in the sketch:
#include <Notecard.h>
3. Define productUID to associate the Notecard with the project on Notehub
#define productUID "com.your-company.your-name:your_product"
4. Create a Notecard instance
Notecard notecard;
5. In the Setup() function:
Initialize the notecard instance
notecard.begin();
Configure the notecard instance (build the JSON object - first 3 lines, then send the request to the notecard)
J *req = notecard.newRequest("hub.set");
JAddStringToObject(req, "product", productUID);
JAddStringToObject(req, "mode", "continuous");
notecard.sendRequest(req);
6. In the Loop() function:
Send a sensor reading to the notecard (build the JSON object and send it)
J *req = notecard.newRequest("note.add");
if (req != NULL) {
JAddStringToObject(req, "file", "sensors.qo");
JAddBoolToObject(req, "sync", true);
J *body = JCreateObject();
if (body != NULL) {
JAddNumberToObject(body, "temp", bmeSensor.sensor_result_value.temperature);
JAddNumberToObject(body, "humidity", bmeSensor.sensor_result_value.humidity);
JAddItemToObject(req, "body", body);
}
notecard.sendRequest(req);
}
Here is the completed sketch with the sensor programming included:
Blues_Adafruit_Feather_ESP32_MS8607.ino
#include <Notecard.h> #include <Wire.h> #include <Adafruit_MS8607.h> #include <Adafruit_Sensor.h> #define serialDebug Serial #define productUID "com.hotmail.ralphjy:ms8607" Notecard notecard; Adafruit_MS8607 ms8607; void setup() { // put your setup code here, to run once: delay(2500); serialDebug.begin(115200); Wire.begin(); notecard.begin(); notecard.setDebugOutputStream(serialDebug); // Try to initialize! if (!ms8607.begin()) { serialDebug.println("Failed to find MS8607 chip"); while (1) { delay(10); } } serialDebug.println("MS8607 Connected..."); J *req = notecard.newRequest("hub.set"); JAddStringToObject(req, "product", productUID); JAddStringToObject(req, "mode", "continuous"); notecard.sendRequest(req); } void loop() { // put your main code here, to run repeatedly: float tempC, tempF, humid, press; sensors_event_t temp, pressure, humidity; ms8607.getEvent(&pressure, &temp, &humidity); tempC = temp.temperature; tempF = tempC * 9 / 5 + 32; humid = humidity.relative_humidity; press = pressure.pressure; serialDebug.print("Temperature = "); serialDebug.print(tempC); serialDebug.println(" *C"); serialDebug.print("Humidity = "); serialDebug.print(humid); serialDebug.println(" %"); J *req = notecard.newRequest("note.add"); if (req != NULL) { JAddStringToObject(req, "file", "sensors.qo"); JAddBoolToObject(req, "sync", true); J *body = JCreateObject(); if (body != NULL) { JAddNumberToObject(body, "temp", tempC); JAddNumberToObject(body, "humidity", humid); JAddItemToObject(req, "body", body); } notecard.sendRequest(req); } delay(15000); }
Here is the output on the Serial Monitor:
Notehub
Over on the Notehub you need to create a project with a unique productUID that will associate it with the Notecard.
I currently only have two projects defined:
And only a single device associated with the MS8607 project with the productUID "com.hotmail.ralphjy:ms8607".
And the events received from the device:
I'm looking forward to trying other examples and configurations. I'll have to think of a good project that I can do with this.
I also haven't had the chance to see what that "Solar" input does. I'll need to find a schematic...