Essential Electronic Modules for Microcontrollers

Those who read the previous article should have a certain understanding of microcontrollers, and many may have asked: What is the purpose of these numerous pins on the microcontroller, which looks like a monster with its claws out?

This article will answer your questions. A microcontroller relies not only on its own program but also on its surrounding companions to work together, leading to the electronic toolbox of black technology enthusiasts— Essential Electronic Modules .

Essential Electronic Modules for Microcontrollers

What is a Module?

What is a module? If you were given a bare black chip, you would surely be at a loss; however, the Arduino I/O board is very user-friendly, providing two rows of sockets that can be directly connected with Dupont wires. A module works the same way; for example, if you need to measure temperature, a temperature sensor chip might leave you feeling overwhelmed. Modules are designed to solve this problem.

Def: Modular Design

To facilitate development and exploration, manufacturers often categorize electronic components by function and package them into a module.

Modules have several advantages:

1. Centered around core chips or sensors, modules come with the necessary peripheral components (usually resistors and capacitors) pre-attached, allowing for direct connection to microcontroller platforms, enabling you to focus more on functionality rather than circuit details.

2. Some chips are too small for convenient development; modules often use a circuit board to house them and come with standard pins for easy connection with wires (Dupont wires), eliminating the need for complex soldering processes.

3. Wireless RF chips have high requirements for peripheral circuits, especially for RF networks and antenna designs. Simply connecting the lines correctly won’t ensure the system operates normally; factors such as line length and component positioning can complicate matters. Modular packaging allows us to avoid these complex underlying issues and enhances the chip’s anti-interference capability.

Essential Electronic Modules for Microcontrollers

The left image shows a USB-to-serial module

The front USB port connects to the computer

The rear pin header connects to the microcontroller

Realizing communication between the two

Essential Electronic Modules for Microcontrollers

Using a breadboard and Dupont wires to connect

The development board and peripheral components

With modular design, we can easily add various peripherals to the microcontroller. Typically, a module is a small circuit board with various components pre-soldered. The edges will have one or more rows of pin headers, which need to be connected to the Arduino development board or directly inserted into a breadboard.

What to do if the wires are overwhelming?

In the Arduino ecosystem, there is a more user-friendly design—modules are designed as an expansion board, known as Arduino Shields.

The expansion board is about the same size as the Arduino development board, with the bottom pins aligning perfectly with the sockets on the Arduino core board, allowing for direct stacking without the need for wires, making it extremely convenient.

At the same time, the upper corresponding positions on the Shield expansion board will provide a row of sockets for stacking more expansion boards or connecting other pins, eliminating concerns about one expansion board occupying all the pins.

Essential Electronic Modules for Microcontrollers

Example: Network expansion board (Ethernet Shield) equipped with the W5100 chip can connect the Arduino platform to the network via Ethernet

Essential Electronic Modules for Microcontrollers

When they “combine,” they look something like this

Stackable Design

You can also stack modules madly

Essential Electronic Modules for Microcontrollers
Essential Electronic Modules for Microcontrollers

Commonly Used Modules in Electronic Production

1. Temperature and Humidity Sensor

Essential Electronic Modules for Microcontrollers

Many beginners in Arduino like to start by making a thermometer. How can the microcontroller “sense” the temperature and humidity of the environment? At this point, the sensor “hero” comes to the rescue; sensors can convert various physical quantities (temperature, pressure, light intensity, mass, etc.) into electrical signals, allowing the microcontroller to receive and process them.

Temperature and humidity sensors come in various types and are widely used. For measuring air temperature and humidity, there are compact, highly integrated sensor modules available on the market, with a single module capable of providing two or even three physical measurements at a high level of accuracy. Common ones include:

Essential Electronic Modules for Microcontrollers

DHT11

(Digital, Temperature and Humidity Combined)

1

Essential Electronic Modules for Microcontrollers

DS18B20

(Digital, Temperature)

2

Essential Electronic Modules for Microcontrollers

Hey, did we have a traitor among us?

What about the “analog” LM35?

The previous ones are all digital types, which output digital signals directly processed by the microcontroller. Just connect the wires, and in the Arduino program, reference the corresponding library to read the data directly, and it’s done. But the LM35 requires a bit more work… Don’t worry, let me briefly introduce digital signals and analog signals.

Introduction: Digital Signals, Analog Signals, and ADC

The advantage of a microprocessor lies in its ability to recognize and process digital signals, but the real world we live in is not digital; it cannot be simply represented by 0 and 1. For instance, the concept of temperature can continuously change within a range and cannot instantaneously jump from 0 to 1; such physical quantities are referred to as analog.

Essential Electronic Modules for Microcontrollers

Analog Signal: Smooth and Continuous

Digital Signal: Only two states of high and low levels

The voltage can vary continuously, which is an analog quantity and cannot be understood by the microprocessor; therefore, it must first be converted to a digital signal through an ADC for further processing.

Essential Electronic Modules for Microcontrollers

