This is the #3 post of the IoT series that I am writing, in this article I will talk about microcontrollers, explain what they are, how they work and give examples of some microcontrollers.
What are microcontrollers?
Microcontrollers are small, low-cost, and self-contained computers-on-a-chip that can be used as an embedded systems, they are used mainly in electronic devices, industrial and home automation, smart devices and embedded systems. Microcontrollers usually must have low-power requirements since many devices they control are battery-operated.
Structure and components
Microcontrollers generally follow the same pattern of components and structures, they are:
- CPU(Control Processing Unit) - The brain of the microcontroller, the CPU is responsible to "demand tasks" like fetch, decode, and execute (Harvard architecure).
- Memory - It is used to store data and program. A microcontroller usually has a division between RAM and ROM.
- I/O ports(digital) - These ports are used as interfaces for different appliances like LEDs, LCDs, GPS sensors, etc.
- Serial ports(analog) - These are analog ports, they are used to connect non-digital external components.
- Timers and counters - These are used to manage all the operations of timing and counting in a microcontroller. Its operation is very similar to the clock on personal computers.
- ADC (Analog to Digital Converter) - The main function of ADC is to change the signals from analog to digital.
- DAC (Digital to Analog Converter) - The main function of DAC is to change the signals from digital to analog.
- Interrupt control - The interrupt control used for providing interruption behavior for a working program. This interruption can be either delay or break.
What are the differences between microcontrollers and microprocessors?
Arduino is an example of a microcontroller, as a Raspberry Pi is an example of a microprocessor, both of them can be used for IoT, data collection and automation, but they have differences.
People sometimes confuse microcontrollers with microprocessors, but there are many differences between these micros, so I listed only the key differences and organized them on a table.
|Can perform the most of the daily tasks that a decent computer is capable of doing||Your range is more limited to electronics and sensors, or small systems|
|Based on Von Neumann model||Based on Harvard architecture|
|Large number of instructions to process||Fewer instructions to process|
|Offers built-in monitor/debugger program with interrupt capability||No built-in monitors and requires a manual interruption|
|Consumes too much energy||Perfect for compact systems with low energy consumption|
|Many microprocessors are clocking speeds of up to 4 GHz (faster)||Microcontrollers can operate with speeds of 200 MHz or less (slower)|
How micros works?
A microcontroller processes data given to it’s input pins using it’s CPU and gives output via output pins. It executes or driven by a synchronous sequential logic circuit. The programs are stored temporarily at RAM memory, and executed by the CPU, that involves the external and internal components, based on what is specified in the program, this program that usually is inputted through a cable, that transfers the source code from your PC to the micro.
Top comments (0)