Scherz & Monk, Chapter 17

Modular Electronics

Modern invention rarely means designing from discrete transistors. Suppliers wrap hard-to-use chips behind friendly 0.1-inch headers, and the skill shifts from circuit design to system composition: choose modules, share power and data buses, and resolve the glue — voltage levels, bus sharing, and power budgets.

Prerequisites: Ohm's law & voltage dividers + logic levels (5V/3.3V) + microcontrollers, I²C & SPI
17
Chapters
4+
Simulations
0
Assumed Knowledge

Chapter 0: The Weekend Build

You want a wireless weather station — this weekend, not next semester. The old way is brutal: design an RF transmitter from a crystal and a handful of inductors, build a humidity front-end around a capacitive sensor, design an LCD controller, lay out a PCB, debug the analog. Each piece is a project. Together they are a month of evenings.

The modern way is different. You grab four small boards: a 433 MHz transmitter, a humidity sensor, a 2×16 LCD, and an Arduino. Each is a finished board with labeled 0.1-inch headers. The hard analog and RF work is already done and tested by SparkFun, Seeed, or Pololu. Your "design" collapses into four tasks: plug them together, share power, share a data bus, and write firmware.

That is modular electronics — the foundation of the entire maker and open-source-hardware ecosystem. But the modules don't compose for free. Three glue problems stand between you and a working station, and every chapter that follows attacks one of them: voltage-level compatibility (does this 5V Arduino pin fry that 3.3V module?), bus sharing (can four chips share two I²C wires?), and power budgeting (will all of this run off one USB port?).

The design has moved up a level. You are no longer choosing resistor values for a transistor's bias network. You are choosing boards and reasoning about the interfaces between them. The questions become: what voltage does each board want? Which bus does it speak? How much current does it draw? Get those three right and a month-long project becomes an afternoon.
Drag-and-Compose System Builder

Drag module cards onto the breadboard. Wires snap in automatically: power flow is red, data flow is blue. If you wire a 5V source straight into a 3.3V-only module, the link flashes a warning. Build the weather station: Arduino + 433MHz TX + Humidity + LCD.

Click a module button to add it. Wires connect to the Arduino automatically.

The Three Glue Problems, Previewed

Levels — 5V vs 3.3V
An Arduino Uno's pins swing to 5V. A Bluetooth or Raspberry Pi pin tops out at 3.3V and is not 5V-tolerant. Drive 5V into a 3.3V input and you can destroy it. Fix: a resistor divider or a level-shifter chip.
Bus — I²C / SPI sharing
Many modules speak I²C (two wires, addressed) or SPI (four wires, chip-select). The trick is letting several share the same wires without colliding. Each I²C device needs a unique address; each SPI device needs its own CS line.
Power — budget vs supply
Every module draws current. Add them up. The total must stay under what your source can deliver — 500 mA from USB, or whatever your on-board regulator is rated for — with headroom to spare.
In modular electronics, what has the "design problem" become, compared with building from discrete parts?

Chapter 1: There's an IC for It

Before modules came chips. The first lever that cut invention down to size was the specialized integrated circuit — a single package that does a job that once needed a dozen discrete parts. You don't build an H-bridge from four transistors and four flyback diodes when an L298 already contains two of them. You don't count clock pulses with flip-flops when an NE555 makes the pulse for you.

The skill here is recognizing that a hard sub-problem almost certainly has a chip. Need to drive a motor in both directions at 2 A? That's an L298 dual H-bridge. Need a clock, a timer, or a square wave? The NE555. Need to light eight LEDs from a microcontroller without burning eight pins? A MAX6958 I²C LED driver does it over two wires. Need a clock that survives power loss? The DS1302 real-time clock. Need 128 KB of non-volatile storage? A 24C1024 I²C EEPROM. Need 10 W of audio? The TDA2003 amplifier.

These chips concentrate the analog cleverness into one part, but they come with a cost: many are surface-mount packages with pins on a 0.5 mm pitch, impossible to solder by hand or to plug into a breadboard. That cost is exactly what the next chapter's breakout boards exist to remove.

Worked Example: Part-Count Collapse

