Showing posts with label IoT. Show all posts
Showing posts with label IoT. Show all posts

Friday, 27 November 2026

ECG, EEG, EMG and PPG Sensors: How They Work and How to Interface Them with ESP32

Standard

 

Your body is a quiet radio. The heart, brain, muscles, eyes, and skin all produce tiny electrical or optical signals. Hospitals read them with clinical machines. Makers now read a simplified version of the same idea with breakout boards and an ESP32. That does not make a hobby kit a medical device. It does make the signals learnable, if you put the right Analog Front-End (AFE) between the electrode and the microcontroller.

This post covers ten common electrical and physiological sensors: ECG, EEG, EMG, EOG, ERG, EGG, ENG, EDA/GSR, bioimpedance (BIA/ICG), and PPG. It then answers the practical question: can they all talk to an ESP32? Yes, with an AFE or a dedicated breakout. Direct electrode-to-GPIO wiring is how you get noise, bad data, and, if you stay plugged into mains, a safety problem (SparkFun, 2024; Texas Instruments, 2017).

Key Abbreviations in This Post

  • ECG (Electrocardiography): Electrical activity of the heart.
  • EEG (Electroencephalography): Brain-wave activity from the scalp.
  • EMG (Electromyography): Electrical activity of skeletal muscle.
  • EOG (Electrooculography): Potential changes around the eyes from eye movement.
  • ERG (Electroretinography): Electrical response of the retina to light.
  • EGG (Electrogastrography): Slow electrical rhythms of the stomach.
  • ENG (Electroneurography): Conduction along peripheral nerves, often with a stimulus.
  • EDA / GSR: Electrodermal activity / galvanic skin response. Skin conductance from sweat glands.
  • BIA / ICG: Bioimpedance analysis / impedance cardiography. How tissue resists a tiny AC current.
  • PPG (Photoplethysmography): Optical measure of blood-volume change, heart rate, and often SpO₂.
  • AFE (Analog Front-End): The amp, filter, and often ADC chip between electrodes and a microcontroller.
  • ESP32: Espressif Wi-Fi/BLE microcontroller family, common in battery-powered IoT projects.
  • ADC: Analog-to-digital converter. Turns a voltage into a number.

The One-Minute Version

  • Ten signals, two physics stories: most are biopotentials (microvolts to millivolts). PPG is light. BIA injects a safe AC current and measures impedance.
  • ESP32 can host all of them if an AFE or breakout sits in the middle. Never wire bare electrodes to ADC pins and call it done.
  • Easy start: AD8232 (ECG), MyoWare (EMG), BioAmp EXG (ECG/EMG/EOG/EEG-class), Grove GSR (EDA), MAX30102 (PPG).
  • Harder: EGG, BIA/ICG, ENG, ERG. Same ESP32, more specialized chips, filters, electrodes, or a stimulator.
  • Safety rule: while electrodes are on a person, power from a battery and send data over Wi-Fi or BLE. Unplug USB from the wall and from a charging laptop (SparkFun, 2024).
  • Scope: education, research prototypes, and wearables experiments. Not diagnosis or treatment.
Ten body signals: ECG EEG EMG EOG ERG EGG ENG EDA BIA PPG

What These Sensors Actually Measure

Clinicians group them by organ. Engineers group them by signal size and frequency. Both views help when you pick an AFE.

Signal, roughly where it lives, roughly how big Sensor Source Typical use Order of size ECG Heart muscle Rhythm, rate, waveform ~0.5 to 5 mV EEG Brain (scalp) Sleep, seizures, attention ~10 to 100 µV EMG Skeletal muscle Activation, fatigue, rehab ~50 µV to few mV EOG Eye dipole Gaze, blinks, REM sleep ~0.05 to 3.5 mV ERG Retina Photoreceptor response µV to low mV EGG Stomach Gastric slow waves ~100 to 500 µV ENG Peripheral nerve Conduction speed/strength µV range + stimulus EDA/GSR Sweat glands Stress, arousal Conductance change BIA/ICG Tissue / blood Composition, stroke volume Impedance ohms PPG Blood volume (light) HR, SpO₂, wearables Optical, not volts Rule of thumb Smaller and slower signals need more gain, quieter ADCs, and better filtering. EEG and EGG are harder than ECG. PPG is easiest for a first ESP32 wearable.
Body map of where ECG EEG EMG EOG and other biosignals are measured

Each Sensor, From Basics to Use

ECG: heart electricity

ECG records the depolarization wave as it moves through the atria and ventricles. A basic single-lead hobby setup shows rate and a rough QRS shape. A clinical 12-lead study maps the heart in more detail for ischemia and rhythm diagnosis (Goldberger et al., 2017). On an ESP32, the common module is the Analog Devices AD8232 heart-rate monitor front-end: three disposable electrodes, an analog output into an ADC pin (Analog Devices, 2012).

EEG: brain waves from the scalp

