Uni-Sine
Computer ScienceElectronics

What is Arduino?

"Arduino" means three things at once: a company, a family of boards, and the free software and libraries that go with them. According to Arduino, it was born at the Ivrea Interaction Design Institute in Italy as a tool for fast prototyping, aimed at students with no background in electronics or programming. It is still the most common way people take their first steps in electronics.

What is the Arduino Uno?

The Arduino Uno is the classic Arduino board, about the size of a credit card. The Uno R3 is built around an ATmega328P microcontroller, an 8-bit chip running at 16 MHz. The board adds everything that makes the chip easy to use: a USB connection for programming and power, a power jack and regulator, and rows of labelled header pins you can plug wires into.

FeatureArduino Uno R3
MicrocontrollerATmega328P, 8-bit
Clock speed16 MHz
Program memory (flash)32 KB, of which 0.5 KB holds the bootloader
Working memory (SRAM)2 KB
EEPROM1 KB
Digital pins14, of which 6 can do PWM
Analog inputs6 (A0 to A5)
Logic level5 V

The newer Uno R4 Minima keeps the same shape and pin layout but uses a 32-bit Arm Cortex-M4 chip at 48 MHz, with 256 KB of flash and 32 KB of SRAM. The Uno R4 WiFi adds wireless. Our guide to microcontrollers explains what the chip on these boards is doing.

Arduino pins

What is a digital pin in Arduino?

A digital pin is either on or off. As an output, digitalWrite(pin, HIGH) sets it to 5 V and LOW to 0 V, enough to light an LED through a resistor. As an input, digitalRead(pin) reports whether the voltage on it is HIGH or LOW, for example whether a button is pressed. You choose with pinMode() in setup(). The Uno has 14 digital pins, numbered 0 to 13. Pins 0 and 1 also carry the USB serial link, so beginners usually leave them free.

What is an analog pin in Arduino?

An analog pin measures a voltage, not just on or off. The Uno's six analog inputs, A0 to A5, feed a 10-bit analog-to-digital converter, so analogRead(A0) returns a number from 0 for 0 V to 1023 for 5 V. That is how an Arduino reads a dial, a light sensor or a temperature sensor. The analog pins can also work as ordinary digital pins, and A4 and A5 double as the Uno's I2C pins for sensors and screens (see how to use I2C on Arduino).

PWM: faking an analog output

The Uno can't output a true in-between voltage, but six digital pins, marked with a ~, can switch on and off very fast. This is pulse-width modulation (PWM). analogWrite(pin, value) takes a value from 0 (always off) to 255 (always on). At 128, the pin is on about half the time, so an LED looks about half as bright and a motor runs slower.

Try working out a PWM value yourself, then press Mark to check it in our Micro Controllers course.

Type an analogWrite value for a duty, or the average voltage for a value (TypedAnswer), random rounds.

Press Mark to have your answer marked in the Micro Controllers course.

What is the Arduino IDE?

The Arduino IDE (integrated development environment) is the free program you use to write code, called sketches, and upload it to a board over USB. It has a code editor, a library manager for adding support for sensors and screens, a serial monitor for seeing messages from the board, and a board manager for adding other boards, including the ESP32. There is also an online editor in Arduino Cloud that runs in a browser.

Sketches are written in C++, with simple built-in functions such as digitalWrite(), analogRead() and delay(). Every sketch has two parts: setup(), which runs once at power-up, and loop(), which then runs again and again.

const int sensorPin = A0;
const int ledPin = 9;          // a PWM pin

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);          // messages to the serial monitor
}

void loop() {
  int reading = analogRead(sensorPin);     // 0 to 1023
  int brightness = reading / 4;            // 0 to 255
  analogWrite(ledPin, brightness);
  Serial.println(reading);
  delay(100);
}

This sketch reads a knob or light sensor on A0 and sets an LED's brightness to match. Dividing by 4 turns the 0 to 1023 range into the 0 to 255 range that analogWrite() expects.

What is the difference between Arduino and ESP32?

They aren't quite the same kind of thing. Arduino is a platform: boards, software and libraries. The ESP32 is a family of microcontroller chips made by Espressif. Many cheap ESP32 boards are programmed with the Arduino IDE through Espressif's Arduino core, and Arduino itself sells a board with an ESP32 chip, the Nano ESP32. So the real comparison is usually a classic Arduino board, like the Uno, against an ESP32 board.

Arduino Uno R3Typical ESP32 board
Processor8-bit, single core, 16 MHz32-bit, usually dual core, up to 240 MHz
Working memory2 KB520 KB
Wi-Fi and BluetoothNoYes, built in
Logic level5 V3.3 V
Analog inputs6, 10-bit (0 to 1023)More, 12-bit (0 to 4095)
Power useLowHigher, especially with Wi-Fi on, but it has deep sleep modes
Best forLearning, simple projects, 5 V parts, huge tutorial baseInternet-connected projects, more processing