Suppose you want to drive a single DC motor forward and reverse. Built discretely, a bidirectional H-bridge needs 4 power transistors, 4 base resistors, and 4 flyback diodes — 12 parts, plus the layout to keep the high-current paths short. With an L298 you have 1 IC plus a couple of decoupling capacitors and the flyback diodes the datasheet recommends. The part count drops from 12 to roughly 3, and the result is a tested, thermally-rated block.

12 discrete parts → 1 IC + 2 caps  ≈  75% fewer parts, plus the design is pre-validated
Concentration of cleverness. A specialized IC is a frozen design decision. Someone already chose the topology, the gain, the protection, and characterized it across temperature. You inherit all of that for the price of one part number. The trade you accept is flexibility: the chip does what it does, and bending it to a different job is often harder than picking a different chip.
Part-Count Collapse: Discrete vs IC

Pick a function. The bars compare the discrete part count against the same job done with one specialized IC plus its support parts.

What is the main practical drawback of the specialized ICs that concentrate so much function into one part?

Chapter 2: Breakout Boards vs Modules

Two words get used loosely in the maker world, and the distinction actually matters. A breakout board takes a surface-mount IC and routes its tiny pins out to a row of 0.1-inch (2.54 mm) header holes — the breadboard-friendly spacing. That is essentially all it does: it makes an un-handleable chip handleable. It may add a decoupling capacitor or two, but the intelligence is still the bare IC.

A module goes further. It wraps the IC and the surrounding circuit a beginner would otherwise have to build: a voltage regulator so it can run off whatever you feed it, decoupling and bulk capacitors, pull-up resistors, sometimes a level-conversion stage so its 3.3V chip can talk to a 5V microcontroller, status LEDs, and the support passives from the datasheet's typical-application schematic. A module is closer to "plug in power and signals, it just works."

Breakout. SMD pins → 0.1-inch headers. Minimal extras. You still supply the right voltage and any pull-ups. Cheap, flexible, demands that you read the datasheet.
Module. Breakout plus regulator, decoupling, pull-ups, often level conversion. More forgiving, slightly more expensive, fewer ways to get it wrong.

Worked Example: Why the On-Board Regulator Matters

A bare 3.3V sensor IC fed straight from a 5V rail is destroyed instantly — that is a 1.7V overvoltage on every pin. A breakout hands you the raw 3.3V chip and trusts you to supply 3.3V. A module usually carries an on-board LDO regulator that accepts a wide input (say 3.3–6V) and produces the clean 3.3V the chip needs. Feed the module 5V and the regulator drops the excess as heat:

Pregulator = (Vin − Vout) × I = (5V − 3.3V) × 50mA = 1.7V × 0.05A = 0.085W

85 mW is trivial to dissipate, which is why so many 3.3V modules happily accept a 5V supply pin — the regulator absorbs the difference. The breakout version would have made that 1.7V your problem.

Anatomy: Breakout vs Module

Toggle between the same IC sold as a bare breakout and as a full module. Watch which support blocks appear — regulator, decoupling, pull-ups, level shifter.

What is the difference between a breakout board and a module?

Chapter 3: The Module Zoo

Once you start composing systems, you discover a sprawling catalog. It helps to group modules by the role they play in a project, because the role tells you which interface and which glue problem to expect.

CategoryExamplesTypical interface
SensorHumidity, compass (magnetometer), HC-SR04 ultrasonic, accelerometerI²C, analog, or trigger/echo pins
RF / wireless433/315 MHz TX/RX pairs, nRF24L01, Bluetooth, WiFi, XBeeSPI or serial (UART)
Display2×16 / 4×20 character LCD, graphical LCD, OLEDParallel, I²C, or SPI
Power / controlMotor drivers, relay boards, MOSFET switches, regulatorsDigital pins / PWM
AudioTDA2003 amp boards, MP3 decoder modulesAnalog / serial

The grouping is not bureaucratic — it is predictive. Tell me a module is a sensor and I'll bet it speaks I²C or hands you an analog voltage. Tell me it's a wireless module and I'll expect SPI or a serial port and, often, a 3.3V supply. Tell me it's a display and I'll ask whether it's the parallel-wired LCD (many pins) or the I²C-backpack version (two pins). The interface is the contract between the module and your microcontroller.

