Robotics & Arduino Comprehensive Study Notes

Robotics: Foundational Ideas

  • Definition: Robotics is the technology branch dedicated to designing, building, and operating robots—machines that can work autonomously or under human control.

  • Core goals
    • Automate repetitive / dangerous tasks.
    • Extend human capability (precision, speed, endurance).

  • Ethical & societal angles
    • Job displacement vs. job creation in advanced manufacturing.
    • Safety standards for human–robot interaction (collaborative robots / cobots).
    • Responsibility for autonomous‐system decisions (AI ethics, liability).

  • Real-world relevance
    • Industrial automation, medical surgery robots, service robots, exploration rovers.

Microcontrollers: “Single-Chip Computers”

  • Formal definition: A microcontroller (MCU) is a compact IC that combines processor, memory, and peripherals on one die, optimized for embedded control.

  • Key internal blocks
    • CPU core (8-bit, 32-bit, etc.).
    • Flash program memory.
    • SRAM + sometimes EEPROM.
    • I/O ports, timers, ADC, communication interfaces.

  • Popular families mentioned
    • MICROCHIP ATmega328/328P, ATmega2560, PIC16F54.
    • Atmel SAM4L (32-bit ARM).

  • Why MCUs matter to robotics
    • Enable low-cost brain for each robot subsystem.
    • Deterministic control loops (real-time).
    • Low power for battery operation.

Arduino Platform Overview

  • Origins
    • Created in Italy, 2005\text{Italy, 2005} by Massimo Banzi (with David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis).

  • Mission: Democratize embedded electronics for artists, designers, hobbyists, and students—"teach students to create electronics, fast."

  • Ecosystem elements
    • Open-source hardware schematics.
    • Arduino IDE (C/C++–based, simplified).
    • Extensive community libraries & examples.
    • Boards spanning tiny wearable to industrial.

Main Arduino Board Families & Typical Use-Cases

  • Arduino Mega 2560
    • MCU: ATmega2560.
    • I/O: 5454 digital, 1616 analog, 44 UARTs.
    • Strengths: Robotics with many sensors/actuators, 3-D printers, complex algorithms requiring large memory.

  • Arduino Uno
    • MCU: ATmega328P.
    • “Iconic” entry-level board.
    • Uses: Simple control systems, basic robots, LED art, sensor interfacing.

  • Arduino Nano
    • MCU: ATmega328P, breadboard-friendly 45 mm×18 mm45\,\text{mm}\times18\,\text{mm}.
    • Advantages: Compact, cheaper than Uno, identical core capability, perfect for wearables / permanent installs.
    • Widely used in DIY, education, home automation.

Deep Dive: Arduino Nano Hardware

Physical Layout & Major Parts

  • ATmega328P MCU – the “brain.”

  • Mini-B USB jack – power 5 V5\,\text{V} + programming + serial comms.

  • VIN pin – accepts 7–12 V7\text{–}12\,\text{V} unregulated; feeds onboard voltage regulator (steps to 5 V5\,\text{V}).

  • FT232RL / CH340G – USB-to-Serial converter (“translator”).

  • 16 MHz crystal / ceramic resonator – precise clock “heartbeat.”

  • Reset push-button – manual reboot for debugging.

  • LEDs
    • PWR – board powered.
    • L – user programmable (D13).
    • TX/RX – serial activity.

  • ICSP 6-pin header – in-circuit programming, burn bootloader; pins MISO,VCC,SCK,MOSI,RESET,GND{\text{MISO},\text{VCC},\text{SCK},\text{MOSI},\text{RESET},\text{GND}}.

Memory Map of ATmega328P

Memory

Size

Volatility

Purpose

Flash

32 KB32\,\text{KB} ( 0.5–2 KB0.5\text{–}2\,\text{KB} bootloader occupied)

Non-volatile

Stores the sketch code.

SRAM

2 KB2\,\text{KB}

Volatile

Runtime variables & stack.

EEPROM

1 KB1\,\text{KB}

Non-volatile

Store settings (scores, calibration).

Formula for total non-volatile memory available to user program:
\text{Flash_user}=32\,\text{KB}-\text{Bootloader_size}
(e.g., ≈30 KB\approx30\,\text{KB} when bootloader =2 KB=2\,\text{KB}).

Power Constraints

  • Absolute max per-pin current 40 mA40\,\text{mA} (recommended 20 mA20\,\text{mA}).

  • Absolute max total package 200 mA200\,\text{mA}.

  • Groups of pins should not together exceed 100 mA100\,\text{mA}.

Nano Pinout & Special Functions

  • Digital I/O pins D0–D13
    • Standard HIGH/LOW control & read.
    • PWM capable: D3,D5,D6,D9,D10,D11{D3,D5,D6,D9,D10,D11} (\sim symbol).
    • Serial: D0 (RX), D1 (TX).
    • SPI: D10 (SS), D11 (MOSI), D12 (MISO), D13 (SCK).

  • Analog pins A0–A7
    • 1010-bit ADC → value 0–10230\text{–}1023 mapping input 0–5 V0\text{–}5\,\text{V}.
    • Also usable as extra digital pins if ADC unused.
    • I2C: A4 (SDA), A5 (SCL).

  • Reference lines
    • 3.3 V3.3\,\text{V} output, AREF for external analog reference.

