Skip to main content
Translate content

To read content in another language, use your browser’s Translate page option (right-click the page or open the browser menu). Choose your preferred language; if offered, enable automatic translation. The site language menu changes navigation, not the original article. Interactive activities may remain in their original language.

roboticsApprofondissement, Fundamentals, IntermediateEstimated time: 25 minUpdated December 1, 2026

Introduction to Arduino: What Is It and How Does It Work?

Understand the Arduino ecosystem, hardware anatomy, and Sense–Think–Act workflow—and discover why it is the ideal launchpad for electronics and robotics beginners.

Behind smart thermostats, automatic streetlamps, and obstacle-avoiding robots sits a tiny programmable brain called a microcontroller. Arduino is an open-source electronics platform that makes working with microcontrollers accessible to everyone. By pairing an affordable, durable circuit board with beginner-friendly programming software, Arduino removes steep technical barriers and allows learners to build real interactive circuits right away.

Clean educational illustration of an Arduino Uno microcontroller board connected to a light sensor and LED on a soft mint green background, representing the Sense–Think–Act cycle.

Learning objectives

  • Define what Arduino is and distinguish between its hardware, software, and open-source ecosystem components.
  • Identify the main parts of an Arduino Uno board and explain their functions.
  • Analyze the execution flow of a basic Arduino sketch using setup() and loop().

Introduction

Have you ever wondered how a smart thermostat knows when to turn on the heater, how an automatic streetlamp switches on at dusk, or how a small robot avoids crashing into a wall? Behind all of these everyday interactive systems sits a tiny, programmable electronic brain called a microcontroller.

Arduino is an open-source electronics platform designed to make working with microcontrollers accessible to everyone—from middle school students and hobbyists to engineers and artists. By combining an easy-to-use hardware board with beginner-friendly programming software, Arduino removes the steep technical barriers that traditionally made embedded electronics difficult to learn.

Prerequisites

  • Basic computer literacy: Ability to install software, connect a USB cable, and edit text files.
  • Elementary logic: Understanding simple cause-and-effect rules (for example, "if a condition is true, perform an action").
  • No prior electronics or coding experience required: All essential concepts are introduced from scratch in this lesson.

Learning objectives

  • Define what Arduino is and distinguish between its hardware and software components.
  • Identify the main parts of an Arduino Uno board and explain their roles.
  • Explain how Arduino works using the Sense–Think–Act cycle.
  • Differentiate between digital signals and analog signals in basic circuits.
  • Analyze the structure of a basic Arduino program (setup() and loop()).
  • Evaluate why Arduino is an ideal starting platform for beginners in robotics and electronics.

1. What Is Arduino?

Many beginners think Arduino is just a single circuit board. In reality, Arduino is a complete ecosystem composed of three interconnected pillars:

  • Arduino Hardware (The Board): A physical programmable circuit board—most famously the Arduino Uno—built around a microcontroller chip (such as the ATmega328P). It provides organized pins to connect sensors, lights, motors, and displays.
  • Arduino Software (The IDE): The Integrated Development Environment (IDE) is a free application you run on your computer. You write instructions (called a sketch) in a simplified version of C/C++ and upload them to the board via a USB cable.
  • Open-Source Community & Libraries: Because Arduino’s hardware designs and software are open-source, millions of educators and makers share free wiring diagrams, tutorials, and pre-written code packages called libraries.

Important distinction: Unlike a Raspberry Pi, which is a full mini-computer running an operating system like Linux, an Arduino board does not run a desktop OS. Instead, it dedicates 100% of its focus to running one program repeatedly and interacting directly with physical electronic components in real time.

2. Anatomy of an Arduino Uno Board

The Arduino Uno is the standard starting board for learners because it is durable, well-documented, and easy to wire without soldering. Its key components include:

  • Microcontroller (ATmega328P): The black rectangular chip that acts as the brain. It stores your uploaded program and executes instructions millions of times per second.
  • USB Port: Connects the board to your computer to upload code and supply 5V electrical power during testing.
  • Barrel Power Jack: Allows the board to run independently from a battery pack or wall adapter (typically 7V to 12V) once programmed.
  • Digital I/O Pins (0 to 13): Pins that handle binary signals—either HIGH (5V, ON) or LOW (0V, OFF). They can read buttons or control LEDs.
  • Analog Input Pins (A0 to A5): Pins that measure a continuous range of voltages (0V to 5V) from sensors like temperature probes or light detectors, converting them into numbers from 0 to 1023.
  • Power Pins (5V, 3.3V, GND): Supply regulated voltage to external components. GND stands for Ground (0V), which completes every electrical circuit.
  • Built-in LED (Pin 13): A tiny onboard light connected internally to digital pin 13, letting you test your first program without wiring any external parts.