Read the contract first. Before you buy a module, find three numbers on its product page: supply voltage (3.3V? 5V? a range?), interface (I²C address? SPI? analog?), and current draw. Those three numbers tell you immediately which of the glue problems you'll face. A module is only "plug and play" once you've confirmed it speaks your microcontroller's language at your microcontroller's voltage.

Worked Example: Choosing a Distance Sensor

You need to measure distance. Two common modules: the HC-SR04 ultrasonic (trigger pin + echo pin, 5V, ~15 mA) and a time-of-flight VL53L0X (I²C, 3.3V, ~20 mA). The ultrasonic plugs straight into a 5V Arduino with no level worries but eats two GPIO pins and needs careful pulse timing. The ToF module shares the I²C bus with your other sensors (just two wires for all of them) but is 3.3V — raising the level-shifting question. Same job, different glue.

Module Zoo Browser

Click a category to filter. Each card shows the module's supply voltage, interface, and approximate current draw — the three numbers that decide which glue problem you face.

Why does knowing a module's category help you plan the wiring?

Chapter 4: Wireless Modules

Going wireless used to mean RF engineering: matching networks, antenna design, FCC headaches. Wireless modules hand you a finished radio with a digital interface, so your firmware never touches an RF signal — it just reads and writes bytes.

The simplest are the 433 MHz / 315 MHz TX–RX pairs. The transmitter has a data pin, a power pin, and an antenna stub; the receiver mirrors it. They are cheap, one-way (simplex), modest in speed (around 8 kb/s), and reach perhaps 100 yards line-of-sight. Perfect for a weather station beaming readings to a base — the data only needs to go one direction.

For two-way links there's a hierarchy. Bluetooth modules present a transparent serial port (write a byte, it appears on the phone), but most are 3.3V parts — the level question again. WiFi modules put you on a real IP network at the cost of higher peak current. nRF24L01 is a popular SPI transceiver for board-to-board links. And XBee modules give you "transparent serial": whatever you send into one XBee's UART comes out of the paired XBee's UART, anywhere in range, with no protocol to write.

"Transparent serial" is the killer feature. An XBee or a Bluetooth module that behaves like a wire between two serial ports lets you take any working wired serial design and make it wireless with zero firmware change. Your code still does Serial.print(); the bytes just travel over the air. The radio is invisible — which is exactly why these modules feel like magic.

Worked Example: One-Way Link Budget for the Weather Station

The weather station sends a temperature + humidity reading once a minute. Each reading is, say, 16 bytes = 128 bits. At the 433 MHz module's ~8 kb/s the on-air time is:

t = 128 bits / 8000 bits·s−¹ = 0.016 s = 16 ms per reading

Sixteen milliseconds once a minute. The radio is idle 99.97% of the time, the simplex link is plenty fast, and the TX module sips only ~10 mA while sending. A cheap one-way 433 MHz pair is wildly over-spec for this job — which is why it's the right, cheapest choice.

Wireless Module Picker

Compare wireless options on the axes that matter for composition: supply voltage, interface, direction, range, and peak current. The 3.3V parts are flagged — those are the ones that need level shifting against a 5V Arduino.

Why is a one-way 433 MHz TX/RX pair a sensible choice for a weather station that just reports readings to a base?

Chapter 5: Logic-Level Compatibility

Here is the single most common way to fry a module: connect a 5V logic output to a 3.3V logic input. An Arduino Uno drives its pins to 5V for a HIGH. A Bluetooth module, an ESP, or a Raspberry Pi GPIO pin expects HIGH to be about 3.3V, and many are not 5V-tolerant — the extra 1.7V can permanently damage the input. The Raspberry Pi in particular: its GPIO is 3.3V and feeding 5V into a pin can kill the chip.

The cleanest fix for a one-directional 5V→3.3V signal is a resistor voltage divider. Two resistors in series from the 5V signal to ground; tap the junction for the 3.3V input. From Chapter 2's voltage-divider law:

