What is Microcontroller(MCU) used in embedded systems?

To master embedded systems, it is important to acquire knowledge and experience in using the microcontrollers. This chapter describes the basic structure and applications of microcontrollers.

Basic microcontroller configuration

A microcontroller is also called a one-chip MCU because it contains a CPU, memory, input/output circuits, and peripheral functions in a single IC chip.

MCU

The name "MCU" was originally derived from the abbreviation for "microcomputer," which was used to refer to large computers such as supercomputers in an era when PCs were not as widespread as they are today. In contrast, what is now called a MCU is a single-chip IC specialized for controlling electrical devices and is appropriately called a "microcontroller".

An all-in-one IC has a CPU that executes calculations, ROM memory that stores programs, RAM memory that temporarily stores calculation data, a timer function that counts externally given pulse signals and measures time, an AD converter that takes analog signals from sensors and processes them, a DA converter that converts calculated data into analog signals, and peripheral functions such as communications with external devices. I explain the details in next section "Basic knowledge around Microcontroller for Embedded engineers"

All of these functions are built into MCU in a single package, and all of the arithmetic processing is much faster and more powerful than at the time.

If you know the basics of MCUs, you can build a small system as soon as you think of it, in a short time and at a low cost.
When there is a change in function specifications, all hardware components such as electric circuits need to be rebuilt, but software components only need to be reprogrammed.

In other words, the larger the percentage of software in a product, the more flexible it is to respond to changes in specifications. This tendency is strongly manifested in recent smartphones.

Cell phones of long ago are also a type of embedded device, but they are operated by hardware button switches. Even minor changes in design and other specifications require a complete rebuild.
In contrast, smartphones are operated by touch panels, so there is no need for hardware such as button switches.

Colum

A touch screen is also a type of embedded device that includes MCU and memory. The screen design is stored in memory, and MCU detects the coordinates of the touch screen being pressed and switches the screen or functions as a switch in a procedure configured by a program (software).

Since design and other functions can be incorporated into a single touch screen, changes can be made at will simply by rewriting the software. In this way, the number of switches in smartphones is decreasing and software is accounting for a larger proportion of the total number of switches.

The advantage of having fewer hardware switches is that the cost can be significantly reduced, but has the ease of use really improved from the user's point of view? But from the user's point of view, has it really become easier to use?

Microcontroller Applications

Where are MCUs used in our daily lives? MCUs are used in almost all household appliances, such as rice cookers, air conditioners, televisions, smartphones, and ceiling lights.

 Rice cooker with MCU: 

Let's look at the relationship between rice cookers and MCUs.
A rice cooker cooks rice by adjusting the amount of water in the rice cooker and the amount of heat to cook the rice properly.

  1. Rinse the rice and set the kettle for the proper amount of water.
  2. Start cooking rice over medium heat.
  3. Bring to a boil and turn off heat when appropriate.
  4. Steam for a certain period of time

When rice is cooked by hand, the key to delicious rice is to adjust the heat and time properly. Electric rice cookers consist of a timer, a sensor such as a bimetal that detects temperature, and a heater that heats the rice.

Electric rice cookers without MCUs can now cook rice fully automatically using a timer, which is very convenient compared to cooking rice by hand, but the simple functionality does not allow the cooker to cook rice to the desired degree.

In contrast, a MCU-equipped rice cooker has a MCU between the temperature-sensing sensor and the heater for heating. The amount of heat to the heater is controlled by switching elements such as relays and SSRs operated by the MCU output.

As a system, the input information obtained from the temperature sensor is programmed in the MCU (software) to adjust the output to the heater to achieve the optimum heat level.
The actual system configuration of a rice cooker using a MCU includes a temperature sensor and start switch for input, a heater for output, and a monitor that displays the operation status of the rice cooker.
The program (software) by the MCU diversifies the functions and allows the cooker to cook various types of rice to the desired degree.

Colum

As a side note, in order to cook really tasty rice, not only the programmed functions but also the performance of the hardware, especially the output heater and the material of the pot, are important. An excellent product is one that has a good balance not only of functions with excellent software but also with excellent hardware.

 MCU-based switch function: 

Next, let's take a look at the MCU-mounted example with the operation of the switch.

Switches in electrical products mechanically connect and disconnect contacts to directly conduct or isolate the current in a circuit, switching the product function on and off.

In the case of an electrical product with a MCU, if a mechanical switch is connected to the MCU input and output functions as a switch, it can be programmed not only to turn on or off, but also to perform various functions, such as a long press, by combining it with time.

In this way, the switch looks like a conventional mechanical single-function switch, but it is transformed into a switch with multifunctional characteristics.

For example, let's look at a circuit in which an LED is turned on by a switch.
In the case of an analog LED circuit, it is a simple circuit (Figure 1) that emits light when the switch is turned on and turns off when the switch is turned off. A similar circuit can be realized with MCU as shown in Figure 2.

The switch shown in right side is a so-called digital signal that provides an ON state (1) and an OFF state (0) as inputs to MCU. By checking this input status with MCU and processing it in some way, we can make any output, i.e., any LED light, turn on at will.

Colum

In circuits using MCUs, the way LEDs are turned on and the switch functions are all programmed. The convenience of MCUs is that it is easy to realize operations such as pressing and holding a switch for 1 second, turning the light on for 10 seconds, and then automatically turning the light off.

Follow me!