Back to courses
Part 1: Original Categories — Revised (courses 1–2660) beginner

Arduino and Raspberry Pi: the full picture

Duration0 hours
Modules7
ForGeneral public, lifelong learners
Video1-2min
Get started — free →

Course outline

Module 1 Module 1: Introduction to Microcontrollers vs. Single-Board Computers

Introduction to Microcontrollers vs. Single-Board Computers

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. Which of the following best describes a microcontroller?
  • A. A general-purpose computer that runs a full operating system like Linux or Windows
  • B. A small integrated circuit that combines a processor, memory, and programmable input/output pins on a single chip ✓
  • C. A cloud server that processes data remotely for connected devices
  • D. A graphics card designed to render images and video

Why: A microcontroller integrates a CPU, RAM, flash memory, and I/O peripherals on one chip, making it ideal for dedicated control tasks like reading sensors or driving motors. It typically runs a single program directly rather than a full operating system.

Q2. What is a key characteristic of a single-board computer (SBC) such as the Raspberry Pi?
  • A. It has no operating system and runs only one hardwired function
  • B. It runs a full operating system and can perform many general computing tasks ✓
  • C. It can only be programmed in assembly language
  • D. It requires a dedicated external server to function

Why: Single-board computers like the Raspberry Pi include a full processor, RAM, and storage on a board and can run complete operating systems such as Raspberry Pi OS or Linux, enabling multitasking, networking, and general-purpose computing.

Q3. Which statement correctly contrasts microcontrollers with single-board computers in terms of boot behavior?
  • A. Microcontrollers boot a full operating system from an SD card every time they power on
  • B. Microcontrollers typically start running their program almost immediately on power-up, while SBCs must boot an operating system first ✓
  • C. Both devices take the same amount of time to boot because they share the same architecture
  • D. SBCs start instantly, whereas microcontrollers need several minutes to initialize

Why: Microcontrollers execute their stored firmware directly from flash memory as soon as power is applied, giving near-instant startup. SBCs must load an operating system from storage, which takes noticeably longer.

Q4. A project needs to read a temperature sensor every second and switch a relay with precise, predictable timing. Which device is generally the better choice?
  • A. A Raspberry Pi running a desktop environment
  • B. A microcontroller such as an Arduino ✓
  • C. A laptop connected over Wi-Fi
  • D. A cloud-hosted virtual machine

Why: Microcontrollers offer deterministic, real-time behavior because they run a single program without an operating system scheduler competing for CPU time. This makes them well suited to precise timing of sensor reads and actuator control.

Q5. Which of the following is a typical advantage of microcontrollers over single-board computers for battery-powered devices?
  • A. They have far more RAM and storage capacity
  • B. They consume very little power, which extends battery life ✓
  • C. They can run video editing software efficiently
  • D. They always include a built-in HDMI display output

Why: Microcontrollers are designed for low power consumption, often drawing only milliamps and supporting sleep modes. This makes them ideal for battery-operated sensors and wearables, whereas SBCs generally draw considerably more power.

Module 2 Module 2: Arduino Fundamentals: Setup, Sketches, and Digital I/O

Arduino Fundamentals: Setup, Sketches, and Digital I/O

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. What is the function of the setup() function in an Arduino sketch?
  • A. It runs repeatedly after the program starts, forming the main loop of the program.
  • B. It runs once when the board powers up or resets, and is used to configure pins and initialize settings. ✓
  • C. It is required to upload the sketch to the board over USB.
  • D. It is used to send data from the Arduino to the computer's serial monitor.

Why: The setup() function runs exactly once at startup or after a reset. It is where you typically configure pin modes and initialize serial communication. The loop() function is the one that runs repeatedly.

Q2. Which function call configures pin 8 as an output on an Arduino?
  • A. digitalWrite(8, OUTPUT);
  • B. pinMode(8, OUTPUT); ✓
  • C. analogWrite(8, OUTPUT);
  • D. setPin(8, OUTPUT);

Why: pinMode(pin, mode) sets a pin to INPUT, OUTPUT, or INPUT_PULLUP. digitalWrite sets the level of a pin that is already configured as an output, and analogWrite produces PWM output. setPin is not a standard Arduino function.

Q3. What voltage level does a digital pin read as HIGH on a standard 5V Arduino Uno?
  • A. Any voltage above 0V
  • B. Approximately 3.3V and above ✓
  • C. Exactly 5V only
  • D. Approximately 2.5V and above, regardless of board voltage

Why: On a 5V Arduino Uno, the digital input threshold for HIGH is roughly 60 percent of VCC, which is about 3V, so values around 3.3V and above are read as HIGH. Exactly 5V is not required, and the threshold is tied to the board's supply voltage.

