Hardware Atlas
Arduino
Arduino is an open-source microcontroller platform that lets you read sensors, control motors, and interface electronics with code. It is the most accessible entry point into hardware programming.
Arduino is a family of microcontroller boards with an IDE and a simplified programming environment. The board you write code for is an actual physical chip that runs your program directly — no operating system, no internet required. Connect sensors, LEDs, motors, or any electronic component, and your code controls them directly.
Your laptop runs thousands of programs simultaneously, manages memory, handles networking. An Arduino runs exactly one program, repeatedly, forever. It has no display, no keyboard, no filesystem. It is just: power on → run setup() once → loop() forever. This simplicity is what makes it perfect for controlling hardware.
Why we use it
- Immediate hardware access — write a program, upload it, the hardware responds in milliseconds
- Huge ecosystem — thousands of libraries for every sensor, motor, and display imaginable
- Cheap — original Arduino Uno is ~₹500–800. Clones are cheaper
- Good documentation — one of the best-documented platforms for beginners
- Industry standard — the concepts transfer to professional embedded systems
Working principle
Arduino boards contain an AVR or ARM microcontroller. When you upload code, it is flashed into the chip's non-volatile memory. When powered, the chip:
- Runs
setup()once — configure pins, start serial, initialise sensors - Runs
loop()repeatedly — forever, until power off
The microcontroller reads digital and analogue signals on its input pins and drives signals on output pins. This is the foundation of all physical computing.
Digital I/O pins 0–13 along the top edge (~ marks indicate PWM-capable pins). Analog inputs A0–A5 and power rail along the bottom. ATmega328P microcontroller in the centre. USB Type-B port for programming and serial communication.
Important parameters (Arduino Uno R3)
| Parameter | Value | Notes |
|---|---|---|
| Microcontroller | ATmega328P | 8-bit AVR |
| Operating voltage | 5V | Regulated |
| Digital I/O pins | 14 | 6 with PWM output |
| Analogue input pins | 6 | 10-bit resolution |
| Flash memory | 32 KB | 0.5 KB used by bootloader |
| SRAM | 2 KB | Runtime memory |
| Clock speed | 16 MHz | Crystal oscillator |
| USB connection | Type B | For programming and serial |
| DC current per I/O pin | 40 mA | Max — use resistors with LEDs |
Pinout overview
| Pin | Label | Type | Description |
|---|---|---|---|
| 5V | 5V | power | 5V regulated output — powers sensors |
| 3.3V | 3.3V | power | 3.3V output — 50 mA max |
| GND | GND | ground | Ground reference — multiple pins available |
| 0 | RX | communication | Serial receive — used for USB programming |
| 1 | TX | communication | Serial transmit |
| 2–13 | D2–D13 | digital | Digital input/output — HIGH or LOW |
| 3,5,6,9,10,11 | PWM | analog | PWM output — analogWrite() for motors, LEDs |
| A0–A5 | A0–A5 | analog | Analogue input — reads 0–5V as 0–1023 |
| A4 | SDA | communication | I2C data |
| A5 | SCL | communication | I2C clock |
Basic example code
Blink an LED on pin 13 (the built-in LED):
void setup() {
pinMode(13, OUTPUT); // configure pin 13 as output
}
void loop() {
digitalWrite(13, HIGH); // LED on
delay(1000); // wait 1 second
digitalWrite(13, LOW); // LED off
delay(1000); // wait 1 second
}
Read an analogue sensor and print to Serial Monitor:
void setup() {
Serial.begin(9600); // start serial at 9600 baud
}
void loop() {
int value = analogRead(A0); // read pin A0 (0–1023)
float voltage = value * (5.0 / 1023.0); // convert to volts
Serial.println(voltage); // print to serial monitor
delay(100);
}
How to test it
- Connect Arduino via USB
- Open Arduino IDE, select your board (Tools → Board → Arduino Uno)
- Select the correct port (Tools → Port)
- Upload the Blink example (File → Examples → Basics → Blink)
- The built-in LED on pin 13 should blink every second
- Never exceed 5V on digital pins — this will destroy the microcontroller
- Always use current-limiting resistors (220Ω–1kΩ) when connecting LEDs
- Never draw more than 40mA from a single I/O pin — use a transistor or motor driver for motors
- Do not reverse polarity — Arduino boards can be destroyed by reversed power connections
- Forgetting pinMode() — pins default to INPUT. If you want to drive an LED, set pinMode(pin, OUTPUT) in setup()
- Using delay() with sensors — delay() blocks everything. For precise timing, use millis()
- Not setting Serial baud rate — if Serial Monitor shows garbage, the baud rates don't match
- Driving motors directly from I/O pins — motors need more current than Arduino pins can provide. Use a motor driver (L298N, DRV8833)
- The Blink sketch uploads without errors
- The built-in LED blinks at 1Hz
- Serial Monitor shows expected values from analogRead()
- No pins get hot to the touch (sign of overcurrent)
Robotics and AI use cases
- Servo motor control — PWM signals to joint servos in robotic arms
- Sensor reading — reading IMUs, ultrasonic sensors, encoders for feedback
- Serial communication — bridge between Raspberry Pi (running AI) and physical actuators
- PID control — motor speed regulation using encoder feedback
Beginner project
Blink an LED with a button control.
Components: Arduino Uno, LED, 220Ω resistor, push button, breadboard, jumper wires.
Goal: LED is off by default. Press and hold the button → LED turns on. Release → LED turns off.
Advanced project
Build a servo arm controlled by a joystick.
Components: Arduino Uno, 2-axis joystick module, 2× servo motors, breadboard.
Goal: Joystick X-axis controls one servo, Y-axis controls the other. Smooth, proportional control using map() to convert 0–1023 to 0–180 degrees.