Interactive Board Explorer

Interactive Activity 1: Explore the Arduino Uno Hardware

Select a hardware component from the dropdown menu (or use the highlight buttons) to inspect where it sits on the board and what job it performs.

Select Component:

3. How Does Arduino Work? (The Sense–Think–Act Cycle)

Every Arduino project—no matter how simple or advanced—operates on a continuous three-step loop known in robotics and embedded systems as the Sense–Think–Act cycle:

  1. Sense (Inputs): Sensors and switches gather information from the physical world and convert it into electrical signals sent into Arduino’s input pins. Examples include a push button, a temperature sensor, or a light-dependent resistor (LDR).
  2. Think (Processing): The microcontroller reads those input signals and evaluates them against the rules written in your program (for example: "Is the room darker than the threshold?").
  3. Act (Outputs): Based on its decision, Arduino sends electrical signals out through its output pins to control actuators—components that affect the physical world, such as LEDs, buzzers, servo motors, or relays.

Worked Example 1: Automatic Night Light

Problem: Design the logical workflow for a garden light that turns on automatically when darkness falls.

Step-by-step analysis:

  1. Identify the Sensor (Input): Connect a light sensor (photoresistor) to Analog Pin A0. In bright sunlight, it sends a high reading (around 850). In darkness, the reading drops low (around 150).
  2. Define the Decision Rule (Think): Choose a threshold value, such as 400. If the sensor reading is less than 400, it is dark; otherwise, it is bright.
  3. Identify the Actuator (Output): Connect an LED lamp module to Digital Pin 8. When dark, set Pin 8 to HIGH (ON). When bright, set Pin 8 to LOW (OFF).

Result: Because the Arduino checks Pin A0 thousands of times per second, the light responds instantaneously whenever someone covers the sensor or when sunset arrives.

Interactive Sense–Think–Act Simulator

Interactive Activity 2: Simulate the Sense–Think–Act Cycle

Adjust the simulated ambient light sensor level (0 = pitch black, 1023 = bright noon) and set your darkness threshold (between 100 and 900), then click Run Cycle to see how Arduino processes the signal.

Light Sensor (0–1023): Threshold (100–900):
1. Sense (Pin A0) 250
2. Think (Compare) 250 < 400 (True)
3. Act (Pin 8 LED) HIGH (LED ON)

4. Anatomy of an Arduino Program (The Sketch)

Every Arduino program—called a sketch—requires two core functions to work properly:

  • void setup(): Runs once when the board powers on or resets. You use it to configure pins as inputs or outputs.
  • void loop(): Runs continuously over and over as long as the board has power. This is where the Sense–Think–Act logic lives.

Worked Example 2: Blinking the Built-in LED

Below is the classic first Arduino sketch. Read each line carefully to understand how code controls physical electricity:

void setup() {
  // Configure digital pin 13 as an OUTPUT
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH); // Send 5V to pin 13 (Turn LED ON)
  delay(1000);            // Wait for 1000 milliseconds (1 second)
  digitalWrite(13, LOW);  // Send 0V to pin 13 (Turn LED OFF)
  delay(1000);            // Wait for 1000 milliseconds (1 second)
}

Execution trace:

  1. When powered on, setup() sets Pin 13 to OUTPUT mode so it can supply current.
  2. loop() begins: digitalWrite(13, HIGH) turns the LED on.
  3. delay(1000) pauses execution for 1000extms=1extsecond1000 ext{ ms} = 1 ext{ second}, keeping the LED lit.
  4. digitalWrite(13, LOW) turns the LED off, followed by another 1extsecond1 ext{ second} pause.
  5. Once loop() finishes its last line, it immediately jumps back to the top of loop(), creating an endless 2-second blink cycle.

5. Why Is Arduino the Best Starting Point for Beginners?