Q4. What is the purpose of a current-limiting resistor when connecting an LED to an Arduino digital pin?
  • A. It increases the brightness of the LED.
  • B. It converts the digital signal into an analog signal.
  • C. It prevents excessive current from flowing through the LED and the Arduino pin, protecting both. ✓
  • D. It allows the LED to be powered directly from the USB port.

Why: An LED has very low resistance once it begins conducting, so without a series resistor it can draw more current than the Arduino pin can safely supply, potentially damaging the LED or the pin. The resistor limits the current to a safe value.

Q5. Which statement about the Arduino IDE workflow is correct?
  • A. Sketches are compiled and uploaded to the board, where they are stored in flash memory and run after reset. ✓
  • B. Sketches run live on the computer and only send commands to the Arduino over USB.
  • C. Sketches are stored permanently in the board's RAM and are lost when the board is unplugged.
  • D. Sketches must be written in Python before they can be uploaded to the Arduino.

Why: When you click upload, the IDE compiles the sketch into machine code and writes it to the microcontroller's flash memory. The program then runs on the board itself, persists through power cycles, and does not depend on the computer after upload.

Module 3 Module 3: Analog Sensing, PWM, and Interfacing with Actuators

Analog Sensing, PWM, and Interfacing with Actuators

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. Which Arduino function reads a voltage on an analog pin and returns a value between 0 and 1023 for a 10-bit ADC?
  • A. digitalRead()
  • B. analogRead() ✓
  • C. analogWrite()
  • D. pinMode()

Why: analogRead() samples the voltage on an analog input pin using the 10-bit ADC, mapping 0 V to 0 and the reference voltage (typically 5 V) to 1023. digitalRead() only returns HIGH or LOW, and analogWrite() outputs PWM rather than reading input.

Q2. What does PWM stand for, and what does it control?
  • A. Pulse Width Modulation; the average power delivered by varying the duty cycle of a digital signal ✓
  • B. Parallel Wave Multiplexing; the frequency of an analog signal
  • C. Positive Voltage Matching; the amplitude of a sine wave
  • D. Programmable Waveform Monitor; the resolution of an ADC

Why: Pulse Width Modulation switches a digital output between HIGH and LOW rapidly, and the ratio of HIGH time to total period (the duty cycle) sets the effective average voltage. This is how analogWrite() simulates an analog level on a digital pin.

Q3. An Arduino Uno's analogWrite() on a PWM pin is called with a value of 128. Approximately what duty cycle does this produce?
  • A. 0%
  • B. 25%
  • C. 50% ✓
  • D. 100%

Why: analogWrite() accepts values from 0 to 255 for 8-bit PWM. A value of 128 is roughly half of 255, producing about a 50% duty cycle and an average output near 2.5 V on a 5 V board.

Q4. Why should you not drive a DC motor directly from an Arduino digital pin?
  • A. Digital pins cannot output PWM signals
  • B. The motor's current draw can exceed the pin's safe limit (around 20 mA per pin) and may damage the microcontroller ✓
  • C. Motors only accept analog input voltages
  • D. The Arduino cannot run at the speed a motor requires

Why: Arduino GPIO pins supply only tens of milliamps, while motors often draw hundreds of milliamps or more, especially at startup. A transistor, MOSFET, or motor driver should switch the motor, with the Arduino controlling only the low-current gate or input signal.

Q5. When using a potentiometer as a voltage divider connected to an analog pin, what is the purpose of the wiper terminal?
  • A. It supplies power to the Arduino
  • B. It provides a variable voltage between 0 V and the supply voltage that the analog pin can read ✓
  • C. It sets the PWM frequency of the board
  • D. It acts as a ground reference for all sensors

Why: The potentiometer's wiper moves along the resistive track, producing a voltage that varies between GND and VCC depending on its position. Connecting the wiper to an analog input lets analogRead() measure the knob position.

Module 4 Module 4: Raspberry Pi Setup: Linux, GPIO, and Networking

Raspberry Pi Setup: Linux, GPIO, and Networking

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. Which command is the standard way to update the list of available packages on a Raspberry Pi running Raspberry Pi OS?
  • A. apt upgrade
  • B. sudo apt update ✓
  • C. sudo apt install update
  • D. pip update

Why: sudo apt update refreshes the local package index from the repositories. It does not install anything itself; sudo apt upgrade is then used to install the newer versions of installed packages.

Q2. On the 40-pin GPIO header of a Raspberry Pi, which pin type provides a fixed 3.3V supply?
  • A. Ground pins
  • B. 5V pins only
  • C. 3.3V pins (for example pin 1 and pin 17) ✓
  • D. GPIO pins configured as outputs

Why: The Raspberry Pi header includes dedicated 3.3V power pins, such as pins 1 and 17. The GPIO pins are 3.3V logic and must never be driven with 5V signals.