EEG is smaller than ECG by an order of magnitude or more. Frequency bands (delta, theta, alpha, beta, gamma) get used in sleep studies, epilepsy work, and research BCIs. A DIY board will not replace a clinical EEG lab. It can teach sampling, referencing, and how much 50/60 Hz mains noise lives on a scalp (Niedermeyer & Lopes da Silva, 2005). Multi-channel setups often use the TI ADS1299 over SPI.

EMG: muscle activation

Surface EMG listens to motor-unit firing under the skin. Rehab, gesture control, and sports science all use it. MyoWare-class modules rectify and smooth the signal into an envelope that an ESP32 can sample slowly. Raw EMG needs a wider bandwidth and a quieter front-end (Merletti & Parker, 2004; SparkFun, 2024).

EOG: eye movement

The eye is a dipole. Move the gaze, and the potential between electrodes near the canthi or above/below the eye changes. Sleep labs use EOG for REM. HCI experiments use it for blink and glance detection. Electrically it looks a lot like a slow ECG/EEG cousin, so BioAmp EXG or a re-filtered AD8232 often appears in maker builds.

ERG: retina response

ERG needs a light flash (or pattern) synchronized with the recording. Electrodes may be corneal or skin-based depending on the protocol. The electronics resemble other biopotential AFEs. The hard parts are optics, timing, and electrode type, not the ESP32 itself (McCulloch, 2019).

EGG: stomach rhythms

Gastric slow waves sit around a few cycles per minute. That means ultra-low-frequency filters (on the order of 0.01 to 0.5 Hz) and patience with motion artifact. You can reconfigure an ADS1299 or build an instrumentation-amp front-end. This is advanced DIY, not a weekend Amazon kit.

ENG: nerve conduction

ENG often stimulates a peripheral nerve and measures the compound action potential downstream. That means a safe, controlled stimulator plus a high-gain low-noise amp. An ESP32 can time the stimulus and log the response. Designing the stimulator is the real project, and safety review matters more than the Wi-Fi stack.

EDA / GSR: skin conductance

Sweat-gland activity changes how well the skin conducts. Stress and arousal studies use this a lot. Grove-style GSR modules are a voltage divider the ESP32 can read on an ADC pin. The signal is slow. Motion and electrode dryness matter more than sample rate.

BIA / ICG: bioimpedance

A tiny AC current is injected. The measured impedance relates to body composition (BIA) or, in thoracic setups, to blood-flow related changes (ICG). Chips such as Analog Devices AD5933 (I2C impedance converter) or Maxim MAX30001 (SPI) exist for this. Do not invent your own current-injection circuit without reading the safety limits in the datasheet (Analog Devices, 2017).

PPG: light, not electrodes

PPG shines LEDs into tissue and reads the reflected or transmitted light with a photodiode. Heart rate and SpO₂ wearables live here. MAX30102 / MAX30105 breakouts talk I2C to the ESP32 and are the friendliest first biosensor for most makers (Maxim Integrated, 2015).

ECG EEG EMG and EOG measurement sites on the body

Can an ESP32 Interface All of Them?

Yes, as a host. No, as a raw electrode ADC.

Biopotential amplitudes sit in the microvolt to millivolt range. The ESP32's GPIO and on-chip ADC expect volts-scale swings and are noisy near the rails. The missing piece is an AFE: gain, filtering, often driven-right-leg or bias, and preferably a dedicated ADC. Optical and impedance sensors already ship as digital breakouts, so the ESP32 only needs I2C or SPI (Espressif, 2023; Texas Instruments, 2017).

Problem: a student clips ECG electrodes to GPIO36 and sees garbage.
Cause: the heart signal is about a millivolt, buried in electrode offset and mains hum.
Effect: they blame the ESP32. Add an AD8232 (or better, a digital AFE), battery power, and a notch or digital filter. The waveform appears.

Electrodes to AFE to ESP32 signal chain
ESP32 biosensor stack from electrodes through AFE to wireless dashboard

Easy to Interface: Plug-and-Play Modules

These have hobbyist boards that speak analog, I2C, or SPI to an ESP32 without a custom PCB.

  • ECG: AD8232 (analog out) or MAX30003 (SPI digital AFE).
  • EMG: MyoWare 2.0, Gravity Analog EMG, BioAmp EXG Pill (analog).
  • EEG: BioAmp EXG Pill for single-channel experiments; TGAM-class modules; ADS1299 for multi-channel SPI.
  • EOG: BioAmp EXG Pill, or AD8232 with filter parts retuned for slower eye signals.
  • EDA / GSR: Grove GSR and similar voltage-divider modules (analog).
  • PPG: MAX30102 / MAX30105 (I2C).

MyoWare 2.0 even has an official wireless shield with an ESP32-WROOM and a LiPo, built so the muscle sensor can run isolated from the wall (SparkFun, 2024). That pattern is the right mental model for the whole list: battery on the body, radio off the body.

