2.2 Powering, thermals, and protecting the gateway

When an embedded Linux gateway behaves erratically (dropping Wi-Fi connections, failing to enumerate a USB serial adapter, corrupting its microSD file system, or rebooting without warning during a compile), new engineers almost always blame their software or kernel drivers first. In my experience teaching embedded systems labs over the past decade, more than half of “mysterious” gateway crashes are actually power-supply brownouts or thermal throttling.
A microcontroller leaf node draws microamps when asleep and tens of milliamps when active (an ESP32 peaks at a few hundred milliamps while its Wi-Fi radio transmits). A quad-core Linux gateway is a much larger and more variable electrical load. When all four Arm Cortex-A72 or Cortex-A76 cores wake from idle to compile C++ code or run an edge AI model while transmitting over Wi-Fi, current demand on the 5 V rail can jump from 500 mA to 2.5–4.0 A in microseconds. If your power supply or USB-C cable has too much series resistance (Vdrop = I × Rcable), the voltage arriving at the board’s Power Management IC (PMIC) droops below the minimum regulation threshold.
Power supply requirements and the 5.1 V specification
Section titled “Power supply requirements and the 5.1 V specification”Standard USB ports are nominally 5.0 V ± 5% (4.75 V to 5.25 V).1 However, cheap phone chargers and long, thin 28 AWG USB cables routinely drop 0.4–0.6 V at 2.5 A. That is why official Raspberry Pi power supplies are engineered to output 5.1 V DC over thick 18 AWG captive cables: the extra 100 mV of headroom compensates for cable and connector resistance under peak load.2
- Raspberry Pi 4 Model B: Requires a
5.1 V / 3.0 A(15.3 W) USB-C power supply. Idle consumption is roughly2.7 W(~540 mA), rising to6.5–7.5 Wunder full four-core CPU load, plus up to1.2 A(6 W) shared across all four USB host ports.2 - Raspberry Pi 5: Recommends a
5.1 V / 5.0 A(27 W) USB-C Power Delivery (PD) supply. When the Pi 5’s bootloader negotiates5 V / 5 Aover USB-C PD, it raises the total current limit for the four USB host ports from600 mAto1.6 A, allowing power-hungry NVMe drives and USB peripherals to run without an external powered USB hub.3
Diagnosing under-voltage and throttling from the command line
Section titled “Diagnosing under-voltage and throttling from the command line”Both the Raspberry Pi 4 and Pi 5 include an on-board hardware voltage supervisor inside the PMIC (MxL7704 on Pi 4, DA9091 on Pi 5). If the 5 V input rail falls below 4.63 V ± 5%,2 the PMIC asserts an under-voltage signal: the red PWR LED extinguishes or blinks, the kernel prints Undervoltage detected! to the kernel ring buffer (dmesg), and the firmware throttles the CPU clock to prevent a complete crash.
You do not need an oscilloscope on the bench to check whether your gateway has suffered a brownout, even a brief millisecond droop hours ago. The VideoCore/firmware interface maintains a sticky 32-bit throttling bitmask that you can query at any time using vcgencmd get_throttled:4
derek@rpi:~ $ vcgencmd get_throttledthrottled=0x0A return value of throttled=0x0 is the only healthy result on a production or lab gateway. Any non-zero hexadecimal value means one or more hardware limits are active right now (bits 0–3) or have tripped at least once since the board last booted (bits 16–19), as decoded in Table 2.3.
Table 2.3. Decoding the hexadecimal bitmask returned by vcgencmd get_throttled.4
| Bit Position | Hex Mask | Meaning | Engineering Diagnosis |
|---|---|---|---|
| Bit 0 | 0x00001 | Under-voltage currently detected | Input rail is below 4.63 V right now. Replace PSU or thin USB-C cable immediately. |
| Bit 1 | 0x00002 | Arm frequency currently capped | Clock speed capped (> 80 °C or under-voltage). |
| Bit 2 | 0x00004 | Currently throttled | CPU cores actively throttled due to thermal or voltage limit. |
| Bit 3 | 0x00008 | Soft temperature limit active | Pi 3A+ and 3B+ only: the temperature is above the soft limit (60 °C by default).5 |
| Bit 16 | 0x10000 | Under-voltage has occurred since boot | A transient load spike (e.g., Wi-Fi TX + USB disk spin-up) drooped the 5 V rail below 4.63 V. |
| Bit 17 | 0x20000 | Arm frequency capping has occurred | The board reached 80 °C or drooped voltage at some point since boot. |
| Bit 18 | 0x40000 | Throttling has occurred since boot | Historical thermal or power throttling event recorded. |
| Bit 19 | 0x80000 | Soft temperature limit has occurred | Pi 3A+ and 3B+ only: the soft limit was reached at some point since boot. |
For example, if vcgencmd get_throttled returns throttled=0x50005, bits 0, 2, 16, and 18 are set: the board is experiencing an active under-voltage condition (0x1) and is currently throttled (0x4), and both conditions have occurred historically (0x50000).
USB hubs and the “back-feeding” hazard
Section titled “USB hubs and the “back-feeding” hazard”When connecting high-current USB devices to a gateway (such as a 2.5-inch portable hard drive, a cellular modem, or multiple SDR dongles), you should use an externally powered USB hub so their current draw does not starve the gateway’s 5 V rail.
However, cheap powered USB hubs frequently suffer from a dangerous design flaw known as USB back-feeding:
- A compliant USB hub places a power switch or ideal diode between its internal
5 Vwall-wart supply and the upstream USB cable going to the host computer.2 - Many low-cost hubs solder the wall-wart’s
5 Vrail directly to the upstream USBVBUSwire. When you plug that hub into your Raspberry Pi, the hub’s wall-wart drives5 Vbackwards into the Pi’s USB host port, fighting the Pi’s main USB-C power supply and bypassing input protection. Even if you unplug the Pi’s USB-C power cable, the Pi stays dimly powered through its USB host port.
While the Raspberry Pi 4 and 5 include protection circuitry on their USB ports to limit reverse current, back-feeding can still prevent clean reboots (because the SoC rails never fully discharge to 0 V) or cause ground-loop currents. Always verify that a powered USB hub does not illuminate your gateway’s PWR LED when the gateway’s own power supply is unplugged.
Power over Ethernet (PoE): single-cable gateway deployment
Section titled “Power over Ethernet (PoE): single-cable gateway deployment”In an industrial building, greenhouse, or ceiling-mounted border-router deployment, running 230 V AC mains outlets to every gateway location is expensive and requires a certified electrician. Power over Ethernet (PoE) solves this by delivering both Gigabit Ethernet data and DC power over a single standard Cat 5e / Cat 6 twisted-pair cable up to 100 metres long.6
Power over Ethernet to the gateway
Click any block or link to see what it does.
Click a block, the cable pairs, the voltage sketch, or the MagJack, PHY or PoE header on the board. Use Path to follow the data or the power.
Figure 2.5. True IEEE 802.3af/at Power over Ethernet: 48 V DC is injected as a common-mode voltage onto the differential Ethernet pairs and extracted via the transformer centre taps on the gateway’s MagJack connector.
How PoE shares wires with Gigabit data without interference
Section titled “How PoE shares wires with Gigabit data without interference”Ethernet transmits high-speed data using differential signalling (Vdiff = V+ − V−) through isolation transformers inside the RJ45 MagJack connector. Because the transformer only couples AC differential signals to the Ethernet PHY chip, a PoE switch (Power Sourcing Equipment, PSE) can inject a 48 V to 57 V DC common-mode voltage onto the centre taps of the transformer windings. Both wires of a twisted pair then sit at the same DC potential, so there is no DC differential voltage for the PHY to see.6 The DC current splits between the two wires and flows in opposite directions through the two halves of the centre-tapped winding, so the DC flux in the transformer core cancels and the core does not saturate.
At the gateway end (the Powered Device, PD), the Raspberry Pi 4 and Pi 5 provide a dedicated 4-pin PoE header right next to the RJ45 socket that taps the four transformer centre points. Fitting a PoE HAT completes the circuit. The official Raspberry Pi PoE+ HAT is made for the Pi 4.7 The Pi 5 moved the PoE header, so it needs a HAT made for that board.
A standards-compliant PoE link works as follows:
- Detection, then classification: Before applying
48 V, an IEEE802.3af8 (15.4 Wat port /12.95 Wat device) or802.3atPoE+9 (30 Wat port /25.5 Wat device) switch applies a low test voltage and looks for a25 kΩsignature resistance on the PD (detection).10 It then measures a classification current that tells it how much power the PD needs.6 If you plug a non-PoE laptop into a PoE switch, the switch finds no signature and does not apply power. - High-voltage DC transfers more power with lower loss: Stepping up to
48 Vreduces the current in the long Ethernet cable by nearly a factor of ten compared to5 V(P = V × I), cutting resistive I²R cable losses by nearly 100×. - Galvanic isolation: An isolated DC-DC converter on the PoE+ HAT steps the
48 Vdown to a regulated5 Vat up to4 Ato power the Raspberry Pi and its sensors.7
Thermal management, sysfs temperature monitoring, and cooling
Section titled “Thermal management, sysfs temperature monitoring, and cooling”Modern 64-bit Cortex-A72 and Cortex-A76 cores pack high transistor density into a small footprint. On both the Raspberry Pi 4 and Pi 5, the Linux kernel exposes the SoC’s internal on-die temperature sensor through the standard thermal class in sysfs at /sys/class/thermal/thermal_zone0/temp.
The file reports the die temperature in millidegrees Celsius (1/1000 °C),11 which makes it easy for C, C++, or shell scripts to parse as an integer without floating-point locale issues (and we will use it as the input for our C++ service in Lab 2):
derek@rpi:~ $ cat /sys/class/thermal/thermal_zone0/temp46250derek@rpi:~ $ awk '{printf "SoC Temp: %.2f °C\n", $1/1000}' /sys/class/thermal/thermal_zone0/tempSoC Temp: 46.25 °Cderek@rpi:~ $ vcgencmd measure_temptemp=46.2'CThermal trip points and frequency scaling
Section titled “Thermal trip points and frequency scaling”To protect the SoC from overheating, the Raspberry Pi firmware (not the kernel’s cpufreq governor) enforces two temperature thresholds:
80 °C(80000millidegrees): Thermal throttling begins. The firmware progressively steps down the Arm CPU clock frequency (e.g., from1.8 GHzon Pi 4 or2.4 GHzon Pi 5 down toward1.0 GHz) and sets bit1and bit2invcgencmd get_throttled.285 °C(85000millidegrees): Maximum operating temperature. Both the CPU cores and the VideoCore GPU are throttled to their minimum clock speeds.2
The kernel’s thermal framework has its own trip point for the same sensor, which you can read from sysfs with cat /sys/class/thermal/thermal_zone0/trip_point_0_temp and trip_point_0_type. It is a critical trip, at which the kernel shuts the board down,12 and it is set above the firmware’s 85 °C limit, so in normal operation the firmware throttles long before the kernel acts.
In experiments originally conducted for Exploring Raspberry Pi,13 logging thermal_zone0/temp at 10-second intervals under continuous load revealed an important lesson for enclosure design: sticking a tiny passive aluminium heatsink onto an SoC inside a sealed, unventilated plastic box barely reduces steady-state temperature (by ~2 °C), whereas opening ventilation slots or coupling the SoC thermally to an aluminium enclosure wall drops temperatures by 15–25 °C. On the Raspberry Pi 5, if the gateway will run sustained multi-core workloads (such as local computer vision or C++ compilation), fit either the official Raspberry Pi Active Cooler14 (whose PWM fan plugs into a dedicated 4-pin JST header and stays completely off below 50 °C)2 or a passive aluminium heatsink case.
Figure 2.6 puts the supply, the cable and the cooling together. Change them, add load, and watch the voltage at the PMIC, the SoC temperature and the clock speed, and the vcgencmd get_throttled value they produce.
Under-voltage, heat and vcgencmd get_throttled
Change the supply, cable, cooling and load, then read the throttled value.
derek@rpi:~ $ vcgencmd get_throttled throttled=0x0
Healthy: nothing has happened since boot.
Illustrative model: currents from Section 2.2, cable resistances chosen to match its 0.4–0.6 V drop for a thin cable at 2.5 A, and thermal resistances chosen to match the enclosure results it quotes.
Figure 2.6. How the power supply, cable, load and cooling set the voltage at the PMIC and the SoC temperature, and the live (bits 0–2) and sticky (bits 16–18) bits that vcgencmd get_throttled reports. The thermal and cable values are illustrative.
Six ways to destroy your gateway (and how to avoid them)
Section titled “Six ways to destroy your gateway (and how to avoid them)”Before you wire any breadboard circuit to your Raspberry Pi 4, Pi 5, or BeagleBone in the upcoming chapters, commit these six electrical rules to memory:
- Never connect
5 Vsignals to3.3 VGPIO pins: Unlike an old 5 V Arduino Uno (ATmega328P), every GPIO pin on the Raspberry Pi and ESP32 is strictly3.3 V(and the BeagleBone’s analogue inputs are strictly1.8 V). Connecting a5 Vsensor output directly to a GPIO pin forward-biases the SoC’s internal ESD protection diodes into the3.3 Vrail and will permanently damage the processor.2 Always use a resistive divider, a logic-level shifter, or an optocoupler (Chapter 6). - Never place a powered board on conductive surfaces: Lab benches frequently accumulate clipped resistor leads, solder balls, wire offcuts, and metal tools, and anti-static bags are slightly conductive. Always fit your gateway into a baseplate, standoffs, or enclosure before applying power.
- Never source or sink heavy currents directly from a GPIO pin: A single Raspberry Pi GPIO pin is a logic signal, not a power supply. Keep individual GPIO pin currents below
4–8 mA(and total current across all 26 GPIOs well below50 mA).2 To drive high-bright LEDs, relays, solenoids, or motors, use a BJT or logic-level MOSFET switching stage (Chapter 6). - Never drive voltage into GPIO pins while the gateway is unpowered: If an external sensor or signal generator drives
3.3 Vinto a Raspberry Pi or BeagleBone GPIO pin while the gateway’s own power supply is turned off, current leaks through the SoC’s internal protection structures (“parasitic back-powering”) and can latch up or destroy the I/O pad. Either power your external sensor circuits from the gateway’s own switched3.3 Vheader pin (Pin 1orPin 17) so they turn off together, or isolate the signals with an optocoupler or tri-state buffer enabled by the gateway’s3.3 Vrail. - Never wire or re-wire header pins while the board is powered on: Slipping by one pin (
2.54 mm) while plugging a jumper lead into a live 40-pin header is the single most common way students short5 V(Pin 2) to3.3 V(Pin 1). Shut down or use a labelled breadboard breakout (T-Cobbler). - Never yank the power cord without shutting down Linux cleanly: An embedded Linux gateway caches file-system metadata and journal blocks in RAM before flushing them to the microSD card. Pulling the USB-C plug while the green
ACTLED is flashing can leave theext4root file system in an inconsistent state. Always runsudo shutdown -h now(or press the Pi 5 power button / trigger agpio-shutdownbutton, covered in Section 2.6) and wait for theACTLED to stop blinking before removing power.
Six ways to destroy your gateway
Switch between the mistake and the fix to compare each card.
- 1
A 5 V signal on a 3.3 V pin
Current flows through the pin's protection diode into the 3.3 V rail and destroys the I/O pad.
- 2
A powered board on a conductive surface
Resistor leads, solder balls, tools or an anti-static bag short the pins underneath.
- 3
Load current straight from a GPIO pin
A relay, motor or bright LED draws far more than the 4 to 8 mA a pin is meant to supply.
- 4
A signal into an unpowered board
The signal back-powers the SoC through its protection structures and can latch up the pad.
- 5
Re-wiring a live header
A slip of one pin (2.54 mm) shorts 5 V on pin 2 to 3.3 V on pin 1.
- 6
Pulling the power while Linux writes
Cached writes never reach the card, and the ext4 file system is left inconsistent.
The drawings are sketches, not wiring diagrams; the rules and their numbers are in the list above the figure.
Figure 2.7. The six rules as an infographic. Switch between the mistake and the fix to compare each card.
🧩 Knowledge Check
Section titled “🧩 Knowledge Check”Match the Power over Ethernet term to its description
vcgencmd get_throttled returns throttled=0x50000 on a gateway that is now idle and cool. What does this tell you?
How can a PoE switch send 48 V DC along the same pairs that carry Gigabit Ethernet data?
Which of the following follow the electrical rules in this section?
Footnotes
Section titled “Footnotes”-
USB Implementers Forum, Universal Serial Bus Specification, Revision 2.0, Apr. 2000 (with errata and ECNs). Available: usb.org/document-library/usb-20-specification. ↩
-
Raspberry Pi Ltd, Raspberry Pi hardware (sections “Power supply”, “Universal Serial Bus (USB)”, “Frequency management and thermal control” and “40-pin GPIO header”), Raspberry Pi Documentation. Available: raspberrypi.com/documentation/computers/raspberry-pi.html. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9
-
Raspberry Pi Ltd, “Introducing: Raspberry Pi 5!,” Raspberry Pi News, 28 Sept. 2023. Available: raspberrypi.com/news/introducing-raspberry-pi-5. ↩
-
Raspberry Pi Ltd, Raspberry Pi OS, section “vcgencmd: get_throttled”, Raspberry Pi Documentation. Available: raspberrypi.com/documentation/computers/os.html. ↩ ↩2
-
Raspberry Pi Ltd, config.txt, section “Overclocking options” (
temp_soft_limit,temp_limit), Raspberry Pi Documentation. Available: raspberrypi.com/documentation/computers/config_txt.html. ↩ -
D. Haikin, “An Introduction to Power-over-Ethernet,” DigiKey, 13 May 2020. Available: digikey.co.uk/en/articles/an-introduction-to-power-over-ethernet2. ↩ ↩2 ↩3
-
Raspberry Pi Ltd, Raspberry Pi PoE+ HAT, product page. Available: raspberrypi.com/products/poe-plus-hat. ↩ ↩2
-
IEEE Std 802.3af-2003: Data Terminal Equipment (DTE) Power via Media Dependent Interface (MDI), IEEE, 2003 (superseded). Available: standards.ieee.org/standard/802_3af-2003.html. ↩
-
IEEE Std 802.3at-2009: Amendment 3: Data Terminal Equipment (DTE) Power via the Media Dependent Interface (MDI) Enhancements, IEEE, 2009. Available: ieeexplore.ieee.org/document/5306743. ↩
-
Texas Instruments, TPS2375x IEEE 802.3at, High Efficiency, PoE Interface and DC-DC Controller, datasheet, Rev. I, Dec. 2017. Available: ti.com/product/TPS23756. ↩
-
The Linux Kernel,
Documentation/ABI/testing/sysfs-class-thermal(“Unit: millidegree Celsius”). Available: kernel.org/doc/Documentation/ABI/testing/sysfs-class-thermal. ↩ -
The Linux Kernel, Generic Thermal Sysfs driver How To, The Linux Kernel documentation. Available: docs.kernel.org/driver-api/thermal/sysfs-api.html. ↩
-
D. Molloy, Exploring Raspberry Pi: Interfacing to the Real World with Embedded Linux, Wiley, 2016, ISBN 978-1-119-18868-1. ↩
-
Raspberry Pi Ltd, Raspberry Pi Active Cooler, product page. Available: raspberrypi.com/products/active-cooler. ↩
© 2026 Derek Molloy, Dublin City University. All rights reserved.