Skip to main content
  • microcontrollers
  • embedded systems
  • pcb design
  • electronics
  • firmware

Microcontroller Selection: Choose by Constraints

The Boss Factory9 min read

A microcontroller rarely fails a design because its clock is 20 MHz too slow. It fails because the radio occupies the SPI bus, the wake source shares a pin, the ADC cannot resolve the sensor signal, or the library does not support the peripheral you planned to use.

Good microcontroller selection works like design for manufacture. Start with the constraint that controls the geometry, then reshape the design around it. For a PCB, that means choosing the MCU by radio, sleep current, pin count, analog quality, logic voltage, and library maturity, in that order.

Start with the constraint that cannot move

A part can have ample processing power and still be the wrong part. The first pass should describe the build without naming a chip:

  • Radio protocol and antenna restrictions
  • Active current, sleep current, and wake sources
  • Inputs, outputs, buses, interrupts, and programming pins
  • ADC channels, reference voltage, resolution, and sampling speed
  • Logic levels between the MCU and every attached device
  • Required libraries, frameworks, bootloaders, and update method

Write the pin and peripheral schedule before drawing the schematic. Count every item, including status LEDs, chip-select lines, interrupt inputs, UART pins used for debugging, reset, boot straps, and test points. Leave at least one practical route for programming and diagnosis. A board that works only after its debug header is removed is not finished.

Pin count and peripheral conflicts end more designs than clock speed ever does. Treat each multifunction pin as a constrained feature, not as an available hole in a list.

Choose the radio before choosing the core

If the product needs Wi-Fi, Bluetooth Low Energy, Thread, Zigbee, LoRa, cellular, or no radio, decide that first. Radio requirements change the package, antenna layout, power supply, certification burden, sleep behaviour, firmware stack, and often the usable GPIO count.

Check these items in the exact chip or module revision:

  • Supported protocols and operating bands
  • Peak transmit current, not just average current
  • Deep-sleep current with the required RAM and wake sources enabled
  • Antenna clearance and keepout requirements
  • Available GPIO while the radio and flash interface are active
  • Production firmware and over-the-air update support

Do not compare a bare MCU sleep number with a development board measurement. Regulators, USB interfaces, indicator LEDs, sensors, and power LEDs can dominate the board current. Measure the assembled power path in the state the finished product will use.

For a battery device that wakes briefly, reads a sensor, transmits, and sleeps, wake time can matter as much as sleep current. A controller that draws less in deep sleep but takes longer to associate with a network may consume more energy over a day. Measure one complete duty cycle: sleep, wake, sensor startup, processing, transmission, retry behaviour, and return to sleep.

Pin count is a routing problem, not a headline number

Count signals by function and then assign them to actual pins. A label such as "two SPI buses and four interrupts" is not enough. Verify which pins can provide those functions simultaneously, which pins are input-only, which are reserved at boot, and which are connected internally to flash, PSRAM, USB, or the radio.

Make a pin matrix before layout:

ConstraintIf it is tightIf it is looseDesign consequence
Radio and high-speed busesReserve assigned pins and check alternate functionsMore freedom to move sensors and displaysPick the package and pin mux before routing
Sleep currentMeasure the complete board in its lowest-power stateOptimize active performance firstRemove pull-ups, LEDs, and regulators that defeat sleep
GPIO count and interruptsAdd an I/O expander or change the interfaceKeep spare pins for test and revisionDo not spend debug and boot pins casually
Analog accuracyUse a suitable ADC, reference, filtering, and layoutTreat analog inputs as threshold signalsSelect the converter from error and noise limits
Logic voltageAdd level translation or choose compatible devicesConnect only within specified limitsCheck high-level and low-level thresholds, not nominal labels
Software supportChoose a mature framework and existing driverExperiment with less-supported peripheralsEstimate integration time from examples and issue history

Peripheral conflicts often appear late. An I2C controller may share pins with boot configuration. A timer channel may be needed for PWM while its pin is also the only usable interrupt input. A UART used for logging may be the programming interface. An ADC channel may be unavailable while Wi-Fi is active on a particular variant.

Leave spare capacity where a failure would be expensive: one serial port for diagnostics, one test pad for a critical rail, and enough GPIO to replace a part whose alternate function proves inconvenient. Spending a little board area here is usually cheaper than changing the controller after layout.

Analog quality and logic voltage set the real electrical limits

ADC resolution is only one part of analog performance. The useful question is whether the complete measurement chain can distinguish the change you care about. Include sensor error, reference error, input impedance, source settling time, PCB noise, digital interference, and the ADC's effective number of bits.

