Theory
The board that does one thing, forever
Not every SmartHostel job needs a computer. A battery room-node must do something dead simple: read the temperature every minute, blink an LED if it is too hot, and sip almost no power so its cell lasts a year.
A Raspberry Pi here is absurd overkill: an OS booting for a year to blink an LED, draining batteries in a day. The right tool is the Arduino: not a computer at all, but a tiny MICROCONTROLLER that runs ONE simple program, reliably, on a whisper of power. This is the Pi's opposite, and its perfect complement.
Theory
Arduino, formally
The Arduino is an open-source electronics platform (hardware AND software) built around a microcontroller (the Arduino Uno uses an ATmega328P chip).
The defining fact: it has NO operating system. It runs a single program: a sketch: directly on the chip, repeating forever. No multitasking, no files, no Linux: just your code, on the metal, in real time.
That simplicity IS its purpose: to make sensing and controlling easy, cheap, precise-in-timing and extremely low-power. It does not COMPUTE much; it SENSES and CONTROLS beautifully.
Practical
The shape of every sketch: setup once, loop forever
// Arduino sketch: no operating system, just this, on the chip.
int tempPin = A0; // analog input (built-in ADC reads it)
int ledPin = 13; // digital output
void setup() { // runs ONCE at power-on
pinMode(ledPin, OUTPUT);
}
void loop() { // runs FOREVER
int reading = analogRead(tempPin); // ADC: voltage -> number
if (reading > 600) { // too hot?
digitalWrite(ledPin, HIGH); // alert LED on
} else {
digitalWrite(ledPin, LOW);
}
delay(60000); // wait a minute, then loop again
}
Theory
setup and loop: the whole model
Every Arduino sketch has exactly 2 functions, and they ARE the mental model:
- setup() runs once at power-on: configure pins, start things
- loop() runs forever after that: the endless sense-decide-act cycle
There is no main(), no return to an OS, because there IS no OS to return to: the chip just repeats loop() until the power dies. Note also analogRead: the Arduino has a built-in ADC (the analog-to-digital converter from the sensor lesson), so it reads analog sensors directly: one reason it is so beginner-friendly for sensing.
Quiz
What is the defining difference between an Arduino and a Raspberry Pi?
- The Arduino is more powerful and runs heavier programs
- The Arduino is a microcontroller with NO operating system, running one sketch; the Pi is a computer with an OS
- The Arduino cannot read sensors
- The Arduino runs the Windows operating system
Show the answer
The Arduino is a microcontroller with NO operating system, running one sketch; the Pi is a computer with an OS
The Arduino is a bare microcontroller: no OS, one sketch (setup + loop) on the chip: while the Pi is a full computer running Linux. That OS-versus-no-OS split is THE distinction and the root of every other difference (power, real-time, compute). Option A inverts it: the Arduino is far LESS powerful, and deliberately so. Option C is false: reading sensors, with a built-in ADC, is exactly what it excels at. Option D is nonsense: it runs no OS at all, let alone Windows. Keep the pair: Arduino = microcontroller, no OS; Pi = computer, with OS.
Think first
Why Arduino for the battery room-node?
The room-node just reads temperature and blinks an alert, on a coin cell for a year. Give the 3 Arduino traits that make it right here, each contrasting with what a Pi would do wrong. Then tap.
Show the answer
(1) Ultra-low power: a microcontroller sips microamps and can deep-sleep between readings: a year on a cell; a Pi booting Linux would drain that cell in hours. (2) Real-time reliability: no OS means no background processes, no boot, no crash-to-desktop: the loop just runs, forever, predictably: ideal for a set-and-forget sensor. (3) Simplicity and cost: the job is trivial (read, compare, blink); the Arduino matches it cheaply, where a Pi's computer power sits wasted. The rule the whole unit is building to: match the board to the job: simple/low-power/real-time = Arduino; compute/OS/networking = Pi.
Watch out
Arduino slips
"The Arduino runs an OS": it does NOT: one sketch on the chip, no operating system: the defining trait.
Expecting heavy compute: no face recognition, no databases: it senses and controls; heavy jobs are the Pi's.
Forgetting setup/loop: the sketch model (setup once, loop forever) is examinable; there is no main().
Missing the built-in ADC: the Arduino reads analog sensors directly via analogRead: a real convenience worth naming.
Theory
Two boards, one decision
You now hold both boards clearly: the Pi, a computer that can poke pins; the Arduino, a pin-poker that is barely a computer at all. Neither is better: they are different tools for different jobs, and real projects often use BOTH (Arduinos as cheap sensor nodes reporting to a Pi gateway). The unit's final lesson makes the contrast a decision table: the difference between Raspberry Pi and Arduino, and how to choose: next.
Summary
Key takeaways
- The Arduino is an open-source microcontroller platform (hardware + software), e.g. the Uno's ATmega328P.
- It has NO operating system: it runs a single sketch directly on the chip, forever.
- A sketch is setup() (runs once) + loop() (runs forever): the endless sense-decide-act cycle; no main().
- It excels at real-time sensing and control, precise timing, and very low power; it has a built-in ADC (analogRead).
- It is NOT for heavy computing: no databases, no image recognition (those are the Pi's).
- Application areas: sensor prototypes, robotics, wearables, home-automation gadgets, data-logging, education.
- Memory hook: Arduino = a reliable little brain that does one thing forever on almost no power.