NSK Electronics Arduino path

Arduino · Lesson 1

BasicArduino

Lesson 1 of the Arduino path — understand the Uno pinout, install the free IDE, plug in USB, upload a sketch, and make the built-in LED blink. Plain English, step by step.

HC-SR04 ultrasonic distance sensor module — a common Arduino sensor you will wire after Blink.

What is Arduino?

Arduino is a friendly way to learn electronics and programming. Three things go together:

The board

A small computer you can plug into USB — like the classic Arduino UNO R3.

The IDE

Free software on your PC/Mac where you write short programs called sketches.

The community

Millions of examples, libraries, and forums — you rarely start from a blank page.

You write a sketch → click Upload → the board runs it. Sensors, LEDs, motors, and relays all become reachable from a few pins.

Arduino UNO R3 pinout explained

This colourful diagram is your map. You do not need to memorise every label today — take a short tour of each pin group, then come back when a project needs a new pin.

Arduino UNO R3 pinout diagram: power pins, analog A0–A5, digital D0–D13 with PWM, SPI, I2C, UART, and ICSP headers colour-coded.

Arduino UNO R3 pinout — colour tags show power, ground, digital GPIO, PWM, ADC, SPI, I2C, UART, and more.

1. Quick map — where things sit

Hold the board so the USB Type‑B socket is at the top. Then match the diagram:

  1. Top: USB (talks to your PC) and the black barrel jack (optional wall power).
  2. Left rail: power pins at the top, then analog A0–A5 below.
  3. Right rail: digital D0–D13 (bottom to top), plus AREF and extra I2C pins near the top.
  4. Middle: the big black chip (ATmega328P), Reset button, and tiny LEDs (ON, L, TX, RX).
Top

USB · barrel jack · Reset

Left

Power + A0–A5

Right

Digital D0–D13

Centre

Chip · ON / L / TX / RX LEDs

2. Power pins Power GND

These sockets feed electricity to your sensors and modules. Think of them as the board’s power strip.

IOREF

Tells shields what voltage the board’s pins run at (5 V on a classic Uno). Most beginners can ignore it.

RESET

Connect this to GND (or press the Reset button) to restart your sketch from the beginning — like rebooting.

3.3V

Gentle 3.3 volt supply. Use this for modules that say “3.3 V only” (some sensors and displays).

5V

The everyday power pin for LEDs, many sensors, and breadboard circuits when the board is powered from USB.

GND

Ground — the “return path” / 0 V reference. Every circuit needs at least one wire back to GND. Several GND pins; they are the same.

Vin

External power input (roughly 7–12 V recommended). The board regulates this down to 5 V. Same idea as the barrel jack.

  1. 5V vs 3.3V: match the part’s datasheet. A “5 V sensor” → 5V pin. A “3.3 V only” module → 3.3V pin (feeding it 5 V can damage it).
  2. Vin warning: do not push a regulated 5 V supply into Vin hoping to “power the board” — Vin expects a higher voltage and the onboard regulator needs headroom. For USB-powered projects, leave Vin alone and use the 5V pin to power your parts.
  3. Never short 5V to GND with a bare wire — that is a dead short and can damage the board or USB port.

Safety habit: power off (unplug USB) before rearranging wires. Double-check red (power) and black (GND) before you plug back in.

3. Digital pins D0–D13 GPIO

Digital pins are on/off switches. In code you set them as INPUT (listen) or OUTPUT (drive).

OUTPUT

Turn an LED on/off, drive a relay module input, or send a signal. digitalWrite(pin, HIGH) ≈ 5 V; LOW ≈ 0 V.

INPUT

Read a button or switch. digitalRead(pin) returns HIGH or LOW. Often use INPUT_PULLUP so the pin is not “floating.”

D13 = built-in LED

Pin 13 is wired to the on-board “L” LED. Blink uses this — no breadboard needed for your first win.

D0 / D1 = RX / TX: these are the Serial (UART) pins that also share the USB link to your PC. Avoid wiring sensors to D0/D1 while uploading sketches — use D2+ for everyday inputs/outputs until you intentionally need Serial.