Vout = Vin · R2 / (R1 + R2)

To turn 5V into 3.3V we need the ratio R2/(R1+R2) = 3.3/5 = 0.66.

Worked Example: 5V Arduino TX → 3.3V Bluetooth RX

Pick convenient values. Let R1 = 1.0 kΩ and R2 = 2.0 kΩ. Then:

Vout = 5V · 2000 / (1000 + 2000) = 5V · 0.667 = 3.33V  ✓

That 3.33V lands comfortably inside the 3.3V module's HIGH band. The current wasted in the divider is tiny:

I = Vin / (R1 + R2) = 5V / 3000Ω = 1.67 mA  (negligible)
The divider only works one way. A resistor divider safely steps a 5V output down to 3.3V. It does not step a 3.3V output up to 5V — and often you don't need it to, because a 3.3V HIGH usually already exceeds a 5V chip's HIGH threshold (around 2–3V for many 5V parts). For fast, bidirectional lines like I²C, skip the divider and use a proper bidirectional level shifter (a tiny MOSFET-based board). The divider is for simple, slow, one-way signals.
5V↔3.3V Level-Shifter Lab

Drive a 5V signal through a divider into a 3.3V module. Adjust R1 and R2 to land Vout inside the shaded 3.3V–HIGH band. Watch the live Vout and divider current. The classic answer is R1=1k, R2=2k.

R₁ (kΩ) 1.0
R₂ (kΩ) 2.0
To step a 5V Arduino output down to ~3.3V with a divider, which resistor pair works?

Chapter 6: Sharing a Bus: I²C & SPI

The beauty of I²C and SPI is that many modules share the same wires. Without a shared bus, every sensor would need its own pins and you'd run out fast. The two protocols solve the sharing problem differently.

I²C: Two Wires, Addressed

I²C uses just two lines — SDA (data) and SCL (clock) — shared by every device. Each device has a unique 7-bit address. The master broadcasts an address; only the matching device responds. Add a fifth sensor and you still use the same two wires. The catch: if two devices share the same address, they both answer at once and you get a collision — the bus is corrupted. Many chips offer an address-select pin precisely to dodge this.

Because the lines are open-drain, devices can only pull them low; something must pull them high. That something is a pair of pull-up resistors, one on SDA and one on SCL — and crucially, one pair for the whole bus, not one per device.

Sizing the Pull-Ups

Too large and the lines rise too slowly (rounded edges, missed bits). Too small and devices can't pull them low cleanly, and you waste current. The bounds:

Rmin ≈ (VDD − 0.4) / 3mA     Rmax = tr / (0.8473 · Cbus)

Worked Example: 5V Bus at 100 kHz

Standard-mode I²C allows a rise time tr ≤ 1 µs. Suppose the bus capacitance is C = 150 pF (a few modules plus wiring). Then:

Rmax = 1µs / (0.8473 × 150pF) = 1×10−⁶ / (1.27×10−⁹) ≈ 7.9 kΩ
Rmin = (5V − 0.4V) / 3mA = 4.6 / 0.003 = 1.53 kΩ

So any pull-up between ~1.5 kΩ and ~7.9 kΩ works. The universal default 4.7 kΩ sits right in the middle of that window — which is why you see it everywhere on 5V I²C buses. On a 3.3V bus people often drop to 2.2–4.7 kΩ. And remember: two devices or ten, it's still one pull-up per line.

SPI does it differently. SPI shares MOSI, MISO, and SCK across all devices but gives each its own chip-select (CS) line. Instead of addresses, the master pulls exactly one CS low to pick a device; everyone else ignores the clock. No address collisions are possible — but you spend one extra pin per device. I²C trades pins for addressing; SPI trades addressing for pins and speed.

Shared I²C / SPI Bus Visualizer

Three modules on a shared bus. In I²C mode the master calls an address — only the matching module lights up. Set two modules to the same address to trigger a collision. Switch to SPI mode and select a device by its chip-select line instead.

I²C mode. Master idle. Click "calls next" to address a module.
Two I²C modules share the bus. How many pull-up resistors does the SDA line need?

