Understanding Arduino: Differences from Microcontrollers and Beginner’s Guide

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

Q: How can I see articles like this every day?

A: Just search for the public account “51 Microcontroller Learning Network” and follow it for free

Readers who work with microcontrollers should have heard of Arduino or even used it, but many friends are still unclear about what Arduino actually is. Today, I will briefly describe Arduino-related content for beginners.

1. Introduction to Arduino

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

1. What is a microcontroller?

A working computer consists of several parts: a 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 a personal computer (PC), these parts are divided into several chips installed on a printed circuit board called a motherboard. In a microcontroller, all these parts are integrated into a single integrated circuit chip, hence the name microcontroller (single-chip machine). Some microcontrollers also integrate additional components such as analog-to-digital conversion (A/D) and digital-to-analog conversion (D/A).

2. What is the use of microcontrollers?

The saying “using a sledgehammer to crack a nut” applies here; not every situation requires high performance. Imagine a voice-activated light using an Intel i7 processor; its cost performance would be extremely low. The key to application is whether it is sufficient and offers good performance-to-price ratio, which is where microcontrollers fill the gap well.

Now, what is Arduino?

Arduino is a convenient, flexible, and easy-to-use 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 allows for interaction, enabling even a ten-year-old child to create something they desire. Arduino can sense the environment through various sensors and respond to it by controlling lights, motors, and other devices. The microcontroller on the board can be programmed using the Arduino 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 (such as Flash, Processing, MaxMSP) to achieve functionality.

2. Types of Arduino

There are so many Arduino boards available in the market, aside from the original ones, there are thousands of various Arduino types on online marketplaces. 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 distinguish them.

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide
Arduino Mega

To distinguish between so many boards and select the appropriate 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 the features. This includes 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 the size. Due to the nature of projects, the volume and weight allocated for electronic components can vary greatly. For example, if you want to make a tracker for a dog, using a Mega with a battery pack and expansion board would require a size of at least 10*5*5 cm and weigh 200g. Is this a tracker or a sandbag? This is why there are so many different Arduino models.

Having said so much, let’s 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: Differences from Microcontrollers and Beginner's Guide

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 be used as analog pins, native USB support

Size: 75 x 55mm

Price: $25

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

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: Differences from Microcontrollers and Beginner's Guide

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 be used as analog pins, native USB support

Size: 50 x 18 mm

Price: $27

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

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: Differences from Microcontrollers and Beginner's Guide

Of course, there are many more, but I won’t list them all here; if you’re interested, you can learn more on your own.

3. Installing and Downloading the Arduino Compilation Environment
Download link:
https://www.arduino.cc/en/Main/Software

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

Three major mainstream operating systems: Windows, Mac, and Linux are all supported, so choose according to your situation.
The installation process will not be described in detail here; basically, you can just keep clicking “Next”. If you can’t 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 repeat this cycle.

Now, let’s assume we are using the Arduino UNO model control board (recommended for beginners due to its stability) and have set up the Arduino development environment and installed the USB driver as described 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 via USB or using a power bank or power adapter.)

Connect the Arduino control board to the computer

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

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

2. Understanding Arduino IDE

Let’s briefly familiarize ourselves with the Arduino compiler, as we will be interacting with it frequently in the future.

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

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

Any Arduino product requires downloading code before it can operate.

The hardware circuit we set up assists the code in execution; both are indispensable. Just like a person controls bodily movements through the brain. If the code is the brain, the peripheral hardware is the body, and the body’s movements depend on the brain, so the hardware implementation depends on the code.

The basic functional areas of Arduino IDE have been indicated above (this is an old image, but the layout is the same as the new version). The majority of the white area in the image is the code editing area where you input code. Note that when entering code, you must switch to English input mode. The black area below is the message prompt area, which will display whether the compilation or upload was successful.

3. Downloading a Blink program

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

Download the simplest code to help us familiarize ourselves with how to upload programs and also test if the board is working properly.

The LED marked “L” on the UNO board will blink with this test code.

4. Open Blink

Plug in the USB cable, open the Arduino IDE, and find the “Blink” code.

File > Examples > 01.Basics > Blink

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

5. Verify the program

Typically, after writing a piece of code, we need to verify it to check for errors. Click “Verify”.

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

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

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

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

6. Set board type

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

In the board section, you need to select the board type according to the firmware type of your selected main control hardware. (In this example, the controller is selected with Uno as the bootloader) Tools > Board > Arduino Uno

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

7. Set the serial port

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

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

8. Upload the program

As shown, finally, click “Upload”. (Here, upload and download are actually the same thing)

Understanding Arduino: Differences from Microcontrollers and Beginner's Guide

Upload complete!

If everything goes well, we will see the program running effect visually 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.

This article is reprinted from the internet, copyright belongs to the original author. If you find it unsatisfactory, please contact us for deletion!

↓ Click below

“Read the original article”

for more information

Leave a Comment