class: title-slide # How to power (almost) anything ## Instructors bootcamp - Norway Nicolas De Coster (Fab ULB) | 2026-01
--- class: blue-slide # Agenda 1. Prerequisites (things to have in mind) 2. Power sources 3. Get (almost) any voltage 4. Efficiency considerations --- class: blue-slide # 1. Prerequisites - The Fundamental Equation - Dynamic Power Consumption - AC vs DC - Processor Voltages (overview) --- class: default-slide # The Fundamental Equation ## P = U × I ; U = R × I ⇒ P = R × I² **Power (Watts)** = **Voltage (Volts)** × **Current (Amps)** **Voltage (Volts)** = **Resistance (Ohms)** × **Current (Amps)** - Balance voltage and current for your application - Higher voltage → lower current for same power (less losses in cables) - → Use long high voltage cables, short low voltages high current cables - Voltage usually project/processor dependant --- class: default-slide # Dynamic Power Consumption ## P ∝ U² × F In microprocessors, power is proportional to **voltage squared** times **frequency** - Reducing voltage has a *quadratic* effect on power → 3.3V instead of 5V = >50% savings - Reducing clock frequency has a *linear* effect → 1MHz instead of 20MHz = 95% savings! - This is why modern (fast) chips use lower voltages and dynamic clocks --- class: default-slide #
.two-columns[ .column[ ### AC (Alternating Current) - Wall outlets (110V/230V) - Transformers work easily - Long distance transmission - Frequency: 50Hz / 60Hz ] .column[ ### DC (Direct Current) - Batteries - Electronics - Solar panels output - USB power ] ] **Most electronics need DC** → Conversion required --- class: default-slide # Processor Voltages (overview) Common operating voltages for microcontrollers: | Voltage | Examples | |---------|----------| | **up to 5V** | atTiny, (Arduino Uno) | | **3.3V** | ESP32, RP2040, most modern MCUs | | **1.8V** | Low power MCUs, some sensors | | **~1V** | High end microprocessors (computers) | ⚠️ **Logic level compatibility matters!** - Don't connect 5V output to 3.3V input directly (unless you want [magic smoke](https://en.wikipedia.org/wiki/Magic_smoke)!) - Pay attention to communication lines (tipically I²C or SPI) - Tradeoff between power consumption, frequency and noise immunity --- class: blue-slide # 2. Power Sources - Batteries - Mains Power - USB Power (+DIY : QC Fab) - Lab Power Supplies - Others - DIY: ATX Power Supply --- class: default-slide # Batteries ## Rechargeable | Type | Voltage | Pros | Cons | Typical use | |------|---------|------|------| ------------| | **LiIon/Po** | 3.7V | High dens., rechargeable | Protection circuit ! | Various | | **LiFePO4** | 3.2V | Safe, rechargeable | Lower density, exp. | Various | | **NiMH** | 1.2V/cell | Rechargeable, safe | Lower density | Various | | (**Supercapa.**) | ~3V/cell | Long life, fast, wide temp | Low capacity | Transport, security, ... | - 💡 Li-ion: 4.2V full; 3.7V nominal; 3.0V empty : do NOT over-charge or over-discharge (danger!) - 💡 LiFePO4 : more expensive, lower dens. BUT more cycles, much safer, more ecolo./ethical. - 💡 NiMH : easy to charge in serie. Li-ion : you should take (very) special care! - 💡 "Rule of thumb" : 3NiMH = 1Li-ion - 💡 Slower is (always) better! => avoid "fast" charge (USB cable/charger, bios, config, ...) --- class: default-slide # Batteries ## Disposable | Type | Voltage | Pros | Cons | Typical use | |------|---------|------|------| ------------| | **Li-Mn** (cr2032) | 3V | Small, available | Very low capacity | Remote ctrl, clock/RTC... | | **Alkaline** | 1.5V/cell | Cheap, available | Not rechargeable | Remote ctrl, lamp, toys... | | **Zinc-carbon** | 1.5V/cell | Very cheap | Low capacity | Remote ctrl, clock | | **Piling up** | 4.5V,9V,12V,... | High voltage | Bulky, low capacity | Old toys, radios | - 💡 Some are found in unopenable devices! (should be forbidden?) - --- class: default-slide # Batteries Know the curves... .two-columns[ .column[  ] .column[  ] ] --- class: default-slide # Mains Power ## Wall Plug Power Supplies .two-columns[ .column[ - **Fixed output**: (extremely) various! - **Specific** : 1 device = 1 power supply - **Safety**: Galvanic isolation from mains - ⚠️ Always use properly rated power supplies! - ⚠️ Be careful with cheap clones. - ⚠️ Same connector ≠ same voltage. ([magic smoke](https://en.wikipedia.org/wiki/Magic_smoke)) ] .column[
] ] --- class: default-slide # USB Power - **USB** : originally design to replace various ports (serial, parallel, PS/2, ...) - **USB 2.0/3.0**: 5V @ 500mA (2.5W) / 900mA (4.5W) - **USB PD**: Up to 20V @ 5A (100W+) : std 5V, 9V, 12V, 15V, 20V (>PD3.1 : 28V, 36V and 48V) - **USB PD PPS**: Up to 20V @ 5A (100W+), 20mV steps, current reg 50mA steps => [Top option!](https://www.crowdsupply.com/centylab/pocketpd) and Bootcamp challenge? (STUSB4500) - **QC2** : fixed 5V, 9V, 12V (20V - class B) [current specs?] - **QC3**: 3.6V - 12V (/20V class B) (0.2V steps) [current specs?] ✅ "Universal", convenient, safe : limited risk of misuse. ❎ Various versions and capabilities : read and test your converters. 💡 Sometimes usefull to cut capabilities (use non-data cable : block fast charge) --- class: default-slide # Lab Power Supplies .two-columns[ .column[ ### Features: - **Adjustable voltage** (0-30V typical) - **Current limiting** - essential for prototyping! - **Display**: Real-time V and I (and P) monitoring ] .column[  ] ] --- class: default-slide # Others Think **power** (not voltage), use proper transformer (AC VS DC, switching VS linear, ...) .two-columns[ .column[ ### Solar - Panels output DC - Need charge controller - Variable output (clouds!) ] .column[ ### Other - Dynamo/generator (HV for transport?) - Wind turbine - Thermoelectric (TEG) - Energy harvesting ] ] --- class: default-slide # DIY: ATX Power Supply Conversion .two-columns[ .column[ 💡 Convert an old PC power supply into a powerful lab supply! - **(-12V), 3.3V, 5V, 12V rails** available - **High current** (>10A : ⚠️ add fuses) - Put On : **Green** (important!) cable to GND - **Nearly free** (old PC supplies) - Highly customizable (we are makers, aren't we?): QC module, USB power, meas., ... ] .column[ .center[
] ] ] 💡 Add banana jacks and a power switch for convenience --- class: blue-slide # 3. Get (Almost) Any Voltage - USB Power Delivery & Quick Charge - DIY: QC Fab Trigger Board - LDO vs Switching Regulators - Voltage Regulator Modules - Power Switching & Regulation --- class: default-slide # USB Power Delivery & Quick Charge .two-columns[ .column[ ## USB PD - Open (quite complex) specifications - Std. voltages : 5V, 9V, 12V, 15V, 20V - (Almost) any voltage with PPS (20mV steps) - Possibly : current regulation - Up to 100W (240W with EPR) - USB-C cable/connector required ] .column[ ## Quick Charge (QC) - Qualcomm proprietary (but easy) - Std. voltages : 5V, 9V, 12V, 20V - (Almost) any voltage with QC3 (200mV steps) - (Almost) any USB connector ] ] --- class: default-slide # DIY: QC Fab Trigger Board .two-columns[ .column[ 💡 Make your own QC trigger board (for testing purposes)! Presented in bootcamp León (2024). - **Request any voltage** from QC chargers - **Fab-able PCB** design, **Simple circuit** - Two versions (so far) : * [atTiny412 : small is beautiful](https://fabacademy.org/2018/labs/fablabulb/students/nicolas-decoster/alumnus/projects/qc/) * XIAO : diagnostic tools, screen, rotary encoder, ... ] .column[
Multi-purpose XIAO QC board.
] ] --- class: default-slide # DIY: QC Fab Trigger Board .two-columns[ .column[
] .column[ The CHY103 datasheet provides a very good overview of the (proprietary) QC2/3 protocol. | D+ | D- | Output | |:------|:------|:--------| | 0.6V | 3.3V | enter continous mode | | 0.6V | 0.6V (glitch) | Decrease 0.2V | | 3.3V (glitch) | 3.3V | Increase 0.2V | ] ] --- class: blue-slide # DIY: QC Fab Trigger Board Let's make one! .center[
QC Fab : https://fabacademy.org/2018/labs/fablabulb/students/nicolas-decoster/alumnus/projects/qc/
] --- class: default-slide # LDO vs Switching Regulators .two-columns[ .column[ ### LDO (Linear) - Simple, low noise - Efficiency = Vout/Vin - Heat = wasted power - Example: **XIAO** boards ] .column[ ### Switching - Complex, some noise - 80-95% efficiency - Less heat - Example: **Raspberry Pi Pico** ] ] ⚠️ For battery projects: switching regulators save power for "big" processors, ldo for very low power consumption. (Best : none) --- class: default-slide # Voltage Regulator Modules .two-columns[ .column[ ### PD/QC Trigger Module - Set fixed output from USB PD/QC chargers - Compact, cheap, easy to use - Usually "hackable" / reconfigurable ] .column[
] ] --- class: default-slide # Voltage Regulator Modules .two-columns[ .column[ ### Step-Up (Boost) Converters - Increase voltage (e.g., 3.7V → 5V) - From battery or USB - Semi-fixed ] .column[
] ] --- class: default-slide # Voltage Regulator Modules .two-columns[ .column[ ### Step-Down (Buck) Converters - Decrease voltage (e.g., 12V → 5V) - More efficient than linear regulators ] .column[
] ] --- class: default-slide # Voltage Regulator Modules .two-columns[ .column[ ### Buck-Boost Converters **When input can be above AND below target** Example: Li-ion (3.0V - 4.2V) → fixed 3.3V - 4.2V → buck down to 3.3V - 3.0V → boost up to 3.3V ✅ Constant output regardless of battery state ] .column[
Rpi Pico has a buck-boost converter
(NOT the XIAO-RP2040!)
] ] --- class: default-slide # Power Switching ## Controlling Higher Power Devices from MCUs .two-columns[ .column[ ### DC Loads - **MOSFET** : Low-side (N-ch) (+ openDrain) or high-side (P-ch) switching - **BJT** : Simple, but base current needed - **H-Bridge** : Motor direction control (TB67H451, DRV8251...) - **Relay** : Galvanic isolation, mechanical ] .column[ ### AC Loads (⚠️ Mains!) - **Relay** : Galvanic isolation, simple - **Triac** : Fast switching, no isolation - **Opto-triac** (MOC3021...) : Isolation + triac - **SSR** : Solid State Relay, integrated ] ] ⚠️ Always use flyback diodes with inductive loads (motors, relays) 💡 Logic level MOSFETs (e.g., IRLZ44N) can be driven directly by 3.3V/5V MCUs --- class: default-slide # Power Regulation ## Controlling the Amount of Power .two-columns[ .column[ ### DC Loads - **PWM** : Fast switching (kHz), avg. voltage control - **Low-freq PWM** : Slower switching for heaters, large loads - **Current regulation** : Constant current for LEDs (drivers) : usually high freq pwm + coil - **Analog dimming** : Voltage control (less efficient) ] .column[ ### AC Loads - **Triac phase control** : Delay firing angle (dimmers) - **Zero-crossing** : On/off at zero V (less noise) - **Cycle skipping** : Skip full cycles (heaters) ] ] 💡 PWM frequency matters: too low = flicker (LEDs), too high = switching losses 💡 LEDs prefer current control over voltage control for consistent brightness --- class: blue-slide # 4. Efficiency Considerations - Underclocking - Cut Unused Peripherals - Sleep Modes & Interrupts - Fit for Purpose --- class: default-slide # Underclocking ## Reduce clock frequency when possible - **P ∝ F** - Linear power reduction - Many MCUs support dynamic frequency scaling (careful with "time" functions) - Run fast only when needed ```python // Example: RP2040 frequency scaling machine.freq(48_000_000) #48MHz instead of 125MHz (>60% savings) ``` --- class: default-slide # Cut Unused Peripherals - Disable unused GPIO pins + don't leave floating inputs - Turn off ADC, DAC, timers when not needed - Disable WiFi/Bluetooth radio when idle - Use peripheral power gating (or power from GPIO when possible) - Avoid always on LEDs! Better flash them. 💡 Check your MCU's power management features! --- class: default-slide # Sleep Modes & Interrupts .two-columns[ .column[ ### Watchdog Timer - Wake periodically, do task, sleep again - Usually 32768Hz clock (~1000 times less!) ] .column[ ### External Interrupts - Wake only on external events (button, sensor) - Deep sleep / idle between events ] ] --- class: default-slide # Fit for Purpose ## When does efficiency matter? .two-columns[ .column[ ### Plugged In - Power is "free" - Optimize for performance - Heat may be a concern ] .column[ ### Battery Powered - Every mW counts! - Optimize for efficiency - Affects battery life directly ] ] 💡 A 2000mAh battery @ 20mA = 100 hours = ~4 days 💡 Same battery @ 200µA = 10000 hours = ~416 days! --- class: blue-slide # Key Takeaways 1. Know your basics: P = U × I, and P ∝ U² × F 2. Choose the right source : USB, battery, mains, solar... 3. Get the right voltage: Buck, boost, LDO, PD/QC 4. Optimize for your use case : - Plugged in → performance - Battery → efficiency --- class: blue-slide ## Questions?