Plug-and-play biosensor modules for ESP32 including AD8232 MyoWare and MAX30102

Advanced: Custom Front Ends

  • EGG: ultra-low-frequency filtering. AD620-class instrumentation amp or a carefully configured ADS1299.
  • BIA / ICG: AD5933 (I2C) or MAX30001 (SPI) to inject and measure AC safely.
  • ENG: high-gain amp (INA128 / ADS1299 class) plus a synchronized stimulator. Treat stimulus current as a safety design, not a GPIO hack.
  • ERG: EEG/EOG-like electronics, plus specialized electrodes and a timed light flash.

The ESP32 still fits. The bill of materials and the validation plan get longer.

Harder biosensors: EGG BIA ENG and ERG with specialized hardware

ESP32 Tips That Actually Matter

1. Treat the built-in ADC as a last resort

The ESP32 on-chip 12-bit ADC is convenient and imperfect: noise, non-linearity near 0 V and 3.3 V, and channel restrictions depending on Wi-Fi use (Espressif, 2023). For clean biopotentials, prefer:

  • ADS1115 (I2C, 16-bit) after an analog AFE such as AD8232.
  • Digital AFEs such as ADS1299 or MAX30003 that digitize on the sensor board and speak SPI.
Comparing ESP32 ADC, ADS1115, and ADS1299 for biosignal quality

2. Electrical safety is not optional

While electrodes touch a person, run the ESP32 from a battery (LiPo or pack). Stream over Wi-Fi or BLE. Do not leave USB connected to a wall charger or to a laptop that is itself on mains. SparkFun's MyoWare docs say the same thing in blunt language: remove the shield from the sensor when charging or programming, and do not charge while attached to a user (SparkFun, 2024). Open ADS1299 + ESP32 projects repeat the rule: battery on subject, USB disconnected (Asghar, 2024).

Problem: 50 Hz hum ruins every plot, and a fault path to mains is possible.
Cause: the subject and the wall share a ground through USB.
Effect: bad science and real shock risk. Battery + wireless fixes both.

Unsafe mains-powered electrodes versus safe battery and BLE setup

3. Sample at the rate the physiology needs

  • ECG: often 250 to 500 Hz for a useful waveform.
  • EMG (raw): often 500 Hz to 1 kHz+; envelope outputs can be slower.
  • EEG: often 250 to 500 Hz per channel, with serious attention to referencing.
  • EDA / EGG: low rates are fine; filter design matters more.
  • PPG: tens to a few hundred Hz, depending on the chip FIFO and your algorithm.

4. Filter in hardware first, then in software

AFEs already band-limit. Add digital notch (50/60 Hz), baseline wander removal, and, for EMG, envelope or RMS features. Do not expect a raw FFT on a noisy ADC pin to look like a textbook figure.

5. Label the project honestly

Breakout vendors and open BioAmp boards say it: research, education, prototyping. Not diagnosis, not treatment, not a cleared medical device (SparkFun, 2024; Texas Instruments, 2017). If you need clinical claims, you need clinical hardware, clinical process, and regulators.

A Practical Start Path

  1. Pick one signal. PPG or ECG for a first win. EEG if you already like signal processing.
  2. Buy a matched AFE module, not bare electrodes.
  3. Power the ESP32 from a LiPo whenever a person is connected.
  4. Read via I2C/SPI if you can; otherwise analog into ADS1115 or a quiet ADC1 pin with averaging.
  5. Stream over BLE or Wi-Fi to a phone or laptop for plots.
  6. Only then attempt EGG, BIA, ENG, or ERG, with datasheets and a safety plan open.
Five-step path to start ESP32 biosensor projects safely

Module Cheatsheet

ESP32 host map Signal Common module / IC Link to ESP32 DIY difficulty ECG AD8232, MAX30003 Analog / SPI Easy EMG MyoWare, BioAmp Analog Easy EEG / EOG BioAmp, ADS1299 Analog / SPI Medium EDA/GSR Grove GSR Analog Easy PPG MAX30102 / 30105 I2C Easiest BIA/ICG AD5933, MAX30001 I2C / SPI Hard EGG / ERG / ENG Custom AFE + extras SPI / Analog Hardest Shared rules: AFE in the middle, battery on body, wireless off body, and never claim clinical use from a maker module.

The alphabet soup (ECG, EEG, EMG, and the rest) is one family of body signals plus one optical cousin. The ESP32 is a capable wireless host for all of them. The product between the skin and the chip is what decides whether you learn physiology or fight noise. Start with PPG or ECG, keep the subject on battery power, and treat every plot as a lesson, not a diagnosis.

If you remember one line: electrodes never meet the ESP32 alone. An AFE, a battery, and a radio sit in between.

References

Sunday, 25 October 2026

Bluetooth, BLE, UWB, RFID, and nRF(NFC): What Is the Same, What Is Different

