The most important decisions to make for your IoT project are the microcontroller, connectivity, and the visualization platform.
You thought I was done telling you about what to do and how to do it? You thought wrong. I will make sure that you don’t make all the mistakes I did on my road to enlightenment regarding IoT. With a couple of extremely unorthodox experiences, and an unconventional mindset I will coax you into making the right decisions when it comes to IoT and IoT projects, I promise.
Last time (add link to previous article) we talked about ideas and I’m pretty sure that you’ve already come up with quite a few of your own. So we are done with the idea part and there's a lot of inspiration and information on how to intercept the right ideas but there is very little information about how to take a proper start. But you don’t need to be worried. You have me.
Let us reiterate the basic steps first. You start with a problem. It could be an intuitive one or, could stem from a personal experience or could be any problem you want to solve for other people. Anything which works for you, but you’ve decided to work on that particular problem, make it your life. Try to give your your full focus. It can be something personal, like a problem or a cause that you really care about. Or it could be something for the delight of curiosity. But you should be very passionate about it. And I strongly believe that you should never start a project based on external factors. Like 2021 was about crypto and the NFT. Everyone wanted to ride the wave, even the giants like Facebook. But it all ended in quite a dramatic way within a year. That’s why, it is important to have a long term thought process or at least a purpose behind the idea that you are choosing for your IoT project.
And once you figure out your idea, first off, read! There are tons of platforms you can use. Read about all those platforms and what they have to offer. You’ll easily get tons of getting started guides that’ll help you along the way. Join Hackster.io, Instructables, and iotforall.com and get all the help you need. See what other people are talking about. Get inspired and possibly find your community and build it in public. We talked more about this in our last article (link here).
Now when we are talking about making the right choices, the next step is to build your hardware. Get that wiring straight. Make sure that you build a prototype and put your idea into implementation.
The first decision you'd make for your IoT project has to be what microcontroller you choose. There are a few factors that you need to consider when making this decision but despite all of that make sure that you do not overcomplicate your decision.
If your project is super simple and does not require major processing power, hit it off with an ESP8266 or a basic microcontroller. For instance if you want to build a simple LED control or a basic sensor which will use a couple of GPIO pins at max, they will keep you sorted. Their single threaded processing will fulfill these requirements. Most of the IoT projects fall into this category. Where you don’t need a lot of processing power and just want to interface with a few sensors to send data to the cloud.
If processing power and speed is your priority, you could go for a good microcontroller. This could be the kind of IoT project, where you would like to do a lot of signal processing.
For most cases, you can use ESP32. It is a high end version of ESP8266 and with a couple of extra bucks, you get a lot more speed with clock frequency of 160 MHz to 240 MHz. And you can handle multiple tasks at the same time because ESP32 is dual core. You can use one core for the computation, and the other for connectivity. Plus, you get a lot more GPIOs.
While ESP32 is a great choice for most applications, sometimes you need very good signal processing. And that’s where you need a really good ADC. Here I would advise you to rather use external ADC like ADS1115 with ESP32 to expand the capabilities of ESP32.
And in applications, where you need very high response time, I would recommend using two different processors; one for signal processing / interfacing and other connectivity. Like one time, I was working with a company which was making a device to control power consumption of air conditioners. It was basically a VFD where it was crucial to avoid harmonics to prevent any damage to the compressor. Therefore, we needed a good way to monitor harmonics and a very high reaction time to avoid it. So we ended up using two processors. We used a PIC microcontroller as the core processor. We were using it to process signals and occasionally send data to the cloud with an ESP8266 which we interfaced with it using I2C.
Here you get the choice to either use a very high end microcontroller like STM32, or in most applications, we can work with a low cost alternative like PIC. But speed can be one crucial factor. We can clock STM32 up to 480 MHz, whereas we can only clock the PIC to 32 MHz at max. It varies from application to application.
For projects where machine learning is the core element along with IoT, like if something is voice activated or you need to classify images, microcontrollers like STM or PIC or ESP cannot be really used. ESP and PIC generally come with very limited RAM and CPU resources. And doing ML on STM is very hard because you work at hardware level.
This is where I would recommend using a System on Chip, like Raspberry Pi or Orange Pi. Basically, any processor which can run an entire OS. Because then you can use high level languages like Python and get the benefit of the ecosystem. Like with Python, instead of building it from scratch, you can just use Tensorflow, Pytorch, or like Keras (there are tons of other open source alternatives).
Also, this is a very important consideration for applications where you need very high stability. Running an OS makes it possible for developers to build mission critical hardware in less time.
With all of these covered, let's talk about Industrial IoT projects where PLCs are your go-to solution. Because first, you need a lot of stability. Using SoCs would be an overkill for most use cases and you cannot use low cost microcontrollers for mission critical applications. With PLC, you can skip boilerplate. Also at this point, there is a very strong ecosystem for industrial applications around PLCs. Siemens, ABB, and Schneider offer a whole range of solutions designed for industrial grade applications.
But having said that, there is a strong probability that you will be stuck in a vendor lock in. You can interface Siemens sensors with Siemens PLC. There is a whole range of dependency issues that occur if you don't. And companies like Siemens are still stuck in the past, basically, you are dependent on ethernet to interface sensors and actuators at long distances. You can get wireless interfacing by paying a premium.
So essentially it all boils down to choosing your MCU according to your complexity and reliability needs. The next choice of sensors is a derivative to your first choice. After that you need to consider factors like battery life. Whether you need battery longevity or batteries can be easily replaceable.
The essence of IoT is communication and for that we need to figure out the right way for our project to connect the hardware to the internet. When it comes to connectivity, we have several options, like WiFi, cellular, LoRaWan and NB-IoT. Here is a framework for you
When cost is a key parameter and you can work with short distance, WiFi is the best option. You can connect your hardware to the internet with a WiFi router. For such applications, we can use low cost microcontrollers like ESP8266. This is ideal for consumer applications (particularly household because WiFi is readily available), like connected air conditioners or lamps.
But WiFi is difficult to handle in production. WiFi was never designed for hardware devices without a UI / screen. Having a touch screen interface quickly adds up to the cost of producing the hardware. Therefore, it is difficult to configure devices with the router. Also, WiFi connections are prone to long distances plus most ordinary routers are limited to 10 devices only. For best performance, the users need high bandwidth connection and repeaters all across the home.
Cellular is generally ideal for long distance communication. In the last decade, telecommunication companies have invested a lot to expand their coverage and now we can communicate over quite long distances and at pretty high bandwidth with cellular.
It is ideal for applications where we need very stable connectivity. Like autonomous vehicles. Otherwise, it is a very high cost solution. First you need a cellular module, which generally costs a lot more than regular WiFi-based controllers like ESP8266. Also, the use of cellular technology comes with a lot of restrictions and regulations geographically. Then you need a data package for your device and possibly a solution like Twilio Super Sim to manage connectivity of your IoT project at scale and support your devices all over the world. This all comes at a pretty high cost.
The next contender in the line is long distance radio technologies like LoRaWan or NB-IoT. It is an emerging space, where you can use low cost radios to communicate over long distances. It involves a gateway, which lets end / node devices connect over radio and provides an interface to the internet. LoRaWan is currently a great way to connect your devices to cloud like AWS over long distances without involving cellular.
It is a great alternative to cellular, but is currently subject to coverage area. In most cases, you may need to install your own gateways to support sensor mesh. This is a great solution for many industrial IoT applications, but might be an overkill for consumer projects.
We’ve covered all the major essentials for you to start your IoT project and there’s only a couple of more left about the tooling, data storage and visualization.
This gets all the magic going. I’ve said it before I’ll say it again. Don’t over complicate stuff and get started with building that prototype of yours. You can deal with a whole lot of projects with Arduino especially those involving the ESP family. Arduino is one of the easiest things to work with because it does not only support a huge number of devices and libraries but has an exceptionally active community where you can get loads of help from.
If you need help from the programming perspective you can always go for PlatformIO which is a state-of-the-art platform for embedded development and it is particularly useful at production. PlatformIO supports a lot more microcontrollers and is a great IDE of choice.
For some advanced use cases, you can also use a RTOS like Zephyr. It provides an OS type abstraction layer, but in my opinion, it is an overkill for most use cases.
Also, if you are interested in continuous delivery and OTA for your IoT project, then using Toit or Particle is a great choice. Toit is very versatile, but you are required to learn the Toit language and the support is very limited at the moment. Particle is a great alternative for OTA, but only supports its own microcontrollers. At this point in hardware, the best work around for OTA is pretty much DIY.
One of the core elements of IoT – other than connectivity – is data storage and distribution. Once you are connected to the internet, you want your devices to securely communicate data, which can be then processed to develop insights to generate alerts.
While we have many options in this domain, like there are tons of cloud providers. Or you can spin up your own MQTT broker and communicate data. But I would recommend using a full stack IoT platform so you can focus on the utility of your IoT project and can quickly change things if you need to instead of getting sucked into unnecessary details every time.
One solution is to use a platform like Particle. It is an industry leading platform and solves a lot of use cases. You can use the cloud platform to store data, build applications, and send over-the-air software updates. But unfortunately, Particle is very limited in terms of hardware support.
The other open core alternative is Grandeur. It is a backend as a service platform and it lets hardware developers securely connect devices to the cloud, store data, and build custom dashboards without provisioning servers and writing custom APIs. Basically, it is Particle, with a lot more support for open source hardware controllers. It is designed to simplify the developer experience (DX) of IoT and support IoT development at the prototyping phase, to product-market fit, all the way to scaling up.
The last and final stage for your IoT project is mostly visualizing your data. Prototyping platforms like Arduino cloud or Blynk can be your go-to solutions but at some point they do not offer you scalability and customization.
We have a lot of options here. We can either use a cloud broker and consume the data with platforms like Retool, Grafana, Datacake or Node Red.
Retool is ideal for building user interfaces. It provides a high degree of customization. It is an app builder. But it sucks with data plotting and graphing. This is where Grafana and Datacake are great options. Node Red on the other hand, is a great open source alternative to Datacake.
This is where I would again recommend using an all in one platform, like Grandeur is not only a great way to store data and connect devices at scale, but you can also use this platform to build custom dashboards and plot data without code.
Summing up all this techy word vomit, I’ll take you back to the basics. Find a problem. Explore the area. Get building. Build an initial prototype. Get that inner geek out and debug and test your product in every way you can. Once done with this, move on to solid prototyping and app building. Give your idea a complete shape and then release it. And don’t release it just like that, use proper platforms for it. Write a tutorial on Hackster, or move onto popular platforms like Kickstarter.
Yes I know it seems like a lot but once you get into this zone, trust me it’ll prove to be a true labour of love and the most privileging and magical experience you’ll have. Build something that’s pure you and disrupt the space.
If you still haven't decided what project to do, here's some guidelines that we've written for you.