ESP32 figures are from Espressif's datasheet for the original ESP32. In short: pick an Uno to learn the basics and work with 5 V sensors and shields, and pick an ESP32 when the project needs Wi-Fi, Bluetooth or more speed. Watch the voltage: an ESP32 pin can be damaged by a 5 V signal, so 5 V parts need a level shifter.

What are the limitations of Arduino?

  • Little memory: the Uno R3's 2 KB of SRAM fills up fast with text, arrays or big libraries.
  • Modest speed: 16 MHz and 8 bits are fine for reading sensors and driving LEDs, but too slow for audio, video, cameras or AI.
  • No built-in wireless on the classic boards: you need an add-on, or a board like the Uno R4 WiFi or an ESP32.
  • Small currents: each pin can only supply a small current, around 20 mA in normal use, with 40 mA as the absolute maximum in the ATmega328P datasheet. Motors, relays and long LED strips need a driver or transistor.
  • One job at a time: there is no operating system, so juggling many tasks needs careful code.
  • 10-bit readings on the Uno R3, so a 5 V range is split into steps of about 5 mV.

None of these stop beginners, and most have a simple fix: a bigger board, an add-on module or a little more careful code.

BoardWhat makes it different
Uno (R3 and R4)The classic beginner board, with the most tutorials and add-on shields
NanoThe Uno's chip on a tiny board that plugs into a breadboard
Mega 256054 digital and 16 analog pins, for projects with lots of parts, like 3D printers
LeonardoCan act as a USB keyboard or mouse
Nano ESP32Arduino's own small board with an ESP32 chip, for Wi-Fi and Bluetooth

Arduino simulators

You can learn Arduino without a board. Free online simulators such as Tinkercad Circuits and Wokwi let you wire up a virtual Uno with LEDs, buttons and sensors, write a sketch and watch it run. Wokwi also simulates ESP32 and Raspberry Pi Pico boards. Simulators are a safe way to test wiring before you risk real parts, though they can't copy every quirk of real hardware.

Worked examples

Example 1: reading a voltage

analogRead(A0) on an Uno returns 750. What voltage is on the pin? Voltage = 750 × 5 ÷ 1023 = 3.67 V. On a 12-bit, 3.3 V ESP32, a reading of 3,000 would be 3,000 × 3.3 ÷ 4,095 = 2.42 V.

Example 2: choosing an LED resistor

A red LED needs about 2 V across it, and the Uno's pin gives 5 V. With a 220 Ω resistor in series, the current is (5 − 2) ÷ 220 = 0.0136 A, which is 13.6 mA, safely under 20 mA. Without the resistor, the current would be limited only by the pin itself, which can damage both the LED and the board.

Example 3: a PWM value

You want a motor at 75% power. 0.75 × 255 = 191.25, so use analogWrite(pin, 191). The motor must be driven through a transistor or motor driver, not straight from the pin.

Common mistakes

  • Forgetting the LED resistor. Always put a resistor in series with an LED.
  • Powering motors from a pin. Use a transistor or motor driver and a separate supply.
  • Sending 5 V into a 3.3 V board. ESP32 and Pico pins aren't 5 V tolerant.
  • Using analogWrite() on a pin without a ~. On an Uno, only pins 3, 5, 6, 9, 10 and 11 do PWM.
  • Leaving an input floating. An unconnected input reads at random. Use pinMode(pin, INPUT_PULLUP) or a resistor so a button has a definite state.
  • Choosing the wrong board in the IDE. The upload fails or misbehaves if the board and port settings don't match.

Common questions

What is Arduino used for?
Building things that sense and react: robots, weather stations, plant waterers, LED displays, alarms, games controllers and classroom experiments. It is also used to prototype products before they are made properly.
Is Arduino a microcontroller?
An Arduino board has a microcontroller on it, such as the ATmega328P on the Uno R3, plus the USB, power and pin headers that make it easy to use. Arduino is also the name of the company and the software.
Can I use the Arduino IDE to program an ESP32?
Yes. Add the ESP32 boards through the IDE's board manager, using Espressif's Arduino core. Most Arduino code and many libraries then work, though pin numbers and voltage levels differ.
Which is better, Arduino or ESP32?
Neither is better for everything. An Uno is simpler, works at 5 V and has the most beginner tutorials. An ESP32 is faster, has far more memory and adds Wi-Fi and Bluetooth, so it suits connected projects.
What language does Arduino use?
C++, with Arduino's own set of simple functions on top. Some boards, like the Nano ESP32, can also run MicroPython.
Do I need to know electronics to start Arduino?
No. Beginner kits and tutorials start with lighting an LED and reading a button. You pick up ideas like voltage, current and resistors as you go.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Learn it

    Micro Controllers

    Arduino, ESP32 and programming hardware at the lowest level

    Start the course
Read next
Computer Science · ElectronicsHow to use I2C on Arduino: wiring, Wire library, codeHow to use I2C on Arduino: which pins to wire, pull-up resistors, device addresses, the Wire library, an I2C scanner and reading a sensor.