What are the Best Platforms for DIY IoT and Smart Devices?
Updated on 31st Aug 2020 20:28 in DIY, IoT, Smart
If you like to do things your self, it's possible you've thought of creating a smart or Internet of Things (IoT) device that responds to your specific needs. While there exist many commercial options that have come down in cost significantly in the last few years, there are cases where none of these will work well enough for what you need. Sometimes you might also just want to have some fun and build the solution your self, after all, that's what DIY is all about.
One question that might come up is: great, I'm ready to build my own smart device - but what controller do I use? There are many possible answers to this question, but today we're going to cover some of the most popular options that also provide the best ease of use. Note that controllers that are specially made to be smart devices haven't been included because while they may offer easier IoT integration, they have smaller communities and often cost more.
Table of Contents
The difference between Microcontrollers and Microprocessors
At first, the two may seem similar, but they are actually quite different in a few ways that make them distinct. The most significant difference between the two is that typically a microcontroller contains all of the things it needs to operate (such as RAM, EEPROM, ADC) within the chip its self. A microprocessor however typically has all of the components on a board that it's mounted to - just like how your desktop or laptop computer has a motherboard with the RAM, and hard drive attached directly to it.
System on a Chip (SoC) has made this distinction a bit more complicated. The idea of an SoC is to package everything needed to run a typical processor within a single chip, just like the microcontroller. In fact, one of the most popular SoCs is the Raspberry Pi - which features most of the RAM, GPU, audio chips within a single package that most will refer to as "the processor".
Some differences between a microcontroller and an SoC board
|Device||Operating System||Programming||External Components||Timings|
|Microcontroller||Bare metal (no OS)||Can be difficult; must directly interface with the processor||Code must directly interface with any external components||Can very accurately time the execution of tasks|
|Microprocessor (SoC)||Linux or other embedded OS||Plenty of libraries available to make complex tasks much easier||OS drivers often exist for any connected component, making interfacing easier||OS can interrupt any running task; difficult to time things correctly in real-time scenarios|
In the case of anyone looking to build an IoT device themselves, the decision of going with a microcontroller or a microprocessor will often come down to the required level of processing power. Does your project need a full operating system to function? If not, you are likely better off with a microcontroller simply because they are a lot less expensive. Additionally, multiple copies of the same smart device are often needed - as is the case with intelligent bulbs or lamps - which means that a lower price presents a lower barrier to entry.
Microcontrollers for IoT devices
Microcontrollers are great for creating smart devices primarily because they are relatively simple compared to a full-fledged computer, and can often be found for some low prices. I personally have always used a microcontroller in one way or another to create the smart devices I use, and they've never failed me.
The classic microcontroller that seems to have been around forever. This is a solid choice when it comes to any DIY project. From its a massive community of users that have answered countless questions and provided thousands of libraries, to it's easy to use IDE - Arduino has always been a strong player in the microcontroller industry. In the world of DIY smart devices; however, it starts to have a harder time keeping its title as the best option.
- The Arduino comes in so many different sizes and layouts that there is almost a board for every use case - and that's without counting all of the clone boards that aren't officially considered to be "Arduino" but still use the ATmega chip.
- Arduino's IDE is easy to use and has countless libraries developed for it.
- Seemingly endless supply of online tutorials
- Can be quite expensive. Uno is currently listed at around 23$ per board on the official store. Clones may offer a lower price, but they also aren't technically "Arduino".
- No network capabilities built-in. This is huge for IoT and smart devices, they must WiFi or a LAN connection to be useful - but the Arduino comes with none of those unless you are going to spend more money on a YÚN board or a shield.
- Other than the Nano, the boards can be quite large as well. This can be a problem if they will be used in smaller devices.
- RAM and flash memory are a bit small for IoT uses. The libraries required to do any IoT work will quickly use up a lot of the available memory, leaving little for your actual program.
A relative newcomer to the market, with its first appearance in the west, only being in 2014 - with the ESP-01 module. This device was marketed as a WiFi microchip for use with another microcontroller such as an Arduino. Even this device can actually do a lot more than just serve as a WiFi chip, it can be programmed just like any other microcontroller.
The specific version I will be talking about is the "Nodemcu" version, which is a version of the ESP that is designed for development. Merely looking up "ESP8266 Nodemcu" should return many results and the boards will likely look the same. It's worth noting that Nodemcu is the name of the firmware that's preloaded onto the board to allow users to program IoT devices with their Lua framework - though I've personally never used this approach.
- Much cheaper than other options, I managed to find 5 of these boards for the price of a single Arduino.
- Includes a WiFi stack out of the box
- The development board is quite small.
- The onboard memory is huge with 128KB RAM and 4MB of flash memory. That's compared to the Arduino Uno's 2KB RAM and 32KB of flash memory.
- Less popular, smaller community and less online tutorials
- Runs on 3.3 volts instead of the 5 commonly used (this can be a pro depending on your use case)
- Can have some cryptic error messages when things go wrong, even when using the exception decoder.
Embedded computers for IoT
Sometimes a microcontroller just can't offer enough power for the project you have in mind. Things like processing a video feed from a camera or running complex programs are better suited for computers that run a full instruction set like ARM or Intel's x86. There are a lot of options in this space, but it is essential to recognize that the price of miniature computers can not be directly compared to those of microcontrollers because they do not serve the same purpose.
It has long had the title of being the most popular single-board computer, and there's an excellent reason for that. The Pi's focus on being accessible to hobbyists and regular people has sent it to the top when it comes to cheap computers. When it comes to IoT, the Pi has had built-in WiFi since the Pi 3, which means it is easily able to be used for smart device construction.
- Offers a complete operating system, such as Linux.
- Can efficiently perform advanced tasks like video encoding
- Uses an SD card for storage, allowing for substantial program sizes
- Has up to an insane 8GB of RAM
- Can be quite expensive for IoT, where each board will cost around 50$ for the 2GB version.
- Requires a lot of power - the recommended power supply is a 3A wall charger!
- The OS ultimately has control over the device, and as such, you lose the ability to finely tune things.
- GPIO pins can be a pain to work with and don't support analogue inputs - an external board is required to read sensor values other than on or off.
This is Arduino's version of a single board computer. Calling this device a single board computer is not totally fair though since it features both a microprocessor and a microcontroller. This means it gets to run Linux while also having the same benefits (and drawbacks) of the regular Arduino. The way they handle this is by running the sketch uploaded from the Arduino IDE on the microcontroller and running Linux on the microprocessor that is found on the same board.
- Offers a complete Linux operating system.
- Completely compatible with Arduino libraries.
- Onboard WiFi.
- The pinout is similar to other Arduino boards, analog pins offered by default.
- Suffers from many of the same problems the Arduino does for IoT
- Same memory limitations as the regular Uno, but with the Linux processor having 16MB of memory and 64MB of RAM
- Can be expensive for IoT purposes, costing around 55$ at the time of writing
I've tried quite a few things for building my own smart devices, and my pick ended up being the ESP8266 most of the time. I rarely need the processing power offered by a device like the Raspberry Pi (which I find to be very expensive for a single device), and even the Arduino had too many issues for me to stick with it.
I originally got an ESP8266 to add WiFi to my Arduino project, but it didn't take long for me to realize that the ESP8266 can be used to do almost everything that any other microcontroller can do. Its lower price, higher memory capacity and the fact that it can be programmed using the Arduino IDE are what keeps me buying the ESP.
If you're building a smart device, there really is no shortage of options when it comes to what controller you can use. The most important thing is that the board you use can do what you need it to do without requiring a ton of extra hassle. Some of the biggest issues we saw were the high price of a lot of these boards - in fact, boards that feature a processor are on average more expensive than some of the commercial versions of the finished smart products we are trying to DIY!
That said, don't buy a Raspberry Pi or a YÚN for an IoT project unless you know it's necessary. Things like measuring a sensor's value or running a motor do not require complex processors, and you're better off spending that money on the rest of the project.