4. PWM pins (~) PWM

Pins marked with a little wave ~ can fake “in-between” levels by switching on and off very fast. On the Uno that is D3, D5, D6, D9, D10, D11.

  1. Use analogWrite(pin, value) with a value from 0 (off) to 255 (full on).
  2. Dim an LED: 64 ≈ dim, 128 ≈ medium, 255 ≈ bright.
  3. Motor speed: same idea through a proper motor driver — PWM tells the driver how hard to push (never drive a big motor straight from a pin).

Plain English: PWM is a dimmer knob for digital pins that have the ~ mark.

5. Analog pins A0–A5 ADC

Analog pins measure voltages between 0 V and about 5 V and turn them into a number from 0 to 1023. Perfect for pots, light sensors, and many analog sensor modules.

  1. Wire the sensor signal to A0 (for example), power to 5V or 3.3V as required, and ground to GND.
  2. In code: int v = analogRead(A0); — watch the number change in Serial Monitor.
  3. Bonus: A0–A5 can also act as digital pins D14–D19 if you run out of digital pins.

6. Special functions — SPI, I2C, interrupts, UART

Some digital/analog pins wear a second hat for talking to chips. Expand a row when you need that bus.

SPI D11 / D12 / D13 + SS (D10)

Fast bus for SD cards, some displays, and radio modules. Fixed pins on Uno: MOSI D11, MISO D12, SCK D13, and usually SS D10 (chip select — you can use another pin for extra devices).

Step: wire the module’s MOSI/MISO/SCK/SS → those pins, share GND, then use an SPI library for that part.

I2C A4 = SDA · A5 = SCL

Two-wire bus for many sensors and OLED screens. On Uno: A4 = SDA (data), A5 = SCL (clock). The board also has labelled SDA/SCL pins near the top-right — same signals.

Step: connect SDA→SDA, SCL→SCL, power + GND, then use Wire / the sensor’s library. Many devices can share the same two wires (different addresses).

Interrupt D2 (INT0) · D3 (INT1)

These two pins can wake your sketch instantly when a button or sensor edge happens — handy when you cannot afford to keep polling.

Step: wire the signal to D2 or D3, then use attachInterrupt in more advanced sketches. Beginners can treat them as normal digital pins first.

UART D0 RX · D1 TX

Serial text link — same lines the USB chip uses to talk to the Arduino IDE Serial Monitor.

Step: use Serial.begin(9600) and Serial.println(...) over USB. Only wire external TX/RX devices to D0/D1 when you know what you are doing (and often disconnect them while uploading).

7. Other bits on the board

AREF

Optional reference for analogRead. Leave it unconnected unless an advanced guide tells you to set a custom reference.

ICSP header

The 2×3 pins near the centre — for advanced programming / shields. Beginners can ignore ICSP.

Reset button

Press to restart your sketch immediately without unplugging USB.

ON · L · TX · RX LEDs

ON = board has power. L = pin 13. TX/RX flicker when USB serial data moves.

8. Colour legend (matches the pinout)

Same colours as the diagram footer — in plain words:

  • Power — 3.3V, 5V, Vin, IOREF
  • GND — ground / 0 V return
  • GPIO — general digital in/out
  • PWM — dim / speed (~ pins)
  • ADC — analog read A0–A5
  • SPI — MOSI / MISO / SCK / SS
  • I2C — SDA / SCL
  • Interrupt — D2 / D3
  • UART — RX / TX serial
  • Control — Reset, etc.
  • NC — no connection

Try it: Blink already uses D13 — upload it and watch the L LED. Optional next step: wire a potentiometer (outer legs to 5V & GND, middle to A0), then analogRead(A0) and print the 0–1023 value in Serial Monitor.

How to install Arduino IDE

