Understanding Arduino: A Beginner’s Guide to Arduino and Microcontrollers

Readers who work with microcontrollers must have heard of Arduino or even used it, but many still do not understand what Arduino is. Today, we will briefly describe Arduino-related content for beginners.

1. Introduction to Arduino

To understand Arduino, one must first understand what a microcontroller is. The basis of the Arduino platform is actually the AVR instruction set microcontroller.

1. What is a Microcontroller?

A working computer consists of several parts: Central Processing Unit (CPU) for computation and control, Random Access Memory (RAM) for data storage, Read-Only Memory (ROM) for program storage, and Input/Output devices (I/O) such as serial and parallel ports. In personal computers (PCs), these parts are divided into several chips installed on a printed circuit board called the motherboard. In a microcontroller, all these parts are integrated into a single integrated circuit chip, hence the name microcontroller (single-chip). Some microcontrollers also integrate other components such as Analog/Digital (A/D) and Digital/Analog (D/A) converters.

2. What is the Use of a Microcontroller?

Not every situation requires high performance, as the saying goes, ‘There is no need to use a sledgehammer to crack a nut.’ Imagine a voice-controlled light using an Intel i7 processor; its cost-performance ratio would be extremely low. The key to application is whether it is sufficient and has a good performance-to-price ratio, which is where microcontrollers fill the gap well.

So, what is Arduino?

Arduino is a convenient and flexible open-source electronic prototyping platform that includes hardware (various models of Arduino boards) and software (Arduino IDE). It is suitable for artists, designers, hobbyists, and anyone who wants to tinker. Its features include a simple shape that can interact with people, and even a ten-year-old child can use it to create what they want. Arduino can sense the environment through various sensors and respond by controlling lights, motors, and other devices to influence the environment. The microcontroller on the board can be programmed using Arduino’s programming language, compiled into binary files, and uploaded to the microcontroller. Arduino-based projects can consist solely of Arduino or include other software running on a PC that communicates with Arduino (e.g., Flash, Processing, MaxMSP).

2. Types of Arduino

There are numerous Arduino boards available on the market. Leaving aside the original factory’s dozen or so, there are thousands of various Arduino types available online, making it quite overwhelming for beginners. Choosing the right Arduino for a project is half the success; let’s take a look at the most common Arduino boards and how to differentiate them.

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers
Arduino Mega

To differentiate among so many boards and choose the right Arduino, mainly consider the following three aspects: performance, features, and size.

First, look at performance, which includes processor memory, clock frequency, and bit width. The hardware processing capability usually depends entirely on the chip of the board, which also limits the software that can run.

Next, consider features, which include everything on the board except the microprocessor, such as input/output pins, integrated components (buttons, LEDs, motor drivers, etc.), and the types and numbers of available interfaces (USB, Ethernet, etc.).

Finally, consider size. Due to the nature of different projects, the size and weight allocated for the electronic components can vary greatly. For example, if you want to make a tracker for a dog, using a Mega board with a battery pack and expansion board would result in a size of at least 10*5*5cm and a weight of 200g. Is this a tracker or a sandbag? This is why Arduino has so many siblings.

Having said so much, let’s take a look at some mainstream Arduino boards.

1. Arduino Uno

Processor: ATmega328 (8-bit CPU, 16MHz clock frequency, 2KB SRAM, 32KB flash memory)

Features: 14 digital I/O pins, 6 analog input pins, replaceable processor design

Size: 75 x 55mm

Price: $30

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

2. Arduino Leonardo

Processor: ATmega32u4 (8-bit CPU, 16MHz clock frequency, 2.5KB SRAM, 32KB flash memory)

Features: 20 digital I/O pins, 12 of which can serve as analog pins, native USB support

Size: 75 x 55mm

Price: $25

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

3. Arduino Due

Processor: Atmel SAM3X8E ARM Cortex-M3 (32-bit CPU, 84MHz clock frequency, 96KB SRAM, 512KB flash memory)

Features: 54 digital I/O pins, 12 analog input pins, 2 analog output pins, native USB support