Chapter 7: Power Budgeting

You can wire every level and every address correctly and still have a dead project — because the modules collectively want more current than your supply can give. Power budgeting is the discipline of summing each module's current draw and checking it against the source's rating, with headroom to spare.

Itotal = Σ Imodule ≤ Isource   (aim for ≤ 80% of the rating)

The two limits you bump into most: a USB port supplies 500 mA (USB 2.0 default), and an on-board voltage regulator has its own rated output current — say 800 mA for a typical 3.3V LDO, but only if it can shed the heat. Exceed either and the rail sags, the microcontroller browns out, or the regulator overheats and shuts down. The 80% headroom rule keeps you off that cliff and covers current spikes (a WiFi radio's transmit burst, a motor's stall).

Worked Example A: The Basic Weather Station Fits Easily

Sum the four modules running off USB:

ModuleCurrent
Arduino~50 mA
433 MHz TX~10 mA
Humidity sensor~2 mA
2×16 LCD~25 mA
Total87 mA
87mA / 500mA = 0.174 = 17% of the USB budget — tons of headroom

Worked Example B: Upgrade and Blow the Budget

Now swap the character LCD for a graphical LCD (~120 mA) and add WiFi (~250 mA peak):

50 + 10 + 2 + 120 + 250 = 432 mA  →  432/500 = 86% of USB

86% blows past the 80% headroom line, and WiFi's peak bursts can momentarily exceed even 500 mA. The fix isn't a bigger USB port — it's to add a dedicated 3.3V regulator to power the hungry WiFi module from its own rail, so the USB port isn't carrying every spike. Offloading WiFi's 250 mA drops the USB draw back to ~182 mA (36%), comfortable again.

Peaks, not averages, kill you. A WiFi or cellular module might idle at 80 mA and spike to 250 mA (or far more) for milliseconds when it transmits. Budget for the peak, and add a bulk capacitor near the hungry module so it can draw from the cap during the spike instead of yanking the whole rail down. Average-current thinking is how brownout bugs sneak in.
Power-Budget Meter

Toggle modules on and off. The fuel gauge fills as current adds up, against your chosen supply cap. It turns amber past 80% and red past 100%. Switch the cap between 500 mA USB and an 800 mA regulator. Try the WiFi + graphical-LCD upgrade and watch it overflow.

Three modules drawing 50 mA, 120 mA, and 250 mA run off a 500 mA USB port. What's the situation?

Chapter 8: Plug-and-Play Prototyping

The ultimate convenience layer sits on top of modules: standardized form factors that snap together without wires at all. The Arduino ecosystem calls them shields — boards that stack onto the Arduino's headers, mating power and signal pins in one push. A motor shield, an Ethernet shield, an LCD shield: each is a module that already knows where every Arduino pin is.

Shields hide the wiring but not the physics. A motor shield still draws motor current; an Ethernet shield still has a chip-select; an SD-card shield still speaks SPI and is a 3.3V part behind a level shifter. The glue problems don't vanish — the good shields just solve them for you on the board, which is exactly the "module vs breakout" distinction one level up.

Other ecosystems take similar approaches. .NET Gadgeteer and Netduino use keyed connectors so you literally cannot plug a module into the wrong socket. The Raspberry Pi sits at the other end of the spectrum: a full Linux computer with a 40-pin GPIO header and a HAT (Hardware Attached on Top) standard — but with the permanent caveat that its GPIO is 3.3V and not 5V-tolerant, so every 5V module you attach needs level shifting.

Stacking trades flexibility for speed. A shield can only stack one way and one place; two shields that both claim pin 10 conflict, and you discover it the hard way. Wired modules are fiddlier but infinitely rearrangeable. Prototype fast with shields, but when two shields fight over pins or current, drop back to discrete modules and a breadboard where you control every connection.

Worked Example: Shield Pin Conflict

You stack an SD-card shield and a wireless shield. Both use SPI, sharing MOSI/MISO/SCK happily — but each needs a chip-select. If both shields hard-wire CS to pin 10, they'll both respond to the same select and corrupt each other's transfers. The fix mirrors Chapter 6: give each its own CS. One shield must be re-jumpered to, say, pin 8. The bus is shared; the selects must be unique — the same rule, now in hardware form.

