We continue to talk about microcontrollers.
In this article we will look at the controllers and microcontrollers, discuss their types and will learn how to work with them, based on real life cases of using microcontrollers for a number of purposes: quests in real life, smart home, industrial electronics and consumer electronics.
In the era of information technology we are surrounded by devices, such as mobile phone, TV, or coffee maker. All of these are managed by the controllers, which have become an integral part of digital technology.
Controller —is a managing device in electronics and computer engineering, usually in form of an input/output board, with one or multiple microcontrollers and additional elements needed for correct operation and communication with other devices.
So what is a microcontroller? The most basic concept of microcontroller (further on an MC)– is aprogrammable device, designed to manage electronic devices.
MC is a crystal that usually combines the functions of a computation core, memory and peripheral devices such as timers, counters, reed switches, buttons, sensors, etc. In fact, it is a single-chip computer capable of performing relatively simple tasks. Therefore, a microcontroller is the "brains" of the entire system, analysing incoming information and giving commands to other devices.
The picture illustrates different microcontrollers from Atmel company. As you can see, they come in different sizes and with different number of outputs different characteristics.
The microcontroller performs tasks according to a special in-built algorithm, or the program. This program is written in one of the programming languages and in most cases can be modified. However, in order to alter the program in the microcontroller special device is needed, called programmer.
Writing a program and its installation is a complex and time-consuming process. Not everyone can cope with this.
So how do you make the microcontroller do what is required, if you do not have any specific knowledge in this area? For example:
- You want to force a lock to open upon pressing four buttons in a certain sequence.
- You want a microcontroller to send a signal (the 12 volts pulse for 0.5 seconds) upon reaching a temperature of X degrees.
- You need some electronics for a quest room to define a unique location of objects or to detect the noise level.
A special hardware and software were created so that non-expert users could cope with these tasks. Such hardware and software are designed to help building systems of automation and robotics. So, even you have no understanding of electronics at all, you could easily understand and use microcontrollers in your work.
A great number of companies produce such platforms these days. Among the most famous are Arduino and Raspberry Pi.
Let's take a look at the similarities and differences between them and try to understand which one you should choose.
The picture illustrates two most popular single-board computers Arduino Uno R3 and Raspberry Pi model B.
Both Arduino and Raspberry are suitable for beginners. Sizes of these boars are similar, but this is the only thing they have in common. A thorough analysis of hardware and software demonstrates that they are designed for different kinds of projects.
The first thing to mention is the fact that Raspberry Pi is a full-featured PC, while Arduino is a microcontroller with a simple connection to the PC. Clock frequency of Raspberry Pi is 40 times faster and has 128 000 times more of RAM than Arduino. Besides, it is possible to run the Linux operating system, which supports multitasking, peripheral devices can be connected to the USB ports and a regular monitor can be connected to the HDMI output socket. Thus, from the software capabilities point of view, Raspberry Pi exceeds Arduino.
But does it really matter if the system is too complicated and doesn’t help solve simple tasks? Let us consider the advantages of the Arduino.
In comparison to Raspberry Pi, Arduino is much more efficient in reading and processing analogue signals. Due to this fact, it can interact virtually with any sensor or chip.
Arduino requires less power. The board uses a voltage regulator, so the input can be from 7 to 12 Volts, which is an advantage. Raspberry Pi Board has no stabilizer, so it cannot do without a power filter 1 Ampere.
Thanks to its simplicity, Arduino can be turned on and off any time. This is why it is easier to break a board of Raspberry than Arduino, since a proper shutting down is required, which is not always convenient.
Now, let’s discuss different types of boards. Let us start with Arduino.
Arduino was created in Italy and this is where original boards are produced. From time to time, the company releases a new board, and at the moment there is a great variety of them. This is where we will start our review.
Original boards are available in several form factors; each of these includes multiple circuit boards.
Comparative characteristics of the most common original Arduino boards:
Arduino form factor is the most common one; it has a standard size and is fully compatible with all shields– special expansion boards. At the moment only two boards are available: Arduino Uno and Arduino Leonardo. The difference between them is that Leonardo is built on the basis of a single ATmega32u4 chip, which shares communication channels with USB and UART. Simply put, this board allows to simultaneously transfer data to a computer over USB and UART communication from any sensor.
Arduino Mega is essential if you plan using many outputs, both analogue and digital, in other words, a large number of connected sensors or other devices. The main feature of Arduino ADK Board is a USB host, which allows you to connect an extra USB device directly. If you plan to use shield cards with this form factor, you need to be careful as not all shields (shields for Arduino) are compatible.
Arduino Nano and Arduino Mini are distinguished by their smaller size and therefore are used in compact devices, which don't need serious computing. Arduino Mini does not even have a USB port for PC connection. It is worth paying attention to if you don't have the adapter USB – Serial.
Since the Arduino project is completely open, many companies copy and modify a board. Therefore, there is a huge variety of Arduino – like boards. Some of them completely imitate the functionality of the original, while some are only slightly similar to the source and are completely not compatible with original shields.
Among the well known "clones" of the original there are some well-known boards such as Freeduino, Seeduino, and other CraftDuino.
A variety of Raspberry Pi is not that impressive. At the moment, there are five versions. The comparative characteristics of these versions are summarized in a table below.
As it is illustrated by the table, models «A», «A+», «B» and «B+» differ only by the number of ports for connecting peripherals, be it the sensors or the USB device. The latest model of Raspberry Pi "2B" greatly surpasses the previous one in terms of performance due to the Quad core processor ARM Cortex - A7 Broadcom 1Gb of operation memory.
So, what conclusion can be made? The choice between Raspberry Pi or Arduino depends on the project. A complex system capable of multitasking is needed? You should opt for Raspberry PI. Or, you are going to take down sensors data in different places of the quest and do not want to overpay for unnecessary functions? Do not hesitate to go for the Arduino.
Here are a few practical examples:
1) For example, your intention is to create a weather station, showing temperature, humidity, and perhaps something else. In other words, you need to control a monochrome display and display information from analogue sensors. It would be a good idea to use the Arduino shield and LCD display (add-on with LCD display), because Arduino provides the easiest and the most correct communication with sensors, and displaying of some basic information does not require a lot of computing power. Therefore, the use of powerful and expensive board from Raspberry family is not a advisable. Of couse, Raspberry could also cope with this task, but it is economically unreasonable.
2) You need to quickly make a combination lock that will be opened when you press a certain sequence of buttons? Arduino will do it in a moment.
3) You want to build a device to measure the of boxes in two dimensions (laser or ultrasonic distance sensors)? Again, Arduino will help you.
4) You want to build an "intelligent" robot with a functional touch screen to control all devices? Or do you want to play videos and view images with music will playing in the background? Arduino would not cope with this task, so choose Raspberry.
5) Want to make a command centre or server, which embeds 2-3-4-5 colour LCD displays, playing various videos when certain events occur? Only Raspberry can cope with this.
Despite the fact that a world of controllers may look complicated, any task can be broken into stages to help understand all the signals and data. Microcontrollers allow us to structure and manage imformation flow.
Hopefully, this article helped you gain a better understanding of microcontrollers. We wish you luck in your ventures!
If you have any questions or comments on this article, please email us. We would be happy to help.
In the following articles we will talk about real cases that we solved with microcontrollers.
Kind regards, EcoDecor team