Skip to content
Documentation sections

PWM Duty Cycle Calculator

POSThttps://rftools.io/api/py/v1/calculate

Slug pwm-duty-cycle. Calculate PWM duty cycle, frequency, average voltage, off-time, and RMS voltage from on-time and period parameters

Inputs

Send every one of these in inputs, in the units shown. Most are required: a call without one is refused (400) and costs nothing; one the calculator can do without takes the default shown. An input outside its range is still computed and flagged in the provenance.

Inputs of pwm-duty-cycle
NameUnitRangeDefaultDescription
onTimenumberμsat least 0.0015Duration the signal is high in each period
periodnumberμsat least 0.00110Total period of the PWM signal
supplyVoltagenumberVat least 0.13.3High-level voltage of the PWM signal
timerClocknumberMHz0.001 … 100016The clock the PWM timer counts, which sets the step of the on-time and the period
requiredBitsnumberbits1 … 328The duty resolution the design needs: 8 bits is 256 steps

Outputs

Returned in values, by key. A value that is unbounded or undefined is null.

Outputs of pwm-duty-cycle
FieldUnitDescription
dutyCycleheadline%Duty Cycle
frequencykHzFrequency
avgVoltageVAverage Voltage
offTimeμsOff Time
rmsVoltageVRMS Voltage
periodCountsnoneThe period in whole ticks of the timer clock (auto-reload + 1)
onCountsnoneThe compare value: the on-time in whole ticks
dutyActual%M over N
frequencyActualkHzThe timer clock over N
dutyResolution_bitsbitslog2 N: the steps one period offers the duty

Calling it

  • Calculate: one call, the request and response in full, and its errors.
  • Batch: this calculator with others, or a sweep, in one request.
  • Solve for a target: the value of one input that brings an output to a target.