Q3. What is the default networking mode on Raspberry Pi OS that automatically assigns an IP address to the device?
  • A. Static IP addressing
  • B. DHCP ✓
  • C. NAT gateway mode
  • D. Bridge mode

Why: Raspberry Pi OS uses DHCP by default, so the router assigns the Pi an IP address automatically when it connects to the network.

Q4. Which command shows the current IP address assigned to the Raspberry Pi's network interfaces?
  • A. ip address (or ip a) ✓
  • B. ls -la
  • C. ping localhost only
  • D. df -h

Why: The ip address command (abbreviated ip a) lists all network interfaces along with their assigned IP addresses. ls lists files, ping tests connectivity, and df reports disk usage.

Q5. Which Linux command is used to enable SSH access to a Raspberry Pi from the command line using the raspi-config tool?
  • A. sudo raspi-config, then Interface Options and then SSH ✓
  • B. sudo nano /etc/ssh/enable
  • C. apt install ssh-enable
  • D. gpio enable ssh

Why: Running sudo raspi-config opens the configuration menu, where Interface Options contains the SSH setting that enables remote login.

Module 5 Module 5: Serial, I2C, and SPI Communication Between Boards

Serial, I2C, and SPI Communication Between Boards

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. Which communication protocol transmits data one bit at a time over a single data line, with separate TX and RX lines for full-duplex operation?
  • A. I2C
  • B. SPI
  • C. UART (Serial) ✓
  • D. 1-Wire

Why: UART (commonly called Serial on Arduino and Raspberry Pi) uses separate TX and RX lines, allowing simultaneous sending and receiving, and transmits data bit by bit without a shared clock signal.

Q2. How many wires are minimally required for an I2C bus connecting a master and a slave device?
  • A. One wire
  • B. Two wires ✓
  • C. Three wires
  • D. Four wires

Why: I2C uses just two wires: SDA (serial data) and SCL (serial clock). Both lines are open-drain and need pull-up resistors.

Q3. In SPI communication, what is the role of the chip select (CS or SS) line?
  • A. It sets the data transfer speed in bits per second
  • B. It tells the slave device when it is being addressed by the master ✓
  • C. It provides the clock signal for synchronization
  • D. It stores the device's unique I2C address

Why: The chip select line is pulled LOW by the master to select a particular slave device, so only that slave responds to the transfer on the shared MOSI, MISO, and SCK lines.

Q4. When connecting a Raspberry Pi to an Arduino over UART, what must be done with the TX and RX pins?
  • A. Connect TX to TX and RX to RX
  • B. Connect TX on one board to RX on the other, and RX to TX ✓
  • C. Connect both TX and RX to ground
  • D. Connect TX and RX to a 5V supply

Why: UART requires a crossover connection: the transmitter of one device connects to the receiver of the other, and vice versa. Also, the boards must share a common ground.

Q5. Why is a logic level converter often needed when connecting a 5V Arduino to a 3.3V Raspberry Pi over serial or I2C?
  • A. The Raspberry Pi cannot communicate at any voltage other than 5V
  • B. Arduino Uno's logic output is 5V, which can damage the Raspberry Pi's 3.3V GPIO pins ✓
  • C. Logic level converters increase the baud rate of the connection
  • D. I2C requires 12V signaling to function correctly

Why: Raspberry Pi GPIO pins are not 5V tolerant, so applying 5V signals from an Arduino Uno can damage them. A logic level converter safely shifts the voltage levels between the two.

Module 6 Module 6: Connecting Arduino and Raspberry Pi in Real Projects

Connecting Arduino and Raspberry Pi in Real Projects

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. Which communication protocol is commonly used to connect a Raspberry Pi to an Arduino over a simple serial link?
  • A. USB serial (UART) communication ✓
  • B. Bluetooth Low Energy only
  • C. HDMI signaling
  • D. Wi-Fi direct mode only

Why: USB serial (UART) is the most common and straightforward way to exchange data between a Raspberry Pi and an Arduino. The Arduino appears as a serial device on the Pi, which can read and write to it using standard tools or libraries.

Q2. Why is it important to share a common ground between a Raspberry Pi and an Arduino when wiring them directly with GPIO or serial pins?
  • A. It increases the Wi-Fi signal strength
  • B. It gives both boards a shared voltage reference so signal levels are interpreted correctly ✓
  • C. It speeds up the clock frequency of both boards
  • D. It prevents the Arduino from needing a power supply

Why: Connecting grounds together ensures both devices measure logic levels relative to the same reference. Without a shared ground, signals can be misread or the communication may fail entirely.

