Tag

iot

Browsing

When running on a battery, it is important to know what parts of your circuit draw the most current. Profiling is a process where you look at sections of code or interactions with hardware to see how much power each requires. In this video, James shows four tools (and their tradeoffs) when profiling IoT or Edge Machine Learning devices. See if it makes more sense for you to use a Digital Multimeter (DMM), Power Supply…

Whether you are developing a WiFi-enabled coffee maker, a sensor to detect rainfall, or a livestock tracking drone, an IoT device will follow the same product development cycle.

[featured-image single_newwindow=”false”]

A common mistake that engineers will make is trying to own the development at each stage, at least up until “deliver.” Who can blame us? The idea of delegating any part of our new product introduction can be daunting. Delegating, or outsourcing can be a powerful tool. It allows you to focus on the elements of your process that only you can do. Let others handle the rest. If your core contribution is the machine learning algorithm, then focus your effort there. Spending time designing the enclosure, or negotiating with suppliers, or even laying out the printed circuit board is a waste. Let the people who excel in each of those areas apply their expertise to your product.

Production, or making, is the prominent point for outsourcing. It is common to work with a contract manufacturer to build your product. Some offer complete services that allow them to source your components, produce the product, package it, and drop ship it to your customer. This next statement might sound recursive, but consider outsourcing the step of finding someone to outsource manufacturing.

Let’s look at the Idea, Design, and Source stages for a typical IoT device. At each of these steps, I give some pointers to help identify what you should focus on and what you can delegate to a third-party, as well as, introduce you to a partner to consider.

In my Arduino MQTT Examples, I kept things simple by only subscribing to a single topic. One of the strengths of MQTT is that a device can subscribe (or publish) to multiple topics. The broker will sort things out. Even though my first example only showed one, it is straight forward to get the Arduino PubSubClient library to subscribe to Multiple MQTT topics.

The quick answer is that you need to look at the MQTT response to find out which topic sent the payload.

tl;dr version

If you’re looking for a quick answer, here’s the magic code we’ll add to the callback() function.


void callback(char* topic, byte* payload, unsigned int length) {
if (strcmp(topic,"pir1Status")==0)
  // whatever you want for this topic
}

Keep reading for a more detailed explanation of how to Subscribe to Multiple MQTT topics with Arduino’s PubSubClient. Obviously, this code will work on Arduino boards with a TCP/IP interface and, of course, the ESP8266 based boards.

Pulse Width Modulation (PWM) makes it possible to dim lights, control the speed of motors, and (with the help of filters) generate analog reference voltages. When measuring the voltage or current of a PWM signal, there are unique challenges. You can use this tutorial to measure PWM current with a modified moving average (MMA).

Getting back to my IoT projects, I decided to pick up a temperature sensor. While looking through the Adafruit breakout boards, I found they offered nine different digital temperature sensors! This list is in addition to the analog TMP36 temperature sensor, so that’s ten. I needed an Adafruit Temperature Sensor comparison.

With so many options, I quickly found myself getting lost between the various modules. The 10 I found all measured temperature and provided an I2C interface. Except for the MCP9808 board, they all made at least one other type of measurement. The MCP9808 is the cheapest digital temperature sensor breakout that Adafruit offers, and also the most accurate.

I couldn’t find a comparison in my quick search, so I built my own comparison table. Here’s my chart for an Adafruit Temperature Sensor comparison of their breakout boards.