When performing ADC voltage conversion, a reference baseline is needed to compare the voltage to be measured with the reference voltage to obtain a ratio value.

Taking the ATmega328p microcontroller on the Arduino UNO development board as an example, it has several 10-bit ADCs, meaning it can read states. The input voltage range allowed on the ATmega328p is 0~5V, so the smallest voltage change it can sense is 4.9mV.

When performing ADC conversion, if the reference voltage is set to 5V (usually the system operating voltage unless specified otherwise), the input voltage of 0~5V corresponds to an integer output of 0~1023.

For example:

When measuring a voltage of 2.12V on a 10-bit ADC with a reference voltage of 5V, the ADC output would be 434.

The accuracy of the ADC conversion process is influenced not only by the quality of the ADC device (resolution, etc.) but also by the accuracy of the reference voltage, environmental conditions (such as temperature), and circuit design.

Having said all this, to summarize simply, the signal output by the LM35 is just a voltage level that needs to be converted.

Moreover, performing ADC conversion on Arduino is also a meticulous task—look closely at the Arduino development board, and you will find several pins marked with 【ANALOG IN】, indicating analog input channels.

Not every pin can accept analog signals; the ADC channels corresponding to the Arduino microcontroller are limited, and they must be connected to these pins to enable the built-in analog-to-digital converter. Next time you connect the LM35 or other analog input components (like a potentiometer), if it doesn’t work, remember to check whether it’s connected to the analog channel.

Essential Electronic Modules for Microcontrollers

The Arduino UNO board has six analog channels numbered from 0 to 5

2. LCD Module

Essential Electronic Modules for Microcontrollers

Display screens are the most intuitive way for microcontrollers to display information, and the commonly used ones are black-and-white character LCD modules. Typically, these modules are named by the number of columns and rows, for example, the widely seen 1602 LCD has 16 columns and 2 rows.

1602 LCD Module

Essential Electronic Modules for Microcontrollers

Faintly visible 16×2 black square

Essential Electronic Modules for Microcontrollers

With so many pins at the upper left, isn’t wiring quite troublesome?

Yes, it is indeed so.

This is a parallel connection method; apart from power, backlight, control signals, etc., eight wires (D0~D7) are needed for data transmission. However, these eight data lines are not necessary; in fact, only the first four (D0~D3) are sufficient for it to work. However… on the Arduino UNO with limited pins, using six or seven pins for one display is quite painful; how can we elegantly connect other modules?

Don’t worry, there’s another trick!

Convert to I2C serial connection, requiring only two wires!

Yes, you heard it right, just two are enough;

The key point is that the I2C bus supports connecting many devices on these two wires, distinguished by their addresses. (To illustrate, a neighborhood has only one road, and the buildings on both sides are distinguished by their house numbers) Mom no longer needs to worry about insufficient pins!

Essential Electronic Modules for Microcontrollers
Essential Electronic Modules for Microcontrollers

Serial bus conversion module

Left lower pin connects to the microcontroller, right lower pin connects to the LCD module

3. Motor Driver Module

Essential Electronic Modules for Microcontrollers

Those with dreams of building a car hope to control their own smart car with a microcontroller as soon as possible. Whether for competitions or just for show, it’s all about style. The core components of a smart car are undoubtedly the wheels and motors that drive them; powerful motors can help it “overcome obstacles”.

To control the motion, stopping, direction, and speed of the motor with a microcontroller, should you connect the motor wires directly to the microcontroller pins?

No, absolutely not; the microcontroller’s “small body” simply cannot handle it.

We know that microcontrollers focus on signal processing and are not good at power output for high currents. The current that different microcontroller models can handle varies, but most do not exceed 100mA. Motors draw significant current when starting, and there is self-induction when stopping; directly connecting them to the microcontroller would surely burn it out.

What to do? “Using minimal effort to achieve maximum effect,”the motor driver module comes to the rescue.

Essential Electronic Modules for Microcontrollers
Essential Electronic Modules for Microcontrollers

Motor driver expansion board (Motor Shield)

This is a type of motor driver module; how to use it?

Simply stack it on the Arduino core board. However, since the motor’s power is quite large, the built-in power supply is insufficient to support it, so it must be connected to an auxiliary power supply (the blue terminal on the lower left).

The large black chip in the middle is the driver chip, which can handle a certain amount of current passing through it; the colorful connectors above are used to connect motors, supporting regular DC motors, stepper motors, servos, etc. With the driver board, the microcontroller only needs to send a small signal, and the large motor can start moving.

Essential Electronic Modules for Microcontrollers

There are not just one type of motor driver module; look at this big one, the driver chip also comes with a thick heat sink, indicating it has powerful driving capabilities.

Essential Electronic Modules for Microcontrollers

4. Ultrasonic Distance Measuring Module

Essential Electronic Modules for Microcontrollers

Safety is essential while driving; to prevent collisions with surrounding obstacles, the car needs a pair of

Leave a Comment