Standard

 

Five names show up on every short-range wireless slide. Four of them are radios or tag systems. One of them is a chip brand. Teams mix them up, then pick the wrong one and spend a year fixing range, battery, or cost.

This post puts Bluetooth Classic, Bluetooth Low Energy (BLE), Ultra-Wideband (UWB), Radio-Frequency Identification (RFID), and Nordic nRF next to each other: what they share, where they split, and which use case each one actually wins.

Key Abbreviations in This Post

  • BT (Bluetooth Classic): The original Bluetooth radio. Built for audio and continuous data, not tiny coin-cell sensors.
  • BLE (Bluetooth Low Energy): A different Bluetooth radio mode. Same 2.4 GHz band, much lower power, used for sensors, beacons, and phone pairing.
  • UWB (Ultra-Wideband): Short pulses over a very wide band. Measures time of flight to get distance to about 10 cm.
  • RFID (Radio-Frequency Identification): A reader talks to a tag. Many tags are passive: no battery. Used to identify things, not to stream music.
  • NFC (Near-Field Communication): A short-range HF RFID flavor (13.56 MHz). Payments and tap-to-pair. About 4 cm.
  • nRF: Nordic Semiconductor's chip family (nRF52, nRF53, nRF54). Hardware that usually runs BLE, Thread, or Matter. Not a radio standard.
  • RSSI (Received Signal Strength Indicator): How loud the radio sounds. Used to guess distance. Often wrong by meters.
  • ToF (Time of Flight): How long the radio wave takes to travel. Used by UWB for real distance.
  • SoC (System on Chip): Processor, radio, and memory on one die. An nRF52840 is an SoC.

The One-Minute Version

  • Same job, different physics: all five show up in "talk to a nearby thing" products. They do not do that job the same way.
  • Bluetooth Classic: headphones, speakers, car audio. Needs more power. Streams data.
  • BLE: sensors, beacons, phone apps, "find my" wake-up. Cheap, everywhere, bad at exact distance.
  • UWB: "how far, and in which direction, for real." Car keys, AirTag arrows, warehouse safety.
  • RFID: "what is this tag?" Access cards, inventory, livestock. Passive tags can last forever.
  • nRF: the silicon you solder when the product speaks BLE (and often Thread or NFC). You still choose the protocol.

One Picture of the Family

Protocols vs a chip Four ways to talk. One piece of silicon that often runs BLE. Bluetooth Classic / BR-EDR 2.4 GHz Audio + data Headphones, cars Protocol BLE Low energy mode 2.4 GHz Sensors, beacons Phones everywhere Protocol UWB Time of flight 3.1 to 10.6 GHz ~10 cm distance Keys, finders Protocol RFID Reader + tag LF / HF / UHF ID, not a stream Cards, pallets Protocol family nRF = Nordic chip (SoC), not a fifth radio Typical firmware: BLE, Thread, Zigbee, Matter. Some parts add NFC. You buy nRF to implement BLE. You do not "install nRF" the way you enable UWB.

If you remember one line: Bluetooth, BLE, UWB, and RFID are how devices talk. nRF is a part you buy so a device can talk BLE.

What Is the Same

They overlap because products need the same three verbs: find, identify, connect.

  • Short range. Meters to tens of meters for most jobs. Not a cellular replacement.
  • Unlicensed or shared bands for the radio flavors (2.4 GHz for BT/BLE; 3.1 to 10.6 GHz for UWB; several RFID bands).
  • A reader and a thing. Phone and earbuds. Phone and tag. Gate and badge. Forklift and badge.
  • Often stacked. An AirTag uses BLE to be discovered and UWB to draw the arrow. A hotel lock may use RFID for the card and BLE for the phone.
  • Security is optional until it is not. Pairing, encryption, and distance-bounding are add-ons. Cheap beacons and cheap RFID tags are easy to clone if you skip them.
The shared loop 1. Find Nearby? In range? → 2. Identify Which tag or device? → 3. Act Unlock, play, count, stop RFID is strong at Identify. BLE is strong at Find + cheap data. UWB is strong at Find with proof of distance. Bluetooth Classic is strong at Act when Act means audio or a fat data pipe.

What Is Different