Q3. What is a key voltage concern when connecting an Arduino Uno's 5V logic output directly to a Raspberry Pi GPIO pin?
  • A. The Raspberry Pi GPIO pins are 3.3V and are not 5V tolerant, so 5V signals can damage them ✓
  • B. The Arduino cannot output any digital signal
  • C. The Raspberry Pi requires 12V on its GPIO pins
  • D. There is no voltage difference between the two boards

Why: Raspberry Pi GPIO pins operate at 3.3V and are not designed to tolerate 5V inputs. A level shifter or voltage divider is needed to safely interface a 5V Arduino output with the Pi.

Q4. Which Python library is commonly used on a Raspberry Pi to read and write data over a serial connection to an Arduino?
  • A. pyserial ✓
  • B. numpy
  • C. matplotlib
  • D. requests

Why: The pyserial library provides a simple interface for opening serial ports, sending bytes, and reading responses. It is widely used for communicating with Arduino boards from a Raspberry Pi.

Q5. In a typical Raspberry Pi and Arduino project, what is the main role of the Arduino?
  • A. Running a full Linux operating system with a web server
  • B. Handling real-time sensor reading and actuator control with precise timing ✓
  • C. Acting as the primary internet gateway for the network
  • D. Storing large video files

Why: The Arduino excels at real-time, deterministic tasks like reading sensors and driving motors. The Raspberry Pi typically handles higher-level processing, networking, and user interfaces, so the two complement each other well.

Module 7 Module 7: Deploying IoT Systems: Power, Enclosures, and Reliability

Deploying IoT Systems: Power, Enclosures, and Reliability

Introduction

Core content I

Core content II

Core content III

Summary

Further learning

Knowledge check

Q1. Why is it generally recommended to power a Raspberry Pi with a dedicated 5V supply rated at 2.5A or more rather than from a USB port on a laptop?
  • A. Laptop USB ports cannot carry any current at all
  • B. Laptop USB ports often cannot supply enough sustained current, which can cause undervoltage and unstable behavior ✓
  • C. The Raspberry Pi requires 12V and laptop ports only provide 5V
  • D. Dedicated supplies are required to enable the GPIO pins

Why: A Raspberry Pi, especially models with peripherals attached, can draw more current than many laptop USB ports supply. When voltage drops below the required level, the Pi may throttle, reboot, or show an undervoltage warning. A dedicated 5V supply rated at 2.5A or more provides stable power.

Q2. What is the main purpose of a fuse or polyfuse placed in series with the power input of an IoT device?
  • A. To increase the voltage supplied to the device
  • B. To store energy during brief power interruptions
  • C. To interrupt the circuit and protect against overcurrent conditions such as shorts ✓
  • D. To convert AC power into DC power

Why: A fuse or resettable polyfuse limits current flow and opens the circuit when current exceeds a safe threshold, protecting wiring, the power supply, and components from damage due to shorts or faults.

Q3. Why should an outdoor IoT enclosure have ventilation or heat dissipation considerations even if it is weatherproof?
  • A. Sealed enclosures prevent the device from receiving any signals
  • B. Electronics generate heat, and trapped heat can cause overheating and reduce reliability ✓
  • C. Ventilation is needed to supply oxygen to the processor
  • D. Weatherproof enclosures must be filled with air to stay rigid

Why: Electronic components produce heat during operation. A fully sealed enclosure can trap this heat, raising internal temperatures and shortening component life or causing throttling and failures. Designers balance sealing against thermal management, using heatsinks, vents with filters, or enclosure materials that conduct heat.

Q4. Which practice most improves the reliability of an unattended Raspberry Pi running an IoT application?
  • A. Disabling the watchdog timer so the system never resets unexpectedly
  • B. Using a hardware or software watchdog so the system can recover automatically from a hang ✓
  • C. Running the device with the maximum CPU frequency at all times
  • D. Removing the SD card reader to prevent accidental removal

Why: A watchdog timer resets the system if it stops responding, allowing unattended devices to recover from software hangs without manual intervention. Disabling it removes this safety net, while maximum clock speed increases heat and power draw.

Q5. A battery-powered Arduino sensor node is expected to run for months. Which strategy most effectively extends battery life?
  • A. Keeping the microcontroller in active mode and polling the sensor continuously
  • B. Using a larger LED indicator to show the device is working
  • C. Placing the microcontroller in a low-power sleep mode between sensor readings ✓
  • D. Increasing the operating voltage to speed up each measurement

Why: Microcontrollers consume far less power in sleep modes than in active operation. Duty-cycling the device so it wakes only to take and transmit readings dramatically reduces average current draw, which is the key to multi-month battery life.

Stay in the loop on this course.

We’ll email you when new modules or related material drops. No spam.

Built with Fragment Language. Sovereign architecture — no third-party trackers.
FragRun.mfgAFImemoryFGOwnership: B-Systems.ee