A 12-bit converter over a 3.3 V reference has an ideal code width of about 0.8 mV, but that is not the same as 0.8 mV system accuracy. A noisy reference or a high-impedance source can erase several codes. If the sensor changes by tens of millivolts, filtering and layout may matter more than moving to a nominally higher-resolution ADC.

Check the datasheet conditions for the exact variant:

  • ADC input range and whether it reaches the supply rails
  • Reference source and reference tolerance
  • Recommended source impedance and acquisition time
  • Sample timing while other peripherals are active
  • Calibration support and temperature drift
  • Whether the ADC is shared with radio or internal functions

Logic voltage needs the same discipline. A 3.3 V MCU output may not meet the guaranteed high-input threshold of a 5 V peripheral, while a 5 V signal may exceed the MCU's absolute maximum rating. "5 V tolerant" is pin-specific on many families, and it may not apply during power-off or to analog mode. Check the electrical characteristics table for the exact pin and operating condition.

A level shifter fixes a voltage mismatch, not a bad bus topology. For I2C, account for pull-up voltage, rise time, bus capacitance, and the voltage limits of every device. For fast push-pull signals, choose a translator rated for the edge rate and direction changes. Sometimes the cheap way is better: replacing a 5 V sensor with a 3.3 V version can remove a translator, two failure modes, and a layout constraint.

Library maturity decides the calendar

Raw specifications describe what silicon can do. Library and toolchain maturity decides project duration far more than raw specifications. A peripheral that exists in the reference manual may still require register work, undocumented workarounds, or a forked driver.

Before committing, build a small proof board or firmware spike that exercises the risky parts together. Do not test the UART alone if the real design needs ADC sampling during radio activity and a timer-driven output. Test the combination that could force a redesign.

Look for:

  • A supported SDK version pinned in a reproducible build
  • Drivers for the exact sensor, display, storage device, and radio stack
  • Examples that cover the required operating mode, not only basic initialization
  • Documented sleep and wake behaviour
  • Debugging support through the chosen programmer and operating system
  • Issue reports showing whether failures are understood and maintained

This is where choosing an MCU by clock speed causes wasted work. A faster core does not compensate for a missing driver, an unstable USB stack, or a bootloader that cannot perform the update scheme. Pick the slower part if its toolchain is predictable and its peripherals match the job.

Make the selection prove itself on the bench

The final choice should survive a short risk test before the PCB is committed. Use the intended package or a board that exposes the same signals, then verify the constraint that drove the decision.

For a first-pass test, record:

  1. Pin assignments, alternate functions, boot states, and unused pins.
  2. Current in active, radio-transmit, idle, and every sleep mode required by the product.
  3. ADC readings with the real source impedance and expected electrical noise.
  4. Logic levels at the receiving pins during startup, reset, and power-down.
  5. Library build, flash, debug, sensor communication, and recovery procedure.
  6. Worst-case timing with all important peripherals enabled together.

If one item fails, change the geometry of the design rather than adding hope. Move the sensor, remove the display, change the voltage domain, add an expander, select a different radio, or choose another MCU. The cheapest redesign is the one made before the board has copper on it.

Clock speed belongs near the end of this process. Once the radio, current budget, pins, analog path, voltage levels, and software support are known, compare processing margin and memory. A modest clock with spare RAM and stable drivers is a better production choice than a fast core that forces custom firmware in every peripheral.

Frequently asked questions

How many GPIO pins should I leave unused?

There is no fixed number. Reserve the pins needed for programming, reset, boot recovery, diagnostics, and likely board revisions. For a small controller, one spare input and one spare output may be useful; a wireless design may need more because radio and flash functions reduce practical availability. Build the pin matrix from the exact variant rather than relying on the package headline count.

Is a higher-resolution ADC always better?

No. Higher nominal resolution helps only if reference error, noise, source impedance, settling time, and layout support it. Calculate the voltage change that must be detected, measure the noise at the ADC pin, and test the sensor at the intended sample rate. A clean, calibrated lower-resolution measurement is preferable to a noisy converter with more bits.

Should I choose the fastest MCU I can afford?

Usually not. First prove the required timing, RAM, flash, current, peripherals, and libraries. Choose the smallest controller with useful margin after those tests. A faster part is justified when measured worst-case load leaves inadequate headroom, not because its clock number looks better in a comparison sheet.

We build made-to-order custom electronics and smart systems through The Boss Factory.

Related services

All services →

Have a project in mind?

Tell us what you want built — we reply within 24–48 hours.

Request a quote

Keep reading