Use the official Arduino IDE 2.x — free for Windows, macOS, and Linux.

  1. Download from the official site: arduino.cc/en/software — pick Windows, macOS, or Linux.
  2. Install — run the installer (Windows), drag to Applications (Mac), or follow the Linux package steps on that page.
  3. Open Arduino IDE. You should see a blank sketch with setup() and loop().

Windows

Download the Windows Win 10 and newer installer, or the ZIP if you prefer portable.

macOS

Download the macOS (Apple Silicon or Intel) build and move the app into Applications.

Linux

AppImage or distro packages — see the same software page for your flavour.

Tip: always prefer the official download link above — avoid random “Arduino crack” sites.

USB drivers — why you need them

Your PC talks to the board over USB. A driver is the tiny translator that makes the board appear as a serial port (COM on Windows, /dev/cu… on Mac).

Official UNO

Genuine UNO boards often use an ATmega16U2 USB chip. Windows 10/11 usually install the driver automatically when you plug in.

CH340 clones

Many affordable “UNO-compatible” boards use a CH340 USB chip. If no COM port appears, install the CH340 driver from the board maker’s docs, then replug.

  1. Plug the UNO into USB with a data cable (not charge-only).
  2. Wait a few seconds — Windows often shows “setting up device.”
  3. Open Device Manager (Windows) → Ports (COM & LPT) and look for Arduino or USB-SERIAL CH340.
  4. If nothing appears: try another cable/port, then search for the correct driver for your board’s USB chip.

Troubleshooting mindset: no port → cable or driver. Port exists but upload fails → wrong board selected or wrong port. Fix one thing at a time.

Select board and serial port

Before Upload works, the IDE must know which hardware you have and which USB port it is on.

  1. Tools → Board → Arduino AVR Boards → Arduino Uno
  2. Tools → Port → pick your board — COMx on Windows, or something like /dev/cu.usbmodem… on Mac

Follow the highlighted menu steps — then try the interactive LED Blink demo below.

Step 1: Click Tools in the menu bar.

What is a library?

A library is a ready-made pack of code someone else wrote so you do not reinvent the wheel. Want to drive an OLED screen or read a DHT temperature sensor? Install the matching library and call a few functions.

Blink — no library

Turning pin 13 on and off uses built-in commands only. No extra install.

When you need one

Displays, complex sensors, Wi‑Fi shields, SD cards — anything with a protocol or lots of setup.

How to open it

Sketch → Include Library → Manage Libraries… Search, Install, then #include in your sketch.

In plain English: libraries are like apps for your sketch — install only what the project needs.

Blinking LED — your first sketch

The simplest win: make an LED flash. On the UNO you can use the built-in LED on pin 13 — no breadboard required. Or wire an external LED + series resistor between pin 13 and GND.

  1. File → Examples → 01.Basics → Blink
  2. Confirm Board = Arduino Uno and the correct Port
  3. Click the Upload button (right arrow) — wait for “Done uploading”
  4. Watch the “L” LED near pin 13 blink once per second

HIGH means the pin is on (near 5 V); LOW means off (near 0 V).

// Blink — built-in LED on pin 13
void setup() {
  pinMode(LED_BUILTIN, OUTPUT);  // pin 13 = output
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH); // LED on
  delay(1000);                     // wait 1 second
  digitalWrite(LED_BUILTIN, LOW);  // LED off
  delay(1000);                     // wait 1 second
}

Try it: LED Blink simulation

This mini board mimics pin 13 blinking with delay(1000). Press Start — watch the LED and the timeline. Change the delay to see slower or faster blinks.

Quick checklist

  • Know the pin map: left = power + A0–A5, right = D0–D13, USB on top (pinout tour)
  • Install IDE from arduino.cc/en/software
  • Plug board → wait for drivers → note the COM / cu port
  • Tools → Board → Arduino Uno · Tools → Port → your port
  • File → Examples → 01.Basics → Blink → Upload (D13 / L LED)
  • Libraries later — Blink needs none

In one sentence: Arduino = board + IDE + USB — learn where 5V, GND, and D13 live, pick Uno and the right port, upload Blink, and you’re ready for sensors and projects.