Shield Stack Inspector

Stack shields onto the Arduino. Each shield claims certain pins. When two shields claim the same pin, the conflict flashes red — the hardware version of an address/CS collision.

Stack is empty. Add shields and watch for pin conflicts.
An SD shield and a WiFi shield both hard-wire chip-select to pin 10. What happens, and what's the fix?

Chapter 9: Open Source Hardware & the Whole Arc

None of this ecosystem would exist without a cultural shift: open-source hardware. The defining example is the Arduino itself. Its schematics, PCB layouts (drawn in EAGLE CAD), and firmware were published openly, so anyone could reproduce the board, build compatible shields, or remix the design. That openness is precisely why a universe of cheap clones, shields, and tutorials grew around it — the most successful open-source hardware project there is.

The same pattern drives RepRap and the early MakerBot 3D printers: publish the design files and a community improves them faster than any one company could. The business model is the halo effect — give away the design, sell the official boards, support, and brand. Openness becomes a moat, not a giveaway.

Prototype with modules, then integrate. The deepest lesson of this chapter is a workflow. Prove the concept fast by composing modules — levels, buses, power all handled board-by-board. Once it works, you optionally collapse the proven modules into one integrated PCB: take the schematics (often published!) and merge them, dropping the redundant regulators and headers. Modules de-risk the idea; integration optimizes cost and size. You get the speed of composition and the polish of a custom board.

This Chapter's Cheat-Sheet

ConceptKey relation / ruleWorked number
Level shift (down)Vout = Vin·R2/(R1+R2)5V·2k/3k = 3.33V
Divider currentI = Vin/(R1+R2)5V/3k = 1.67mA
Regulator dropP = (Vin−Vout)·I1.7V·50mA = 85mW
I²C pull-up minRmin = (VDD−0.4)/3mA(5−0.4)/3mA = 1.53kΩ
I²C pull-up maxRmax = tr/(0.8473·C)1µs/(0.8473·150pF) = 7.9kΩ
I²C defaultone shared pair, in range4.7kΩ (5V bus)
Power budgetΣI ≤ Isource, ≤80%87mA / 500mA = 17%
Budget blownadd a dedicated regulator432mA / 500mA = 86%

The Three Glue Problems, One Last Time

Levels: step 5V→3.3V with a divider (slow, one-way) or a bidirectional shifter (I²C). Never feed 5V into a non-tolerant 3.3V pin.
Bus: I²C = two wires + unique 7-bit addresses + one shared pull-up pair; SPI = shared MOSI/MISO/SCK + one CS per device.
Power: sum the currents, stay under 80% of the source, budget for peaks, offload hungry modules to their own regulator.
Then: prototype with modules, optionally integrate to a custom PCB once the concept is proven.

Closing the Book

This is the final chapter, and it's the right place to land. The whole book has climbed a ladder of abstraction. We started at the theory of voltage and current and discrete components — resistors, capacitors, the raw physics. We built up through semiconductors, op-amps, filters, and oscillators & timers into reusable analog blocks. We crossed into digital logic and then microcontrollers, where software started doing the work that circuits used to. We drove the physical world with motors and made sound with audio.

Modular electronics is where all of that becomes leverage. Every discrete principle you learned is now frozen inside a module someone else validated — the op-amp in a sensor front-end, the timer in an RF module, the H-bridge in a motor driver, the regulator on every board. You don't forget the fundamentals; you stand on them. Understanding what's inside a module is exactly what lets you debug it, shift its levels, share its bus, and budget its power. The inventor who knows both levels — the physics underneath and the composition on top — can build almost anything, in an afternoon.

"The best way to predict the future is to invent it — and the fastest way to invent it is to stand on what others have already built."

You now have the full stack: from the electron drift in a wire to the four-module weather station on your bench. Go compose something this weekend.

Why is the Arduino considered the most successful open-source hardware project?
← Chapter 16: Audio Back to Book Index →