Bluetooth Classic BLE UWB RFID nRF
What it is Radio protocol Radio protocol Radio protocol Tag + reader family Chip / SoC brand
Main job Stream audio / data Low-power connect Measure distance Identify a tag Run the firmware
Band 2.4 GHz 2.4 GHz 3.1 to 10.6 GHz 125 kHz, 13.56 MHz, 860 to 960 MHz Depends on radio on the die (usually 2.4 GHz)
Typical range 10 m (room) 10 to 50 m; long-range modes more 10 to 50 m (line of sight) 4 cm (NFC) to 10+ m (UHF) Whatever protocol you flash
Distance accuracy Poor (RSSI) Poor (RSSI); better with AoA About 10 cm (ToF) In field or not; not a tape measure N/A
Tag / device power Battery, hours of audio Coin cell, months to years Battery; ranging costs more than BLE advertise Often none (passive) The MCU plus radio current
Cost of the "tag" Whole gadget A few dollars Higher (special chip + antenna) Cents to a dollar (passive) Chip price, not a tag
Phone support Universal Universal Flagships (Apple, Samsung, Google, and growing) NFC only on most phones; UHF needs a reader Inside many BLE gadgets, not the phone itself
Pick by the constraint you cannot break Need years on a coin cell BLE or passive RFID UWB and Classic drain faster nRF52-class SoC is typical for BLE Need true centimeters UWB BLE RSSI will lie in a metal room Often pair UWB with BLE wake-up Need a 10-cent ID Passive RFID / NFC No battery, no app required Needs a reader at the door Need music or a fat pipe Bluetooth Classic (or Wi-Fi) BLE can carry data. It is not a headset radio. Need to ship a BLE gadget nRF (or similar SoC) Protocol = BLE. Part number = nRF52840, nRF54L…

Each One, With a Real Example

Bluetooth Classic: the headset

You pair AirPods-class buds or a car stereo. The radio stays up and moves audio for hours. Classic Bluetooth (BR/EDR) was built for that continuous link. Putting the same job on BLE is possible in later specs, but most cars and speakers still speak Classic for audio.

Use when: the user hears or sends a stream. Do not use when: you need a five-year battery on a sticker.

BLE: the sensor and the "hello"

A heart-rate strap, a temperature logger, or a supermarket beacon advertises every second. A phone app connects, reads a few bytes, disconnects. BLE was designed for that duty cycle. Almost every smartphone can talk to it. Distance from signal strength is a guess: walk behind a fridge and "3 meters" becomes "12 meters."

Use when: phones must see you, power is tight, data is small. Do not use when: a forklift must stop at 1.5 m, not "somewhere nearby."

UWB: the tape measure

A digital car key measures time of flight. A relay thief in the street cannot make the radio wave travel faster than light, so the car stays locked. An iPhone draws an arrow to an AirTag because UWB gives distance and angle, not just "nearby." IEEE 802.15.4z is the secure-ranging standard behind most phones and cars (IEEE, 2020).

Use when: centimeters and anti-relay matter. Do not use when: you need a 5-cent tag on every carton.

RFID: the nametag

A warehouse portal reads a hundred UHF tags on a pallet as it rolls through. A badge on a lanyard opens a door at 13.56 MHz. A cow ear tag at 134 kHz survives mud. The tag is often a coil and a chip with no battery. The reader supplies the energy. RFID answers "who is this?" It does not play a podcast or report live GPS.

Use when: you must identify many cheap things, or tap a card. Do not use when: the thing must call a cloud API every minute with no reader nearby.

nRF: the board you design

A product spec says "BLE sensor, 2 years, over-the-air updates." The engineer picks an nRF52840 or nRF54 series part from Nordic Semiconductor, writes Zephyr or nRF Connect SDK firmware, and ships BLE. Some nRF parts include NFC for tap-to-pair. nRF is not competing with UWB as a standard. Nordic is a silicon vendor. Qorvo, NXP, and others make the UWB chips. You can put both on one board.

Use when: you are building the gadget. Do not say: "we will use nRF instead of BLE." That sentence does not parse.

Use-Case Chooser

If the user need is… use this Need Pick Example Wireless headphones in a car Bluetooth Classic Car stereo, earbuds App talks to a battery sensor BLE (+ nRF SoC) Glucose, bike cadence Phone as a secure car key UWB + BLE CCC Digital Key Arrow to a lost item UWB + BLE AirTag, SmartTag Office door badge HF RFID / NFC MIFARE, employee card Count cartons at a dock door UHF RFID Pallet portal Stop a forklift at 2 meters UWB RTLS Worker badge + vehicle Pay or tap-to-pair NFC (HF RFID) Transit card, tap earbuds Ship your own BLE widget nRF (or peer SoC) Custom sensor PCB Retail aisle "nearby" ads BLE beacon iBeacon / Eddystone

How Products Combine Them

One product, several radios Phone as car key BLE: wake and pair UWB: prove distance NFC: backup tap BLE alone is relay-attack food. UWB is the lock. BLE is the doorbell. nRF is not in the phone. Warehouse UHF RFID: carton ID UWB: people and trucks BLE: handheld scanners Do not track pallets with UWB tags if RFID already IDs them. Do not stop forklifts with RSSI. Your BLE gadget nRF SoC on the PCB Firmware speaks BLE Optional NFC tap-to-pair Add a UWB IC only if you must measure centimeters. That IC is usually not nRF.

Real Use Cases (Problem → Cause → Effect)

1. Office access with phones only

Problem: Staff lose plastic cards. Security wants phone unlock.

