Tutorial 13 of 15
RF, wiring harness and microcontroller calculators
Intermediate 12 min
Size antennas and radio links, design 50 Ω traces and matching networks, choose wire gauges, build a harness cut list from your schematic and get UART, timer and PWM settings right.
Ohmforge's Circuit calculators cover more than resistors and filters. Five tabs help with radio, wiring and firmware questions, and Instruments → Wiring harness… turns a schematic into a list of wires to cut. Every tab uses the same engine as the matching Ohmforge tools, so a result in the app equals the result on the tool page, in the API and over MCP.
Open the calculators with Instruments → Circuit calculators… and pick a tab. Results update as you type. If a value is out of range, the field is marked and the status line explains why.
RF basics
The RF basics tab has three tasks under Calculation.
- Link budget and path loss: enter the frequency, the distance, the transmit power, both antenna gains, cable losses, other losses and the receiver sensitivity. At 2400 MHz over 100 m with 20 dBm, 2 dBi antennas and 1 dB cable loss on each side, the free-space path loss is 80.05 dB, the receiver gets −58.05 dBm and the margin to a −90 dBm receiver is 31.95 dB. Maximum range with your fade margin tells you how far the link reaches in free space while keeping the Fade margin you want in reserve.
- Antenna lengths: enter the frequency, the End-effect factor (0.95 for thin wire) and the velocity factors. At 14.2 MHz a half-wave dipole is about 10.03 m long.
- VSWR, return loss and mismatch loss: choose what You know, for example VSWR 2, and read return loss (9.542 dB), the reflected power and the mismatch loss.
Free space is the best case. Indoors or behind trees, add losses under Other losses (dB).
PCB trace impedance
The PCB trace impedance tab calculates a Microstrip (outer layer over a plane) or a Stripline (centred between two planes). Choose Impedance of a given width to check a trace, or Width for a target impedance to design one. A 0.3 mm microstrip on 0.17 mm prepreg with εr 4.3 and 35 µm copper has Z0 = 50.16 Ω.
The Cross-checks table compares the result with an independent formula. The two should agree within a fraction of a percent. The IPC-2141 rule of thumb is shown for comparison only.
L-network match
The L-network match tab finds every two-part network that matches a load to the source impedance. With the default load of 200 − j100 Ω on 100 Ω at 500 MHz (the textbook example from Pozar), it lists two solutions. The first is a series L of 38.98 nH from the source and a shunt C of 922.8 fF across the load. The Smith chart shows each match path from the Load to the Match point in the centre. Prefer the solution with the lowest Nodal Q; it gives the widest band.
Wire gauge
The Wire gauge tab sizes a cable for an allowed voltage drop. Enter the Supply voltage (V), the Load current (A), the Cable length, one way (m) and the Allowed voltage drop (%). For 12 V, 20 A over 5 m and 3 % drop you need at least 9.579 mm²: 7 AWG or 10 mm². Set the Conductor temperature (°C) to the temperature the wire reaches in use for a conservative result.
The fuse value is guidance only. Ohmforge does not calculate how much current a wire may carry; check that in the wiring rules you follow and in the cable datasheet. Switch Task to AWG ↔ mm² table and conversion to convert sizes such as 2.5 mm² (closest to 13 AWG).
MCU timing
The MCU timing tab has five calculations.
- UART baud rate: an ATmega328P at 16 MHz with AVR USART, normal speed (U2X = 0) needs UBRR = 8 for 115200 baud and actually sends 111111.1 baud, −3.55 %. The Common baud rates table shows which rates are safe at your clock.
- Timer prescaler and period: 1 kHz from 16 MHz on a 16-bit timer works exactly with several prescalers. With Any 1 … 65536 (STM32 PSC register) the tab also shows the PSC and ARR values to program.
- PWM frequency and resolution shows TOP and the resolution per prescaler for fast or phase-correct PWM.
- ADC resolution and ENOB gives the LSB and the effective bits from a datasheet SINAD.
- RC reset or debounce time tells you when a capacitor charging through a resistor crosses the input threshold, and which capacitor gives the Delay you want.
Wiring harness
Choose Instruments → Wiring harness…. The Wire list has one wire per line: id, from, to, length, gauge and colour. Write the ends as part and pin, such as BT1.+ or F1.1. Ends without a dot, such as SP1, are splices that join wires.
When the schematic has parts, the list starts with one wire per connection between part pins. Under Build the wire list from this schematic you can set the length, gauge and colour for new wires and press Build from this schematic again. Ohmforge has no connector parts yet, so the wires run between the pins of the parts themselves. Measure the real lengths and enter them.
Set Strip and termination allowance per end (mm) and Slack and service loops (%); the Cut list adds both to each wire, and the Bill of materials by gauge and colour sums them up. With Check the harness against this schematic ticked, Ohmforge reports wires that join separate nets, nets that the harness splits and pins without a wire. Download the cut list (CSV) and Download the bill of materials (CSV) save the tables. The wire list is stored in the project when you close the dialog, and Undo removes the change.
Use the calculators from scripts
The same calculations are the tools ohmforge-rf-calculator, ohmforge-microstrip-impedance, ohmforge-impedance-matching, ohmforge-wire-gauge and ohmforge-mcu-timing. Call them through the JSON API or MCP on the Ohmforge site, as shown in Automate with the API and MCP. The wire gauge tool's harness mode accepts a pasted .ohmforge.json project for the continuity check.
Ready to try it?