Choosing your first hardware platform can feel overwhelming. Arduino stands out for beginners due to five practical advantages:

  • Low Cost and Durability: An Arduino Uno is inexpensive, and its microcontroller chip is replaceable if accidentally damaged during experimentation.
  • Cross-Platform Simplicity: The Arduino IDE runs smoothly on Windows, macOS, and Linux, and uploading code takes a single click over USB—no external hardware programmers needed.
  • Plug-and-Play Prototyping: Using a solderless breadboard and jumper wires, beginners can build and modify circuits in minutes without needing soldering irons or dangerous high voltages (standard logic runs safely at 5V).
  • Gentle Learning Curve: Complex low-level microcontroller registers are hidden behind readable commands like digitalWrite() and analogRead(), letting you focus on logic and creativity first.
  • Clear Pathway to Advanced Engineering: Skills learned on Arduino—circuit reading, sensor calibration, C++ syntax, and debugging—transfer directly to industrial microcontrollers, robotics, and Internet of Things (IoT) systems.

6. Common Beginner Mistakes

  • Forgetting a current-limiting resistor with an external LED: Connecting a bare LED directly between 5V and GND draws excessive current and can burn out the LED or the Arduino pin. Always place a 220 Ω220\,\Omega to 330 Ω330\,\Omega resistor in series.
  • Confusing setup() and loop(): Placing code inside setup() when you want it to repeat causes the action to happen only once at startup.
  • Forgetting pinMode(): If you use digitalWrite(8, HIGH) without first setting pinMode(8, OUTPUT) in setup(), the pin remains in high-impedance input mode and the LED will glow very dimly or not at all.
  • Selecting the wrong board or COM port in the IDE: If code fails to upload, verify under the Tools menu that both Arduino Uno and the active USB serial port are selected.

7. Practice Exercises

  1. Component Role Identification: A student wants to measure the exact temperature of water using an analog sensor that outputs varying voltages between 0extV0 ext{ V} and 5extV5 ext{ V}. Which group of pins on the Arduino Uno should the sensor’s signal wire connect to, and why?
    Solution

    It should connect to one of the Analog Input Pins (A0–A5). Unlike digital pins, which only detect two states (HIGH or LOW), analog input pins contain an Analog-to-Digital Converter (ADC) that measures continuous voltage levels and converts them into integer values from 0 to 1023.

  2. Timing Calculation: Look at the blink code in Worked Example 2. If you change both delay(1000); lines to delay(250);, how many complete ON-OFF blink cycles will the LED perform in 5extseconds5 ext{ seconds}?
    Solution

    Each complete cycle consists of 250extms250 ext{ ms} ON plus 250extms250 ext{ ms} OFF, which equals 500extms500 ext{ ms} (0.5extseconds0.5 ext{ seconds}) per cycle. In 5extseconds5 ext{ seconds}, the LED completes rac50.5=10rac{5}{0.5} = 10 full blink cycles.

  3. Debugging a Sketch: A beginner writes the following code to turn on a buzzer connected to Pin 9, but the buzzer barely makes a sound. Identify the missing instruction and explain how to fix it.
    void setup() {
    }
    
    void loop() {
      digitalWrite(9, HIGH);
    }
    Solution

    The sketch is missing pinMode(9, OUTPUT); inside void setup(). Without configuring Pin 9 as an output, the microcontroller cannot supply full current to drive the buzzer.

8. Knowledge Check Quiz

Interactive Activity 3: Test Your Understanding

Answer all four questions below, then click Check Answers to review your score and detailed explanations.

1. Which statement best describes Arduino?

A desktop operating system designed for gaming computers. An open-source electronics platform combining microcontroller hardware and programming software. A cloud database used exclusively for storing website images.

2. How many times does the setup() function execute after an Arduino board is powered on?

Continuously in an infinite loop until unplugged. Exactly once at startup (or whenever the reset button is pressed). Only when an analog sensor reads zero.

3. In the Sense–Think–Act cycle, which component acts as an actuator?

A servo motor that moves a robotic arm. A temperature sensor reading room heat. The USB cable used to upload code.

4. What range of integer values does analogRead() return on a standard Arduino Uno?

0 to 1 0 to 1023 -500 to +500
Select an option for each question and click Check Answers.

Key takeaways

  • Arduino is an open-source hardware and software ecosystem built around programmable microcontrollers.
  • Every Arduino project follows the Sense–Think–Act cycle: reading inputs from sensors, evaluating logic in code, and driving outputs through actuators.
  • Digital pins handle binary ON/OFF (HIGH/LOW) signals, while analog pins read continuous sensor values from 0 to 1023.
  • Every sketch relies on setup() for one-time configuration and loop() for continuous real-time execution.
  • Low cost, safe 5V operation, beginner-friendly C++ functions, and massive community support make Arduino the ideal entry point into electronics and robotics.