Cause: RFID cards are cheap but they are extra plastic. BLE "nearby" unlocks the door from the sidewalk.

Effect: Keep RFID for visitors and backups. For phones, use BLE to wake and UWB (or a tight NFC tap) to prove the person is at the reader, not in the parking lot.

2. Lost keys in a house

Problem: A BLE-only tag says "nearby." You still search for ten minutes.

Cause: RSSI cannot point. Walls change the number.

Effect: BLE finds the room. UWB draws the last-meter arrow. That is why finder tags added UWB.

3. Retail inventory

Problem: A store wants to know which jackets are on which rack.

Cause: Putting a BLE or UWB battery in every garment is cost and waste.

Effect: Sew a UHF RFID inlay. Walk a handheld reader. Count a thousand items. Use BLE only on the scanner, maybe on an nRF board.

4. "We specified nRF for location"

Problem: A spec sheet lists nRF as the location technology.

Cause: The team named the chip, not the measurement method. nRF running BLE still uses RSSI unless you add AoA hardware or a UWB chip.

Effect: Rewrite the spec: protocol first (BLE vs UWB vs RFID), then pick silicon (nRF, Qorvo, Impinj, NXP).

A Simple Decision Rule

  1. If the thing has no battery and you only need an ID, use RFID (NFC if a phone must tap).
  2. If a phone app must talk cheaply for years, use BLE. Build it on nRF or a peer SoC.
  3. If a human must hear a stream, use Bluetooth Classic.
  4. If you must prove distance or point at the thing, add UWB. Keep BLE for discovery.
  5. Never treat nRF as a substitute for UWB or RFID. It is the engine, not the road.

Bluetooth Classic moves sound. BLE moves small data on a diet. UWB measures time so distance is real. RFID names cheap things, often with no battery. nRF is Nordic's SoC that usually speaks BLE.

They are the same only at the slogan level: short-range wireless. They differ in physics, power, cost, and what question they can answer. Pick the question first. Then pick the radio. Then pick the chip.

References

  • Bluetooth SIG. Bluetooth Core Specification (Classic and Low Energy). https://www.bluetooth.com/specifications/specs/
  • IEEE. (2020). IEEE 802.15.4z-2020: Enhanced ultra wideband physical layers and associated ranging techniques. IEEE Standards Association.
  • ISO/IEC 18000 and ISO/IEC 14443. RFID and proximity-card (NFC) air interfaces.
  • Nordic Semiconductor. nRF52, nRF53, and nRF54 series product pages. https://www.nordicsemi.com/
  • GS1. EPC UHF Gen2 for item-level RFID. https://www.gs1.org/

Install Linux on Raspberry Pi: A Picture Guide for CLI, GUI, and Custom Builds

Standard

 

This is a picture-first guide. Each numbered graphic is a step. You can install a desktop Linux, a headless server Linux, or a Linux you built yourself. The board stays the same. Only the image on the microSD card changes.

Key Abbreviations in This Post

  • SBC (Single-Board Computer): A complete computer on one board. Raspberry Pi 5 and Pi 4 are SBCs.
  • CLI (Command-Line Interface): Text terminal. No desktop. Used for servers and headless Pis.
  • GUI (Graphical User Interface): Desktop with windows, mouse, and a monitor.
  • Imager / rpi-imager: Official Raspberry Pi tool that writes an OS image to a card. Has GUI and CLI modes.
  • Lite image: Raspberry Pi OS without a desktop. SSH and terminal only.
  • Headless: Run the Pi with no monitor. You log in over the network.
  • pi-gen: Official script that builds custom Raspberry Pi OS images.
  • Yocto: Build system for reproducible embedded Linux (uses the meta-raspberrypi layer).
  • Buildroot: Simpler builder for small appliance images.
  • SSH (Secure Shell): Remote login over the network.

The One-Minute Version

  • GUI desktop: Install Raspberry Pi Imager, pick your Pi model, pick Raspberry Pi OS Desktop (or Ubuntu Desktop), write the card, plug in HDMI, power on.
  • CLI / headless: Same Imager, pick Raspberry Pi OS Lite (or Ubuntu Server). Turn on SSH and Wi-Fi in Imager settings. Power on. Then ssh user@raspberrypi.local.
  • CLI from a Linux PC: sudo rpi-imager --cli image.img.xz /dev/sdX after lsblk confirms the card.
  • Custom product image: Build with pi-gen, Yocto, or Buildroot. Flash the resulting .img the same way.
  • Never guess the disk. Writing to the wrong /dev/sdX wipes a laptop drive.
Infographic of Raspberry Pi 5, Pi 4, Pi Zero 2 W, and a nano-style Pico board

Match the image to the board. A Pi 5 image will not boot a Pi 3. Prefer 64-bit images unless you have a 32-bit-only reason.