Size: 100 x 55mm

Price: $50

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

4. Arduino Micro

Processor: ATmega32u4 (8-bit CPU, 16MHz clock frequency, 2.5KB SRAM, 32KB flash memory)

Features: 20 digital I/O pins, 12 of which can serve as analog pins, native USB support

Size: 50 x 18 mm

Price: $27

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

5. LilyPad Arduino

Processor: ATmega328 (8-bit CPU, 16MHz clock frequency, 2KB SRAM, 32KB flash memory)

Features: 14 digital I/O pins, 6 analog input pins

Size: 50mm diameter circular

Price: $22

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Of course, there are many more, but we won’t list them all here; interested readers can learn more on their own.
3. Installing Arduino IDE
Download link:
https://www.arduino.cc/en/Main/Software

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Three major operating systems: Windows, Mac, and Linux are all supported; you can choose to download according to your situation.
The installation process will not be detailed here; basically, you just need to click “Next” all the way through. If you cannot install it, I think you are not a qualified developer.
4. Understanding Arduino IDE

The purpose of this small experiment is to light up the LED on pin 13 of the Arduino UNO board for one second, then turn it off for one second, and keep repeating.

Now, let’s assume we are using the Arduino UNO control board (recommended for beginners due to its stability), and we have already set up the Arduino development environment and installed the USB driver as per the steps above.

1. Connect the Arduino control board to the computer

Plug one end of the USB cable into the Arduino control board and the other end into the computer’s USB port. (Note: When working independently, the Arduino control board can be powered either from USB or using a power bank or adapter.)

Connect the Arduino control board to the computer

Open the Arduino IDE, and the editing interface of the Arduino IDE will appear.

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

2. Understanding Arduino IDE

Let’s take a brief look at this Arduino compiler, as we will be interacting with it frequently in the future.

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Arduino IDE is the software editing environment for Arduino products. Simply put, it is where you write and download code.

Any Arduino product needs to download code before it can operate.

The hardware circuit we built assists the code in completing tasks; both are indispensable. It is like how a person controls their limbs through the brain. If the code is the brain, the peripheral hardware is the limbs, and the activity of the limbs depends on the brain, so the hardware implementation depends on the code.

The basic functional areas of Arduino IDE are marked above (using an old image for convenience, but the layout is the same as the new version). Most of the white area in the image is the code editing area, used for inputting code. Note that when entering code, you should switch to English input mode. The black area below is the message prompt area, which will display whether the compilation or download was successful.

3. Downloading a Blink Program

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Download the simplest code, which will help us familiarize ourselves with how to download programs while also testing the board’s functionality.

The LED marked ‘L’ on the UNO board will blink with this test code.

4. Open Blink

After plugging in the USB cable and opening the Arduino IDE, find the “Blink” code.

File > Examples > 01.Basics > Blink

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

5. Verify the Program

Typically, after writing a piece of code, we need to verify it to see if there are any errors. Click “Verify”.

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

After verification (compilation) is complete, you will see the corresponding prompt.

Since this is sample code, there will be no errors during verification; however, in the future, after entering code, you will need to verify it before downloading it to Arduino.

Before downloading the program, we also need to tell Arduino IDE what board we are using and which serial port is associated.

6. Set the Board Type

Arduino includes various versions of controllers, the most common being the Uno, Leonardo, and Mega series controllers (the most comprehensive selection guide).

In the board section, you need to select the board type based on the firmware type of the hardware you choose. (In this example, we are using a controller with the Uno bootloader) Tools > Board > Arduino Uno

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

7. Set the Serial Port

Tools > Serial Port > xx, where xx must match what you see in your computer’s device manager.

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

8. Upload the Program

As shown, finally, click “Upload”. (Uploading and downloading here essentially mean the same thing)

Understanding Arduino: A Beginner's Guide to Arduino and Microcontrollers

Upload complete!

If all goes well, we will see the program running effect directly on the board:

The LED on pin 13 of the Arduino Uno board is blinking.

Alright, these are the most basic operations of the IDE.

Leave a Comment

×