Before we go further, it is good to have an understanding of how a microcontroller and a microprocessor are different:
Microprocessor |
Microcontroller |
Only CPU; other peripherals are interfaced via the CPU bus |
CPU + (Flash) Memory + RAM + ROM + I/O + Timers + UARTS + ADC + DAC and so on on a single chip |
General purpose |
Single purpose |
High processing power |
Low processing power |
Power hungry |
Can work on a battery |
Runs an OS (for example, Linux) |
Runs on a tight loop approach and can support OSs such as Real Time Operating System (RTOS) |
In a typical IoT scenario, smart devices do only one job, for example reading the door sensor data and sending it to the cloud. For this kind of a solution, a microcontroller with a network module is quite sufficient.
But if we want to run an edge node as a smart device, then we need to have more processing power and that is when we turn to a microprocessor.
The following diagram explains the architecture of a smart device that is driven by a microcontroller:
The simplest example of an MCU is Arduino (https://www.arduino.cc/) and a network module example is Espressif ESP8266 (https://www.espressif.com/en/products/hardware/esp8266ex/overview).
This is the most common architecture for hardware in IoT. The three blocks that are shown are replaced as per the solution. We will look at each of the blocks in the next sections.
On the other hand, a microprocessor runs an OS, which has defined network interfaces and a communication module that come on a single board. For example, the Raspberry Pi (https://www.raspberrypi.org/products/).
In this book, we are going to use Raspberry Pi as the smart device for our examples.