Infographic of kit: Raspberry Pi, microSD, power supply, HDMI, keyboard, computer with Imager
  • Raspberry Pi board and official 5 V USB-C supply (Pi 5 needs a capable 5 V / 5 A supply).
  • microSD card, 16 GB or larger, Class A2 if you can.
  • USB card reader on your PC.
  • For GUI: HDMI cable, monitor, keyboard, mouse.
  • For CLI: Ethernet or Wi-Fi, plus another computer for SSH.
Two-column infographic comparing CLI Linux and GUI Linux for Raspberry Pi
Flavor Type Use it when
Raspberry Pi OS Desktop GUI Best first image. Official drivers, camera, GPIO tools.
Raspberry Pi OS Lite CLI Headless servers, kiosks you SSH into, IoT.
Ubuntu Desktop / Server GUI / CLI You already know Ubuntu packages and cloud-init.
Debian CLI (or add a desktop) Closest to upstream Debian on Pi hardware.
DietPi CLI Small, fast, lots of one-click software recipes.
Alpine Linux CLI Tiny footprint, containers, appliances.
Fedora / Manjaro ARM GUI You want those desktop stacks on a Pi.
Flowchart choosing GUI Imager, CLI flash, or custom build
Five-step Raspberry Pi Imager GUI workflow
  1. Download Imager from raspberrypi.com/software (Windows, macOS, or Linux). On Raspberry Pi OS: sudo apt install rpi-imager.
  2. Open Imager. Choose Device (Pi 5, Pi 4, Zero 2 W, and so on).
  3. Choose OS:
    • Raspberry Pi OS (64-bit) for a desktop.
    • Raspberry Pi OS Lite for CLI.
    • Other general-purpose OS for Ubuntu, Alpine, and more.
  4. Choose Storage: your microSD (check the size so you do not pick the wrong disk).
  5. Open OS Customisation (gear): set hostname, username, password, Wi-Fi, locale, and enable SSH.
  6. Write. Eject. Insert the card in the Pi. Power on last.
CLI flash overview with rpi-imager and dd
# 1. See disks. Find the card by size.
    lsblk
    
    # 2. Unmount any auto-mounted partitions
    sudo umount /dev/sdX1 /dev/sdX2
    
    # 3a. Official CLI (verifies the write)
    sudo rpi-imager --cli raspios.img.xz /dev/sdX
    
    # 3b. Or classic pipeline
    xzcat raspios.img.xz | sudo dd of=/dev/sdX bs=4M status=progress conv=fsync
    sync

If the card shows as /dev/mmcblk0, write to /dev/mmcblk0, not mmcblk0p1.

First boot sequence with HDMI monitor and Raspberry Pi OS desktop

Complete country, timezone, password, and updates. Enable SSH in Raspberry Pi Configuration if you will leave the monitor later. Then sudo apt update && sudo apt full-upgrade.

Headless Raspberry Pi boot with SSH and Wi-Fi enabled in Imager
ssh youruser@raspberrypi.local
    # or ssh youruser@192.168.x.x   (check your router)

On current Raspberry Pi OS, Imager writes first-boot settings for you. That is safer than hand-editing the boot partition. If you must do it by hand on an older image, place an empty file named ssh on the boot partition.

Cards for Ubuntu Debian DietPi Alpine Fedora Manjaro
  • Ubuntu: Imager → Other general-purpose OS → Ubuntu. Desktop or Server. First login follows Ubuntu's cloud-init / first-boot notes.
  • Debian: Use a Raspberry Pi Debian image built for your model, then flash with Imager or dd.
  • DietPi: Download the Pi-model image from dietpi.com. Flash. First boot is a text installer for software stacks.
  • Alpine: Listed under Other general-purpose OS in Imager, or follow the Alpine Raspberry Pi wiki.
  • Fedora / Manjaro ARM: Download the aarch64 image for your Pi, then use Imager "Use custom" or the CLI.
After install checklist: password, updates, raspi-config, interfaces, hostname, backup
sudo apt update && sudo apt full-upgrade
    sudo raspi-config
    # 1 System Options → Hostname, Password, Wireless
    # 3 Interface Options → SSH, SPI, I2C, Serial
    sudo reboot
Three custom build factories: pi-gen, Yocto, Buildroot

A. pi-gen (custom Raspberry Pi OS)

Use this when you want Debian-like Raspberry Pi OS, but with your packages, user, and first-boot scripts baked in.

git clone https://github.com/RPi-Distro/pi-gen.git
    cd pi-gen
    
    # config file (example)
    cat > config << 'EOF'
    IMG_NAME=myproduct
    RELEASE=bookworm
    LOCALE_DEFAULT=en_US.UTF-8
    TARGET_HOSTNAME=myproduct
    FIRST_USER_NAME=admin
    ENABLE_SSH=1
    STAGE_LIST="stage0 stage1 stage2"
    EOF
    
    # Add extra packages in stage2/00-packages or a custom stage
    sudo ./build.sh
    # Output: deploy/*.img

