embedcalc-mcp

v0.6.7
io.github.ethan-hub26/embedcalc-mcp Checked 4 days ago Published 2 months ago

Embedded calculators, codegen & schematic review: CRC, timing, struct, IEEE-754, KiCad.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

embedcalc_crc_to_c CRC → C Code Generator

Generate a complete, compilable C implementation (256-entry lookup table + compute function) for any CRC-8/16/32, plus its standard check value. Use a preset for common CRCs, or specify the Rocksoft model parameters (width/poly/init/reflect-in/reflect-out/xor-out) for a custom CRC. The generated code embeds check("123456789") so the result can be verified on target. Args: - preset (optional): one of CRC-8, CRC-8/MAXIM, CRC-16/CCITT, CRC-16/ARC, CRC-16/MODBUS, CRC-32, CRC-32/BZIP2. Overrides all other args. - bits (8|16|32), poly_hex (e.g. '0x1021'): required for a custom CRC. - init_he…

ParameterTypeDescription
bitsnumberCRC width in bits (8, 16, or 32). Required when no preset is given.
init_hexstringInitial CRC register value in hex (default 0x0).
poly_hexstringGenerator polynomial in normal (non-reflected) hex form, e.g. '0x1021'. Required when no preset is given.
presetstringStandard CRC preset. If given, all other parameters are ignored. One of: CRC-8, CRC-8/MAXIM, CRC-16/CCITT, CRC-16/ARC, CRC-16/MODBUS, CRC-32, CRC-32/BZIP2
reflect_inbooleanReflect each input byte (LSB-first processing). Default false.
reflect_outbooleanReflect the final CRC before XOR-out. Default false.
xor_out_hexstringFinal XOR value in hex (default 0x0).

embedcalc_regmap_to_c Register Map → C Generator

Generate C shift/mask #defines and a bit-field typedef struct for a hardware register from an LSB-first field list. Args: - register_name (string): e.g. 'CTRL'. Sanitized to [A-Z0-9_]. - fields (array of {name, width}): fields from bit 0 (LSB) upward, e.g. [{name:'EN',width:1},{name:'MODE',width:2},{name:'DIV',width:5}]. Total width must fit in 32 bits. Returns (structured): { c_code, total_bits, fields: [{name, width, shift, mask_hex}] }. Text content is the C source (defines + typedef struct with uint32_t bit-fields). Example: EN:1, MODE:2, DIV:5 -> CTRL_EN_SHIFT 0u / CTRL_EN_MASK 0x1…

ParameterTypeDescription
fields *arrayFields from LSB upward; total width <= 32 bits
register_name *stringRegister name, e.g. 'CTRL'

embedcalc_bitfield_macro Bit Field Value → C Macro

Decompose a 32-bit register value into set bits and generate a C macro of OR'd (1U << n) terms, plus decimal/binary/popcount views. Args: - value_hex (string): 32-bit value, e.g. '0x8001'. - macro_name (string, optional): default 'REG_VAL'. Returns (structured): { dec, hex, bin, ones_count, c_macro }. Example: '0x8001' -> #define REG_VAL ((1U << 0) | (1U << 15)), 2 bits set.

ParameterTypeDescription
value_hex *string32-bit register value in hex
macro_namestringC macro name (default REG_VAL)

embedcalc_can_bit_timing CAN Bit Timing Calculator