Communication Protocol Analogies

  • UART (Serial) – one-to-one “email thread.”

  • SPI – fast “conference call”; SCK provides rhythm, SS selects device.

  • I2C – two-wire “polite network” with addresses; many devices share bus.

Sensor Fundamentals

  • Definition: A sensor “listens” to the environment and converts a physical phenomenon → electrical signal. They are the robot’s “eyes & ears.”

  • Process

    1. Connect sensor output to Arduino input (analog/digital).

    2. Arduino reads voltage/current.

    3. Code converts raw value to meaningful unit (°C, cm, %RH, etc.).

Common Sensor Categories & Examples

  • Environmental
    • Temperature: LM35, DS18B20, DHT11/DHT22.
    • Humidity: DHT11/D22, capacitive soil probes.
    • Pressure/Altitude: BMP180, BME280.
    • Gas: MQ-2 (smoke), MQ-7 (CO).
    • Water level, soil moisture.

  • Motion / Proximity
    • PIR motion sensor.
    • Ultrasonic HC-SR04.
    • IR obstacle sensor.
    • Accelerometer/Gyro MPU6050.

  • Other
    • Light: LDR photoresistor.
    • Sound: Microphones, sound sensor boards.
    • Force/Pressure, Hall effect (magnetic), flex, color.

  • 37-in-1 sensor kit lists joystick, flame, tilt, heartbeat, hall, reed, rotary encoder, etc.—rich starter set.

Actuator Fundamentals

  • Definition: Output devices that convert electrical signals → physical action; the robot’s “muscles.”

  • Driving considerations
    • Many actuators need more current/voltage ⇒ use drivers (L298N motor H-bridge, MOSFET, relay).

  • Working cycle

    1. Arduino outputs PWM/digital level.

    2. Driver amplifies.

    3. Actuator performs motion/light/sound/heat.

Common Actuator Types & Examples

  • Motors
    • DC motor (speed via PWM).
    • Servo (position 0∘!–180∘0^{\circ}!\text{–}180^{\circ}).
    • Stepper (precise steps).
    • Linear actuators (push/pull).

  • Lights/Displays
    • LEDs, RGB LEDs, addressable strips.
    • LCD 1602, OLED SSD1306.

  • Sound
    • Passive/active buzzers, speakers for tones / audio.

  • High-power switching
    • Relays, solid-state relays (SSR).

  • Misc.
    • Solenoids (locks, dispensers).
    • Pumps (liquid transfer).
    • Heaters (PID temperature control).

Practical Integration Tips & Connections to Fundamentals

  • From prior electronics lectures:
    • Ohm’s Law V=IRV=IR – size series resistors for LEDs.
    • PWM duty cycle D=t<em>HIGHTD=\frac{t<em>{\text{HIGH}}}{T} controls average voltage. • ADC quantization: Resolution =V</em>ref210−1≈4.9 mV=\frac{V</em>{\text{ref}}}{2^{10}-1}\approx4.9\,\text{mV} on 5 V5\,\text{V} Nano.

  • Debugging workflow
    • Use Serial Monitor to print sensor values (TX/RX).
    • Reset button to restart sketch after changes.

  • Bootloader role
    • Small program in flash enabling code upload over UART without external programmer.
    • On Nano, bootloader size 0.5–2 KB0.5\text{–}2\,\text{KB}.

  • Memory budgeting
    • Keep global variables < SRAMtot\text{SRAM}_{\text{tot}} to avoid crashes.
    • Store constant lookup tables in PROGMEM (flash).
    • Write rarely-changed config to EEPROM.

Sample Exam “Recall Checkpoint” Answers

  • What is Robotics?
    → Technology field focused on design/build/operation of robots (autonomous or tele-operated).

  • Italian creator of Arduino?
    → Massimo Banzi.

  • Three Arduino boards
    → Uno, Mega 2560, Nano (others: Leonardo, Lilypad, Pro Mini).

  • Processor used by many Arduinos?
    → ATmega328P (Uno/Nano) or ATmega2560 (Mega).

  • Different memories in Arduino?
    → Flash, SRAM, EEPROM.

  • Memory sizes in Arduino Nano
    → Flash 32 KB32\,\text{KB}, SRAM 2 KB2\,\text{KB}, EEPROM 1 KB1\,\text{KB}.

  • Bootloader size requirement
    → 0.5–2 KB0.5\text{–}2\,\text{KB} (commonly 2 KB2\,\text{KB} for Optiboot).

Generalization & Project Design Flow

  1. Sense (input) – choose appropriate sensors.

  2. Compute – process/decide inside microcontroller; respect memory & timing budgets.

  3. Act (output) – drive actuators safely (drivers/relays).

  4. Iterate – feedback loop for closed-loop control (PID, state machines).

  5. Document & share – open-source ethos of Arduino community encourages collaboration.

With these detailed points, you can confidently replace the original slide deck while preparing for exams or building actual projects.