What is a microcontroller?
You might be asking yourself what is a microcontroller and what does it do?
A microcontroller is a computing device capable of executing a program (a sequence of instructions) and is often referred to as the “brain” or “control center” in a robot since it is usually responsible for all computations, decision making, and communications.
In order to interact with the outside world, a microcontroller possesses a series of pins (electrical signal connections) that can be turned HIGH (1), or LOW (0) through programming instructions. These pins can also be used to read electrical signals (coming form sensors or other devices) and tell whether they are HIGH or LOW.
Most modern microcontrollers can also measure analogue voltage signals (i.e. signals that can have a full range of values instead of just two well defined states) through the use of an Analogue to Digital Converter (ADC). By using the ADC, a microcontroller can assign a numerical value to an analogue voltage that is neither HIGH nor LOW.
Although microcontrollers can seem rather limited at first glance, many complex actions can be achieved by setting the pins HIGH and LOW in a better way. Nevertheless, creating very complex algorithms or very large programs may be simply impossible for a microcontroller due to its inherent resource and speed limitations.
For instance, in order to blink a light, one could program a repeating sequence where the microcontrollers turns a pin HIGH, waits for a moment, turns it LOW, waits for another moment and starts again. A light connected to the pin in question would then blink indefinitely.
In a similar way, microcontrollers can be used to control other electrical devices such as actuators (when connected to motor controllers), storage devices (such as SD cards), WiFi or Bluetooth interfaces, etc. As a consequence of this incredible versatility, microcontrollers can be found in everyday products. Practically every home appliance or electronic device uses at least one (often many) microcontroller. For instance TV sets, washing machines, remote controls, telephones, watches, microwave ovens, and now robots require these little devices to operate.
Unlike microprocessors, a microcontroller does not require peripherals such as external RAM or external storage devices to operate. This means that although microcontrollers can be less powerful than their PC counterpart, developing circuits and products based on microcontrollers is much simpler and less expensive since very few additional hardware components are required.
It is important to note that a microcontroller can output only a very small amount of electrical power through its pins; this means that a generic microcontroller will likely not be able to power electrical motors, solenoids, large lights, or any other large load directly. Trying to do so may even cause physical damage to the controller.
Although it is possible to manually implement these protocols, it is always nice to have dedicated hardware built-in that takes care of the details. It allows the microcontroller to focus on other tasks and allows for a cleaner program.
Analogue-to-digital converters (ADC) are used to translate analogue voltage signals to a digital number proportional to the magnitude of the voltage, this number can then be used in the microcontroller program. In order to output an intermediate amount of power different from HIGH and LOW, some microcontrollers are able to use pulse-width modulation PWM. For example this method makes it possible to smoothly dim an LED.
Finally, some microcontrollers integrate a voltage regulator in their development boards. This is rather convenient since it allows the microcontroller to be powered by a wide range of voltages that do not require you to provide the exact operating voltage required. This also allows it to readily power sensors and other accessories without requiring an external regulated power source.
No comments:
Post a Comment