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.
| Name | Unit | Range | Default | Description |
|---|---|---|---|---|
| onTimenumber | μs | at least 0.001 | 5 | Duration the signal is high in each period |
| periodnumber | μs | at least 0.001 | 10 | Total period of the PWM signal |
| supplyVoltagenumber | V | at least 0.1 | 3.3 | High-level voltage of the PWM signal |
| timerClocknumber | MHz | 0.001 … 1000 | 16 | The clock the PWM timer counts, which sets the step of the on-time and the period |
| requiredBitsnumber | bits | 1 … 32 | 8 | The 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.
| Field | Unit | Description |
|---|---|---|
| dutyCycleheadline | % | Duty Cycle |
| frequency | kHz | Frequency |
| avgVoltage | V | Average Voltage |
| offTime | μs | Off Time |
| rmsVoltage | V | RMS Voltage |
| periodCounts | none | The period in whole ticks of the timer clock (auto-reload + 1) |
| onCounts | none | The compare value: the on-time in whole ticks |
| dutyActual | % | M over N |
| frequencyActual | kHz | The timer clock over N |
| dutyResolution_bits | bits | log2 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.