Suggested next learning steps

  • Install the official Arduino IDE on your computer and run the built-in Blink example on an Arduino Uno board (or a browser-based circuit simulator).
  • Learn how to wire a solderless breadboard with an external LED and a 220 Ω220\,\Omega resistor.
  • Explore digital inputs by connecting a push button and using if / else conditional statements in your sketch.

Key formulas

Blink Cycle Period

T=ttextON+ttextOFFT = t_{text{ON}} + t_{text{OFF}}

Total duration of one complete digital blink cycle, where delays are specified in milliseconds (1000 ms = 1 s).

10-Bit Analog-to-Digital Conversion

Vtextin=fractextADCValue1023times5textVV_{text{in}} = frac{text{ADC Value}}{1023} times 5text{ V}

Converts an analogRead() integer (0 to 1023) on a 5V Arduino Uno into its corresponding input voltage.

Worked examples

Worked Example 1: Automatic Night Light Workflow

Design the logical Sense–Think–Act workflow for a garden light that turns on automatically when darkness falls.

1. Sense: Connect a light sensor to Analog Pin A0 to measure ambient light (0 to 1023). 2. Think: Compare the reading against a threshold of 400 (if reading < 400, it is dark). 3. Act: Set Digital Pin 8 to HIGH to turn the LED lamp ON when dark, and LOW to turn it OFF when bright.

Worked Example 2: Blinking the Built-in LED

Write and trace an Arduino sketch that blinks the onboard LED on Digital Pin 13 every second.

Inside void setup(), call pinMode(13, OUTPUT); once to configure Pin 13. Inside void loop(), call digitalWrite(13, HIGH); followed by delay(1000); to light the LED for 1 second, then call digitalWrite(13, LOW); followed by delay(1000); to turn it off for 1 second. Because loop() repeats indefinitely, the LED blinks continuously.

Common mistakes to avoid

  • Forgetting a current-limiting resistor with an external LED: Connecting a bare LED directly between 5V and GND draws excessive current and can damage the LED or pin; always place a 220 ohm to 330 ohm resistor in series.
  • Confusing setup() and loop(): Placing repeating logic inside setup() causes it to execute only once at power-on instead of continuously.
  • Forgetting pinMode(): Calling digitalWrite(pin, HIGH) without first setting pinMode(pin, OUTPUT) in setup() leaves the pin in high-impedance input mode so connected outputs barely operate.
  • Selecting the wrong board or COM port in the IDE: Upload errors often occur when Arduino Uno or the active USB serial port is not selected under the Tools menu.

Practice exercises

Component Role Identification

A student wants to measure the exact temperature of water using an analog sensor that outputs varying voltages between 0 V and 5 V. Which group of pins on the Arduino Uno should the sensor's signal wire connect to, and why?

Hint: Compare pins that only read ON/OFF states with pins designed to measure a range of voltages.

Show solution

Connect the sensor's signal wire to one of the Analog Input Pins (A0–A5). Unlike digital pins, analog input pins use an internal Analog-to-Digital Converter (ADC) to translate continuous voltages (0V–5V) into integer values from 0 to 1023.

Blink Timing Calculation

In the standard Blink sketch, both delay(1000); statements are changed to delay(250);. How many complete ON-OFF blink cycles will the LED perform in 5 seconds?

Hint: Add the ON time and OFF time in milliseconds first, convert to seconds, and divide into 5 seconds.

Show solution

One complete cycle takes 250 ms ON + 250 ms OFF = 500 ms (0.5 seconds). Over 5 seconds, the LED completes 5 / 0.5 = 10 complete blink cycles.

Debugging a Buzzer Sketch

A beginner writes void setup() { } and void loop() { digitalWrite(9, HIGH); } to sound a buzzer on Pin 9, but the buzzer barely makes a noise. What instruction is missing?

Hint: Check whether Pin 9 was configured to supply output current before digitalWrite() was called.

Show solution

The sketch is missing pinMode(9, OUTPUT); inside void setup(). Without setting Pin 9 as an OUTPUT, the microcontroller remains in high-impedance input mode and cannot supply sufficient current to drive the buzzer.

Key takeaways

  • Digital pins handle binary ON/OFF (HIGH/LOW) signals, while analog pins read continuous sensor values from 0 to 1023.
  • Every sketch relies on setup() for one-time configuration and loop() for continuous real-time execution.

Explore more

Related book

Robotics Made Simple for Kids

By Youssef Nejjari

Explore the book