Compute exact CAN bit timing (BRP, segments, SJW, register values) for STM32 bxCAN, STM32 FDCAN (nominal/arbitration phase), and MCP2515 from clock, bitrate, and target sample point. Searches all valid prescaler/segment combinations and returns, per controller, the configuration whose sample point is closest to the target (ties: more TQ per bit, then smaller BRP). Register values are ready to write: bxCAN CAN_BTR, FDCAN FDCAN_NBTP, MCP2515 CNF1/CNF2/CNF3 (BTLMODE=1). All values follow the controller datasheets; BRP/TS values are 1-based (register encoding = value - 1 is already applied inside…

ParameterTypeDescription
bitrate_bps *integerTarget nominal bitrate in bit/s, e.g. 500000 for 500 kbit/s.
clock_hz *integerCAN controller input clock in Hz (bxCAN: APB1 clock; FDCAN: kernel clock; MCP2515: crystal Fosc). E.g. 36000000 for 36 MHz.
sample_point_percentnumberTarget sample point in percent. CiA 301 recommends 87.5 (the default).

embedcalc_uart_baud UART Baud Rate / BRR Calculator

Compute the STM32 USART BRR register (mantissa + fraction), the actual achieved baud rate, and the baud error for a given peripheral clock — plus frame size/character time for the given format. Args: - clock_hz (int): USART peripheral clock in Hz (e.g. 72000000). - baud (int): target baud rate (e.g. 115200). - oversampling (8|16, default 16): USART OVER8 setting. - data_bits (5-9, default 8), parity ('none'|'even'|'odd', default 'none'), stop_bits (1|1.5|2, default 1). Returns (structured): { mantissa, fraction, brr_hex, actual_baud, error_percent, frame_bits, char_time_us }. Rule…

ParameterTypeDescription
baud *integerTarget baud rate in bit/s
clock_hz *integerUSART peripheral clock in Hz
data_bitsintegerData bits per frame
oversamplingnumberOversampling (OVER8): 16 or 8
paritystringParity
stop_bitsnumberStop bits

embedcalc_i2c_timing I2C Timing & Pull-Up Calculator

Compute I2C pull-up resistor range (Rp min from sink current, Rp max from rise time vs bus capacitance), SCL high/low budget, and an STM32 I2C TIMINGR register estimate. Args: - mode: 'ls' (10k), 'sm' (100k), 'fm' (400k), 'fmp' (1M, 20mA sink), 'hs' (3.4M). - vdd (V, default 3.3), bus_capacitance_pf (default 100). - stm32_clock_mhz (default 16): I2CCLK kernel clock for the TIMINGR estimate. Returns (structured): rp_min_ohm / rp_max_ohm, scl high/low vs spec minimums, rise/fall limits, stm32 { presc, scll, sclh, sdadel, scldel, timingr_hex }. The TIMINGR value is an estimate per RM form…

ParameterTypeDescription
bus_capacitance_pfnumberTotal bus capacitance in pF (spec max 400 pF)
modestringBus speed mode: ls=10kHz, sm=100kHz, fm=400kHz, fmp=1MHz, hs=3.4MHz
stm32_clock_mhznumberSTM32 I2C kernel clock (I2CCLK) in MHz for TIMINGR estimate
vddnumberBus supply voltage in volts

embedcalc_spi_timing SPI Timing Calculator

SPI clock/frame timing: bit period, frame time, raw throughput. Args: sck_hz (SPI clock in Hz), bits_per_frame (default 8). Returns (structured): { bit_period_ns, frame_time_us, throughput_mbps }. Example: 10 MHz, 8 bits -> 100 ns/bit, 0.8 µs/frame, 10 Mbit/s.

ParameterTypeDescription
sck_hz *integerSCK clock frequency in Hz
bits_per_frameintegerBits per frame/transfer

embedcalc_i2s_clocks I2S Clock Calculator

I2S bit clock (BCLK/SCK) from audio format: BCLK = Fs x bits x channels. Args: sample_rate_hz (e.g. 48000), bits_per_sample (e.g. 16/24/32), channels (default 2). Returns (structured): { bclk_hz, bclk_period_ns, lrclk_hz }. Example: 48 kHz, 24-bit, stereo -> BCLK 2.304 MHz (434.03 ns), LRCLK 48 kHz.

ParameterTypeDescription
bits_per_sample *integerBits per sample per channel (16/24/32)
sample_rate_hz *numberSample rate Fs in Hz (44100, 48000, ...)
channelsintegerChannel count (2 = stereo)

embedcalc_lin_timing LIN Bus Timing Calculator

LIN bus timing: bit time, break field duration (13 bits), and worst-case frame time per LIN 2.x nominal (header 34 + response 10*(n+1) bits with 1.4x budget = (43+10n)/baud). Args: baud (typ. 9600/19200), data_bytes (1-8). Returns (structured): { bit_time_us, break_time_us, frame_time_us }. Example: 19200 baud, 8 bytes -> bit 52.08 µs, break 677 µs, frame 6406 µs.

ParameterTypeDescription
baudintegerLIN baud rate (max 20 kbit/s)
data_bytesintegerResponse data bytes

embedcalc_rs485_bus RS-485 Bus Calculator

RS-485 cable length limit (rule of thumb: length_m x bitrate_bps <= 10^8, capped 1200 m) and fail-safe bias resistors for >= 200 mV idle differential across 60 Ω (two 120 Ω terminators). Args: baud_bps, vcc (default 5), bias_ohm (optional — defaults to the computed maximum). Returns (structured): { max_cable_m, max_bias_ohm, bias_used_ohm, idle_vdiff_v, meets_200mv }. Example: 100 kbit/s -> 1000 m; Vcc=5 -> bias <= 720 Ω per side for 0.2 V idle.

ParameterTypeDescription
baud_bps *integerSignaling rate in bit/s
bias_ohmnumberChosen bias resistor per side in Ω (default: computed maximum)
vccnumberBias supply voltage

embedcalc_modbus_rtu_timing Modbus RTU Timing Calculator

Modbus RTU inter-character (t1.5) and inter-frame (t3.5) silence times. Per spec: 11 bits/char; above 19200 baud fixed t1.5=750 µs and t3.5=1750 µs. Args: baud. Returns (structured): { char_time_us, t15_us, t35_us }. Example: 9600 -> char 1145.8 µs, t1.5 1718.8 µs, t3.5 4010.4 µs; 115200 -> 750/1750 µs fixed.

ParameterTypeDescription
baud *integerBaud rate in bit/s

embedcalc_ring_buffer_size Ring Buffer / DMA Size Calculator

Size a ring buffer (or DMA buffer) from data rate, worst-case consumer latency, and a safety factor, rounded up to a power of two. Args: data_rate_bytes_per_sec, latency_ms (worst-case time before the consumer drains), safety_factor (default 2). Returns (structured): { bytes_needed, recommended_pow2 }. Example: 102400 B/s, 10 ms, ×2 -> 2048 bytes -> use 2048 (2^11).

ParameterTypeDescription
data_rate_bytes_per_sec *numberIncoming data rate in bytes/second
latency_ms *numberWorst-case consumer latency in milliseconds
safety_factornumberHeadroom multiplier (default 2)

embedcalc_qformat_convert Q-Format Fixed-Point Converter

Convert between float and signed Qm.n fixed point (1 sign + m integer + n fractional bits; e.g. Q0.15 = 16-bit "Q15"). Args: - m (int >= 0), n (int >= 0): format; m+n+1 <= 32. - value (float) OR raw_int (stored integer): provide exactly one. Returns (structured): { format, total_bits, scale, range_min, range_max, raw_int, hex, bin, actual, error, clamped }. hex/bin are two's complement in the format's bit width. Examples: 0.5 in Q0.15 -> 16384 = 0x4000; raw 0x8000 (-32768) in Q0.15 -> -1.0. Do not round by hand — quantization error matters.

ParameterTypeDescription
m *integerInteger bits (excluding sign)
n *integerFractional bits
raw_intintegerStored fixed-point integer to decode (provide this OR value)
valuenumberFloat value to encode (provide this OR raw_int)

embedcalc_ieee754_convert IEEE 754 Float Converter

Encode/decode IEEE 754 single (32-bit) or double (64-bit) precision: decimal <-> hex <-> binary, with sign/exponent/fraction breakdown and classification. Args: - format (32|64, default 32). - Provide exactly one of: decimal (number), hex (string like '0x3F800000'), bin (bit string). Returns (structured): { sign, exponent_raw, exponent_unbiased, fraction, hex, bin, decimal (string — may be 'NaN'/'Infinity'), class ('normal'|'subnormal'|'zero'|'infinity'|'nan') }. Examples: 1.0 float -> 0x3F800000; 0.1 double -> 0x3FB999999999999A (not exact!). Do not eyeball float bit patterns — call…

ParameterTypeDescription
binstringBinary bit pattern to decode (32 or 64 chars, spaces allowed)
decimalnumberDecimal value to encode (one of decimal/hex/bin)
formatnumber32 = float, 64 = double
hexstringHex bit pattern to decode, e.g. '0x3F800000'

embedcalc_number_base_convert Number Base Converter (32-bit)

Convert a number between decimal/hex/binary/octal with 32-bit two's complement semantics (negative decimals wrap; MSB-set values get a signed reading). Args: value (string) — decimal ('-1', '42'), hex ('0xFF'), binary ('0b1010'), or octal ('0o17'). Returns (structured): { unsigned, signed, hex, bin (4-bit groups), oct, ones_count }. Example: '-1' -> 0xFFFFFFFF, unsigned 4294967295, 32 ones.

ParameterTypeDescription
value *stringNumber in any base: decimal, 0x hex, 0b binary, 0o octal

embedcalc_endian_swap Endianness / Byte Swap Converter

Show a hex byte sequence in all endianness orderings: big (ABCD), little (DCBA), mid-little/byte-swapped halfwords (BADC), mid-big/halfword-swapped (CDAB). Args: hex (string) — e.g. '0x12345678' or 'DEADBEEF'; odd nibble counts get a leading zero. Returns (structured): { big, little, mid_little_badc, mid_big_cdab (null when < 4 bytes), bytes }. Example: 12345678 -> little 78563412, BADC 34127856, CDAB 56781234. Useful for Modbus register order and mixed-endian protocol debugging.

ParameterTypeDescription
hex *stringHex byte sequence (with or without 0x)

embedcalc_struct_layout C Struct Memory Layout Calculator

Compute the memory layout of a C struct/union — member offsets, inserted padding, bit-field packing, total size, and alignment — for a 32-bit MCU model (ARM Cortex-M style: pointers 4 bytes; double/int64 size 8 with 8-byte alignment as in the ARM EABI, matching embedcalc.com). Args: code (string) — C member declarations or a full struct, e.g. 'char a; int b;' or 'struct s { uint8_t a; uint32_t b; };'. Supports nested struct/union, arrays, pointers, and bit-fields. Returns (structured): { total_size, alignment, padding_bytes, rows: [{offset, size, type, name, kind, depth}] }. Nested blo…

ParameterTypeDescription
code *stringC struct member declarations (or full struct/union definition)

embedcalc_eseries_nearest E-Series Nearest Standard Value

Snap a computed resistor/capacitor/inductor value to the nearest purchasable E-series standard value (E6/E12/E24/E96) with the resulting error. Args: value (any unit — ohms, farads, henries), series ('E24' default; E96 for 1% resistors). Returns (structured): { standard, error_percent, series }. Example: 4.67e-6 H, E24 -> 4.7e-6 (+0.64%). LLMs frequently pick non-existent "standard" values — always snap computed values with this tool before choosing a part. To source a real, in-stock part for the standard value, follow up with embedcalc_find_component (type=resistor for ohms / capacitor…

ParameterTypeDescription
value *numberComputed value in base units (ohms/farads/henries)
seriesstringE-series (E24=5%, E96=1% resistors)

embedcalc_resistor_code Resistor Color Code / SMD Code Decoder

Decode a through-hole resistor color code (4 or 5 bands) or an SMD resistor marking into ohms + tolerance. Args (one of): - bands: array of 4 or 5 color names in order (black, brown, red, orange, yellow, green, blue, violet, grey, white, gold, silver, none). - smd_code: 3-digit ('472'=4.7k), 4-digit ('4702'=47k), R-notation ('4R7'=4.7Ω), or EIA-96 ('01C'=10k ±1%). Returns (structured): { ohms, tolerance_percent, min_ohms, max_ohms }. Example: ['brown','black','red','gold'] -> 1000 Ω ±5%. To find a real resistor to buy for the decoded value, follow up with embedcalc_find_component (t…

ParameterTypeDescription
bandsarrayColor band names in order (4 or 5 bands)
smd_codestringSMD marking, e.g. '472', '4R7', '01C'

embedcalc_crystal_load_caps Crystal Load Capacitor Calculator

Compute the two external load capacitors for a crystal from its specified load capacitance: CL = C/2 + Cstray -> C = 2·(CL − Cstray). Args: load_capacitance_pf (from crystal datasheet, e.g. 18), stray_pf (PCB+pin stray, typ. 3-5). Returns (structured): { cap_each_pf }. Example: CL=18pF, stray=5pF -> 26 pF each side. Wrong load caps = frequency pulling; don't guess. To source the load capacitor, follow up with embedcalc_find_component (type=capacitor, value=cap_each_pf × 1e-12 farads) — returns MPN + buy link.

ParameterTypeDescription
load_capacitance_pf *numberCrystal's specified CL in pF
stray_pfnumberStray capacitance (PCB traces + MCU pins) in pF, typ. 3-5

embedcalc_lm317 LM317 Resistor Calculator

LM317 adjustable regulator: Vout = Vref·(1 + R2/R1) + Iadj·R2. Compute R2 for a target Vout, or Vout from R1/R2. Args: r1_ohm (default 240), and exactly one of target_vout (-> solves R2) or r2_ohm (-> computes Vout). vref default 1.25 V, iadj_ua default 50 µA (datasheet typical). Returns (structured): { vout, r1_ohm, r2_ohm }. Example: target 5.0 V, R1=240, Iadj=0 -> R2=720 Ω. Snap R2 with embedcalc_eseries_nearest afterwards.

ParameterTypeDescription
iadj_uanumberAdjust pin current in µA (50 typ)
r1_ohmnumberR1 (Vref across it), datasheet recommends 240 Ω
r2_ohmnumberR2 value (computes Vout)
target_voutnumberDesired output voltage (solves R2)
vrefnumberReference voltage (1.25 V typ)

embedcalc_attenuator_pad Resistive Attenuator Pad (T / Pi)

Design T-pad and Pi-pad resistive attenuators for a given attenuation and system impedance. Args: attenuation_db, impedance_ohm (default 50). Returns (structured): { t_series_ohm, t_shunt_ohm, pi_shunt_ohm, pi_series_ohm }. Example: 3 dB @ 50 Ω -> T: 8.55 Ω series ×2 + 141.9 Ω shunt; Pi: 292.4 Ω shunt ×2 + 17.61 Ω series. Snap values with embedcalc_eseries_nearest.

ParameterTypeDescription
attenuation_db *numberAttenuation in dB
impedance_ohmnumberSystem impedance (50/75 Ω)

embedcalc_junction_temp Junction Temperature / Max Power

Thermal check: Tj = Ta + P·θJA, and max dissipable power for a Tj limit. Args: ambient_c, power_w, theta_ja (°C/W from datasheet), tj_max_c (default 150). Returns (structured): { tj_c, p_max_w, margin_c, ok }. Example: Ta=25, P=2W, θJA=50 -> Tj=125°C, Pmax=2.5W @ Tj_max 150.

ParameterTypeDescription
ambient_c *numberAmbient temperature in °C
power_w *numberDissipated power in W
theta_ja *numberJunction-to-ambient thermal resistance °C/W
tj_max_cnumberMaximum junction temperature rating in °C

embedcalc_microstrip_impedance Microstrip Impedance (IPC-2141)

Surface microstrip characteristic impedance: Z0 = (87/√(εr+1.41))·ln(5.98h/(0.8w+t)). Valid roughly for 0.1 < w/h < 2.0 and εr < 15. Args (all in mm): trace_width_mm, dielectric_height_mm, trace_thickness_mm (1oz ≈ 0.035), er (FR-4 ≈ 4.2-4.6). Returns (structured): { z0_ohm }. Example: w=3.0, h=1.6, t=0.035, εr=4.5 -> ≈49 Ω.

ParameterTypeDescription
dielectric_height_mm *numberDielectric height h in mm
trace_width_mm *numberTrace width w in mm
ernumberDielectric constant (FR-4 ≈ 4.5)
trace_thickness_mmnumberCopper thickness t in mm (1 oz = 0.035)

embedcalc_pcb_trace_width PCB Trace Width for Current (IPC-2221)

Minimum trace width to carry a current with a given temperature rise, per IPC-2221 (I = k·ΔT^0.44·A^0.725; k=0.048 external / 0.024 internal). Args: current_a, temp_rise_c (default 10), copper_oz (default 1), layer ('external'|'internal'). Returns (structured): { width_mil, width_mm, cross_section_sq_mil }. Example: 1 A, 10 °C rise, 1 oz external -> ≈11.8 mil (0.30 mm). Internal layers need ~2x the width. Do not guess trace widths — this curve is not linear.

ParameterTypeDescription
current_a *numberContinuous current in amps
copper_oznumberCopper weight in oz (1 oz = 35 µm)
layerstringTrace layer
temp_rise_cnumberAllowed temperature rise in °C (typ. 10)

embedcalc_awg_wire AWG Wire Gauge & Voltage Drop

AWG wire properties (ASTM B258) and round-trip voltage drop for a copper pair: diameter, area, loop resistance (2× length, go & return), drop %, and a PASS/WARNING/FAIL verdict (<3% / 3-5% / >5%). Args: awg (e.g. 20), supply_v, current_a, length_m (one-way), temp_c (default 20). Returns (structured): { diameter_mm, area_mm2, loop_resistance_ohm, voltage_drop_v, drop_percent, verdict }. Example: AWG20, 5 V, 2 A, 1 m -> 0.067 Ω loop, 2.7% drop, PASS.

ParameterTypeDescription
awg *numberWire gauge AWG number
current_a *numberLoad current in A
length_m *numberOne-way cable length in m (loop = 2×)
supply_v *numberSupply voltage in V
temp_cnumberConductor temperature in °C

embedcalc_ne555 NE555 Timer Calculator

NE555 timing. Astable: f = 1/(0.693·(Ra+2Rb)·C), duty = (Ra+Rb)/(Ra+2Rb) (always >50%). Monostable: t = 1.1·Ra·C. Args: mode ('astable'|'monostable'), ra_ohm, rb_ohm (astable only), c_farad (e.g. 10e-6). Returns (structured): astable -> { freq_hz, duty_percent, t_high_s, t_low_s }; monostable -> { pulse_s }. Example: astable 1k/10k/10µF -> 6.87 Hz, 52.4%.

ParameterTypeDescription
c_farad *numberTiming capacitor in farads (10µF = 10e-6)
mode *stringOscillator or one-shot
ra_ohm *numberRa in ohms
rb_ohmnumberRb in ohms (astable only)

embedcalc_dcdc_converter Buck / Boost / Buck-Boost Converter Calculator

DC-DC converter design (CCM): duty cycle, minimum inductance, minimum output capacitance, input current, and peak switch current for buck, boost, or inverting buck-boost. Args: topology ('buck'|'boost'|'buckboost'), vin, vout, iout_a, freq_khz (default 100), ripple_current_pct (of Iout, default 30), ripple_voltage_mv (default 50). Returns (structured): { duty_percent, l_min_uh, c_min_uf, iin_a, i_peak_a }. Example: buck 12->5 V, 1 A, 100 kHz -> D=41.7%, L≥97.2 µH, C≥7.5 µF. Snap L/C with embedcalc_eseries_nearest.

ParameterTypeDescription
iout_a *numberOutput current A
topology *stringConverter topology (buckboost = inverting)
vin *numberInput voltage V
vout *numberOutput voltage V (magnitude for inverting)
freq_khznumberSwitching frequency kHz
ripple_current_pctnumberInductor ripple current as % of Iout
ripple_voltage_mvnumberAllowed output ripple voltage mV

embedcalc_op_amp Op-Amp Gain & Bandwidth

Ideal op-amp closed-loop gain and resulting -3 dB bandwidth for inverting or non-inverting configs. Inverting: Av = -Rf/Rin. Non-inverting: Av = 1 + Rf/Rin. Noise gain = 1 + Rf/Rin (both). Bandwidth = GBW / noise_gain. Args: config ('inverting'|'noninverting'), rin_ohm, exactly one of rf_ohm or target_gain (magnitude), gbw_hz (optional -> bandwidth). Returns (structured): { gain_vv (signed), gain_db, noise_gain, rf_ohm, bandwidth_hz (null if no gbw) }. Example: non-inverting Rf=90k, Rin=10k -> +10 V/V, 20 dB; GBW 1 MHz -> 100 kHz. Snap Rf with embedcalc_eseries_nearest.

ParameterTypeDescription
config *stringAmplifier configuration
rin_ohm *numberInput resistor (inverting) or ground resistor Rg (non-inverting)
gbw_hznumberGain-bandwidth product in Hz (compute bandwidth)
rf_ohmnumberFeedback resistor (compute gain)
target_gainnumberDesired gain magnitude (solve Rf)

embedcalc_rc_filter First-Order RC Filter Cutoff

First-order RC low-pass or high-pass cutoff frequency: fc = 1/(2*pi*R*C), tau = R*C. LP and HP share the cutoff formula (response shape differs). Args: type ('lowpass'|'highpass'), and exactly two of { r_ohm, c_farad, fc_hz } -> solves the third. Returns (structured): { fc_hz, r_ohm, c_farad, tau_s }. Example: R=10k, C=1uF -> fc 15.92 Hz. Common for ADC anti-aliasing / debounce. Snap the computed part with embedcalc_eseries_nearest.

ParameterTypeDescription
type *stringFilter response type
c_faradnumberCapacitor in farads (100nF = 100e-9)
fc_hznumberCutoff frequency in Hz
r_ohmnumberResistor in ohms

embedcalc_bjt_bias BJT Voltage-Divider Bias Point

DC operating point of an NPN voltage-divider (four-resistor) bias network, including base-current loading. Vth = Vcc*R2/(R1+R2), Rth = R1||R2, Ib = (Vth-Vbe)/(Rth+(b+1)*Re), Ic = b*Ib, Vce = Vcc - Ic*Rc - Ie*Re. Region: cutoff / active / saturation (Vce <= 0.2 V). Args: vcc_v, r1_ohm (top, base-to-Vcc), r2_ohm (bottom, base-to-GND), rc_ohm, re_ohm (default 0), beta (default 100), vbe_v (default 0.7). Returns (structured): { ib_a, ic_a, ie_a, vb_v, ve_v, vc_v, vce_v, region }. Example: Vcc=12, R1=47k, R2=10k, Rc=1k, Re=220, b=100 -> Ic 4.61 mA, Vce 6.36 V, active.

ParameterTypeDescription
r1_ohm *numberUpper divider resistor (base to Vcc)
r2_ohm *numberLower divider resistor (base to GND)
rc_ohm *numberCollector resistor in ohms
vcc_v *numberSupply voltage Vcc in V
betanumberDC current gain hFE
re_ohmnumberEmitter resistor in ohms
vbe_vnumberBase-emitter drop in V

embedcalc_mosfet_switch MOSFET Low-Side Switch Losses

Conduction loss and gate-drive requirements for a MOSFET used as a low-side switch. Conduction + gate-drive ONLY — switching loss (needs drain voltage and rise/fall times) is NOT included. P_cond = Id^2 * Rds_on * duty. Gate avg current = Qg * fsw. Gate power = Qg * Vdrive * fsw. Tj = Ta + P_cond * theta_JA. Args: id_a, rds_on_ohm, duty (0-1, default 1); optional qg_c (coulombs), fsw_hz, vdrive_v, theta_ja, ambient_c, tj_max_c (default 150). Returns (structured): { p_conduction_w, gate_drive_avg_a, gate_drive_power_w, tj_c, margin_c, ok } (optional fields null if inputs omitted). Example: I…

ParameterTypeDescription
id_a *numberDrain (load) current in A
rds_on_ohm *numberOn-resistance Rds(on) in ohms
ambient_cnumberAmbient temperature in °C
dutynumberConduction duty cycle 0-1
fsw_hznumberSwitching frequency in Hz
qg_cnumberTotal gate charge in coulombs (20nC = 20e-9)
theta_janumberJunction-to-ambient thermal resistance °C/W
tj_max_cnumberMax junction temperature rating in °C
vdrive_vnumberGate drive voltage in V

embedcalc_zener_reg Zener Shunt Regulator

Series resistor and power dissipation for a Zener shunt regulator. Is = (Vin-Vz)/Rs, Iz = Is - Il, Pz = Vz*Iz, Prs = (Vin-Vz)*Is. Args: vin_v, vz_v, il_a (load current, default 0), exactly one of rs_ohm (compute Iz) or iz_min_a (solve Rs), pz_max_w (optional Zener rating check). Returns (structured): { rs_ohm, is_a, iz_a, pz_w, prs_w, zener_ok (null if no pz_max) }. Example: Vin=12, Vz=5.1, Il=10mA, Rs=220 -> Iz 21.4 mA, Pz 0.109 W. Snap Rs with embedcalc_eseries_nearest.

ParameterTypeDescription
vin_v *numberInput voltage in V
vz_v *numberZener voltage in V
il_anumberLoad current in A
iz_min_anumberTarget minimum Zener current (solve Rs)
pz_max_wnumberZener power rating in W (sets zener_ok)
rs_ohmnumberSeries resistor (compute Iz)

embedcalc_find_component Find Real Component (MPN + buy link)

Find real, in-stock components matching an electrical value via parametric distributor search — returns manufacturer part numbers and buy links ONLY (no price or stock data, by design). Args: - type: resistor | capacitor | inductor | ldo | mosfet | bjt. - value (number): resistor: resistance in ohms; capacitor: capacitance in farads (e.g. 1e-7 = 100 nF); inductor: inductance in henries (e.g. 1e-5 = 10 µH); ldo: fixed output voltage in volts; mosfet: minimum Vds rating in volts (N-channel); bjt: minimum Vce rating in volts (NPN). - Optional filters: tolerance_pct (R/C/L: keep this tol…

ParameterTypeDescription
type *stringComponent type
value *numberPrimary value — meaning depends on type (ohms / farads / henries / volts)
max_rds_on_ohmnumberMaximum Rds(on) in ohms (mosfet)
max_resultsintegerMaximum parts to return
min_current_anumberMinimum current in amps (ldo output / mosfet Id / bjt Ic)
min_hfenumberMinimum hFE / current gain (bjt)
min_power_wnumberMinimum power rating in watts (resistor)
min_voltage_vnumberMinimum voltage rating in volts (capacitor)
tolerance_pctnumberMax tolerance in % (resistor/capacitor/inductor)

embedcalc_review_schematic Review Schematic

Reviews a schematic (in the standard schema) against deterministic embedded-board rules: decoupling, reset, I2C pull-ups, power, interface wiring and MCU-family requirements. For a schematic image or PDF, call embedcalc_get_extraction_guide first and follow its page-by-page procedure (embedcalc_check_transcription after each page); pass the netlist here only once that check returns ready=true. For a KiCad netlist or a PADS PCB file (+ BOM), pass the output of embedcalc_parse_kicad / embedcalc_parse_pads with mcu.family added — preferred over images. Returns { violations[], checked[], skipp…

ParameterTypeDescription
schematic *object

embedcalc_parse_kicad Parse KiCad Netlist

Converts a KiCad "netlist export" file (.net, S-expression) into the standard schematic schema. Part types are inferred from the reference prefix (U→ic, C→cap, R→res …) and mcu.family is left empty. For family rules, add mcu.family (stm32f4|stm32f1|esp32|numicro) to the returned schema before passing it to embedcalc_review_schematic. Input: path (absolute path of the netlist file). Returns the standard schematic schema.

ParameterTypeDescription
path *stringPath of the KiCad netlist export file (.net)

embedcalc_parse_pads Parse PADS PCB + BOM

Converts a PADS PowerPCB ASCII file (.asc, first line "!PADS-POWERPCB…") into the standard schematic schema, using the board's real connectivity — no transcription from images. The .asc file has no component values, so pass the BOM (bomPath: .xlsx, legacy .xls, or a comma/tab-separated text BOM with a Reference/Designator column and a Value/Part/Comment column; NC/DNP values count as not fitted). Parts on the PCB but missing from the BOM are treated as not fitted and removed (listed in notFitted — check it: connectors or headers left out of a BOM show up there). Part types are inferred…

ParameterTypeDescription
path *stringAbsolute path of the PADS ASCII file (.asc)
bomPathstringAbsolute path of the BOM (.xlsx, .xls or .csv/.txt). Strongly recommended: without it values and fitted/not-fitted status are unknown

embedcalc_get_extraction_guide Get Image Extraction Guide

Returns the instructions and schema template for transcribing a schematic image or PDF into the standard schematic schema. First step of an image review.

embedcalc_check_transcription Check Schematic Transcription

Checks a schematic transcription in progress — call it after every page while transcribing an image or PDF (see embedcalc_get_extraction_guide), with the whole netlist so far. It does not review the design. Returns { ready, stats, problems[], unconnectedParts[], halfConnectedParts[], singlePinNets[], next }. problems = contradictions that must be fixed (a pin in two nets, a ref missing from parts). unconnectedParts / halfConnectedParts = parts whose connections were not transcribed yet. Call embedcalc_review_schematic only when ready is true.

ParameterTypeDescription
schematic *object

embedcalc_list_schematic_rules List Schematic Rules

Returns the schematic review rule catalogue. Pass family (stm32f4|stm32f1|esp32|numicro) to include that family's rules.

ParameterTypeDescription
familystringstm32f4 | stm32f1 | esp32 | numicro