Stages in short: 0 = bootstrap, 1 = base system, 2 = Lite (CLI), 3 = desktop extras, 4 = full desktop, 5 = recommended apps. Stop at stage2 for a custom CLI image.

B. Yocto + meta-raspberrypi

Use this when the Pi is a product: you need a locked-down rootfs, a software bill of materials, and repeatable builds.

git clone git://git.yoctoproject.org/poky
    git clone https://github.com/agherzan/meta-raspberrypi.git
    source poky/oe-init-build-env build
    # add meta-raspberrypi to conf/bblayers.conf
    # in conf/local.conf:
    #   MACHINE = "raspberrypi5"
    bitbake core-image-minimal
    # Flash the .wic or .rpi-sdimg from tmp/deploy/images/

C. Buildroot

Use this when the image must be small and boot fast.

git clone https://gitlab.com/buildroot.org/buildroot.git
    cd buildroot
    make raspberrypi5_defconfig    # or raspberrypi4_defconfig
    make menuconfig
    make -j$(nproc)
    # Flash output/images/sdcard.img
Flash custom image, test one board, then clone for production
sha256sum deploy/myproduct.img
    sudo rpi-imager --cli deploy/myproduct.img /dev/sdX
    # Boot one board. Check SSH, app, and GPIO.
    # Only then clone the card or repeat the CLI write.

Real Use Cases (Problem → Cause → Effect)

1. Classroom of 20 desktop Pis

Problem: Students need a mouse, browser, and Thonny on every desk.

Cause: A Lite image has no desktop. Hand-configuring 20 cards wastes a day.

Effect: Flash Raspberry Pi OS Desktop with Imager. Set the same Wi-Fi and user in OS Customisation. Clone the first good card.

2. Home lab server in a drawer

Problem: No spare monitor. You want Docker and SSH only.

Cause: A full desktop wastes RAM and SD writes.

Effect: Flash Raspberry Pi OS Lite or Ubuntu Server. Enable SSH in Imager. ssh in and install Docker.

3. Factory kiosk that must not grow extra packages

Problem: Field units drift after apt upgrade and random desktop apps.

Cause: A general-purpose OS is not a product image.

Effect: Build with pi-gen (Debian-like) or Yocto (locked firmware). Flash the same .img on every unit. Disable unused interfaces in the build.

4. Tiny IoT node on a Zero 2 W

Problem: A desktop image will not fit well on a small card and a small CPU.

Cause: Desktop stacks assume a Pi 4/5 class board.

Effect: Use Alpine or DietPi, or a Buildroot image. Headless. SSH only.

Benefits for Teams That Ship Pi Products

If you do this You get
Flash a stock Lite image + SSH Fast prototype. Good for labs and one-off gateways.
Use Imager customisation on every card Known hostname, user, Wi-Fi, and SSH without a monitor.
Build with pi-gen Your app and users already installed. Same image for a classroom or a kiosk fleet.
Build with Yocto Reproducible firmware, license list, smaller attack surface, longer product life.
Build with Buildroot Smallest card, fastest boot, simple appliance.
Hash and test one board first You do not clone a broken first-boot into 200 units.

Safety Rules (Read Once)

  1. Confirm the SD device with lsblk. Wrong target wipes a PC disk.
  2. Power the Pi after the card is seated. Do not hot-swap microSD on a running Pi.
  3. Use a proper power supply. Undervoltage causes random first-boot failures.
  4. Change the password on first login. Do not leave default credentials on a network.
  5. Backup a known-good card: sudo dd if=/dev/sdX bs=4M status=progress | xz > gold.img.xz.

Installing Linux on a Raspberry Pi is writing the right image to a microSD card. Imager is the GUI path. rpi-imager --cli or dd is the CLI path. pi-gen, Yocto, and Buildroot are the custom-build path.

Start with Raspberry Pi OS Desktop if you have a screen. Start with Lite plus SSH if you do not. Build a custom image only when you will flash the same card many times or ship a product. The pictures above are the map. The command boxes are the ones to type.

References

  • Alpine Linux. Raspberry Pi. https://wiki.alpinelinux.org/wiki/Raspberry_Pi
  • Buildroot. The Buildroot user manual. https://buildroot.org/downloads/manual/manual.html
  • Canonical. Install Ubuntu on a Raspberry Pi. https://ubuntu.com/download/raspberry-pi
  • Raspberry Pi Ltd. Getting started: Install an operating system. https://www.raspberrypi.com/documentation/computers/getting-started.html
  • Raspberry Pi Ltd. Raspberry Pi Imager. https://www.raspberrypi.com/software/
  • RPi-Distro. pi-gen: Tool used to create Raspberry Pi OS images. https://github.com/RPi-Distro/pi-gen
  • Yocto Project. meta-raspberrypi. https://github.com/agherzan/meta-raspberrypi