DevTools Logo
All posts

Resistors, UART, Batteries, Antennas & PWM: Hardware Math

September 5, 2026 · DevTools

electronics
uart
iot
rf
pwm

Hardware bugs are the expensive kind — a wrong resistor ships on a board, a baud error corrupts every hundredth byte, a battery dies in the field. These five calculators check the math before solder meets copper: Resistor Color Code & SMD Calculator, UART Baud Rate Calculator, IoT Battery Life Estimator, RF Wavelength & Antenna Calculator, and PWM Duty Cycle & Motor Calculator.

Read any resistor: bands, SMD codes, and EIA-96

decodeResistorBands accepts 4, 5, or 6 bands — two significant digits for 4-band, three for 5/6-band — looking up digits, multipliers, tolerances, and temperature coefficients from the standard color tables. decodeSmdCode handles 3-digit, 4-digit, and EIA-96 formats, and encodeResistor works backwards from a target value to band colors. Results format with SI units, so 4700 Ω reads as 4.7 kΩ.

yellow · violet · red · gold  →  47 × 100 = 4.7 kΩ ±5%
"1002" SMD                   →  100 × 100 = 10 kΩ

If the decoder reports an invalid multiplier or tolerance band, you are probably reading the part backwards — flip it and check that tolerance (gold/silver) sits on the right.

Serial timing and battery budgets

calculateUartBaudRate derives the actual baud from clock / (oversampling × (divisor + 1)), then reports error percent against your target plus full frame timing — bit time and byte time with start, data, parity, and stop bits. classifyBaudError grades the result: under 2% is reliable, up to 4.5% is caution, beyond that is risky. It also sweeps common rates from 1200 to 230400 against your clock so you can pick the fastest safe option.

estimateBatteryLife averages active and sleep current over the duty cycle, applies a Peukert correction for high-draw loads, and caps the result at the self-discharge limit — a cell that self-discharges 2% yearly caps the estimate at roughly 50 years no matter how rarely you wake. It reports runtime in hours, days, and years plus estimated wake cycles, so a sensor waking 2 seconds every 10 minutes on a 2400 mAh cell resolves to a concrete deployment lifetime, not a guess.

Antennas and motors: wavelength in, motion out

calculateRfAntennaWavelength computes λ = c / f with the exact speed of light, then derives full-wave, half-wave dipole, and quarter-wave dimensions scaled by a velocity factor (default 0.95). A 433.92 MHz ISM link gives λ ≈ 0.69 m, so a half-wave dipole starts around 33 cm before trimming; the tool also flags ISM, AM/FM broadcast, VHF, and UHF band membership.

FrequencyWavelengthHalf-wave dipole
433.92 MHz (ISM)0.691 m0.328 m
868 MHz (ISM)0.345 m0.164 m
2.45 GHz (WiFi)0.122 m0.058 m

calculatePwmDutyCycleMotor turns frequency and duty percent into period, on/off times, average voltage (Vcc × duty), and estimated RPM against the motor's max, plus timer register math — prescaler and auto-reload options — and an RC-filter cutoff with a ripple note when the cutoff sits too close to the PWM frequency.

Try Them