Table of Contents
MPAINO K high-speed pulse output module
The K option module outputs the MCU's PWM waveform without filtering it into a DC signal. K provides six channels and K2 provides twelve. The selected module is assembled into the MPAINO product before shipment. Unlike the Y analog output module, this output is a 0–5V digital waveform; check that the receiving device accepts it.
Specifications
PWM0–PWM5 on the K2 image are terminal labels on the second K module. Its additional program channels are 6–11.
| Item | Description |
|---|---|
| Option codes | K, K2 |
| Outputs per module | Six PWM channels |
| Output levels | LOW 0V; HIGH 5V |
| Maximum output current | 30mA per channel |
| Maximum frequency | 1MHz |
| Resolution | 16 bit |
| Maximum configuration | Two K modules, twelve channels; Y and K outputs together no more than twelve channels |
K outputs use the MCU GPIO signal directly. Do not connect a load exceeding 30mA or an input requiring another voltage directly. Use a suitable external driver for a motor, solenoid, or similar load.
Options and channel numbering
| Configuration | K channels | PWM() / FDPWM() channel | analogWrite() channel | GPIO number |
|---|---|---|---|---|
| K | 6 | 0–5 | 20–25 | D130–D135 |
| K2 | 12 | 0–11 | 20–31 | D130–D141 |
| YK / Y2K | 6 | 0–5 | 20–25 | D130–D135 |
These are three numbering schemes for the same K outputs with different functions. analogWrite(20, 128) addresses the first K output; analogWrite(0, 128) addresses the first Y analog output. PWM(0, …) again addresses the first K output. One K and one or two Y modules can be ordered together, but K2 cannot be combined with Y. Match Arduino IDE's High-Speed Pulse Output Module and Analog Output Module options to the shipped configuration.
Shared Timers
| Configuration | K channels | Internal Arduino PWM pins | Shared Timer |
|---|---|---|---|
| K alone | 0–2 | D11, D12, D13 | Timer1 |
| K alone | 3–5 | D46, D45, D44 | Timer5 |
| Additional K2 | 6–8 | D5, D2, D3 | Timer3 |
| Additional K2 | 9–11 | D6, D7, D8 | Timer4 |
| YK / Y2K | 0–2 | D5, D2, D3 | Timer3 |
| YK / Y2K | 3–5 | D6, D7, D8 | Timer4 |
Three channels on one Timer can have different duty cycles, but share its frequency. The internal PWM pins change with the Y/K combination; match the program's logical channels to the product's shipped configuration.
Wiring and first measurement
- Disconnect power and identify the PWM terminal and the GND in its terminal group.
- Connect the receiving device's 0–5V PWM input and common GND according to the product's wiring diagram.
- Do not feed external power into a PWM output or attach an overcurrent load directly.
- Check the waveform frequency and duty with suitable test equipment before connecting the process load.
Example 1: Arduino analogWrite()
The first output of a K-only configuration receives approximately 50% duty. K's analogWrite() uses values 0–255, unlike Y's output range.
const uint8_t pulseChannel = 20; // analogWrite number of the first K output void setup() { } void loop() { analogWrite(pulseChannel, 128); // Output PWM at about 50% duty delay(500); }
Example 2: frequency and duty
K-only CH0 and CH1 share Timer1. Both run at 1kHz, with different duties.
void setup() { PWM_RESET(); // Reset K-output PWM Timer state FDPWM(0, 1000, 25.0F); // K CH0: 1kHz, 25% duty FDPWM(1, 1000, 75.0F); // K CH1: 1kHz, 75% duty } void loop() { }
PWM_RESET() can reset other PWM outputs using the same Timers. Run it only when the connected load is in a safe state.
Example 3: a fixed pulse count
This sends 100 pulses at 1kHz and 50% duty on K CH0. NPWM() must be called repeatedly until output completes, so there is no delay() in loop().
void setup() { PWM_RESET(); // Reset PWM state before starting the pulse train NPWM_BEGIN(0, 1000, 50.0F, 100); // Prepare 100 pulses on CH0 } void loop() { NPWM(0); // Advance and finish the prepared pulse train }
Troubleshooting
| Symptom | Check |
|---|---|
| No waveform | Check the K module and board option, PWM/GND terminals, and the channel number expected by the chosen function. |
| Unexpected frequency | Check whether another channel in the same Timer group changed the frequency. |
| Mixed Y/K product differs from K-only wiring | The internal PWM pin mapping changes with the Y/K combination. Check the shipped configuration and module terminal labels. |
| Fixed pulse train never finishes | Call NPWM() repeatedly on the same channel after NPWM_BEGIN(); avoid delays in the loop. |


