# Maths is cool - part 14by Steve Smith

I want to refer back to a comment in the forum thread: “…how can I use Pico to display/indicate the "effective" voltage applied onto the component when it's being controlled by a negative PWM…”

I have been testing the Volume Control Valve (VCV) attached to a Bosch high-pressure diesel pump which is controlled via a negative PWM signal.

In the screenshot below, Channel B is the negative PWM control of the VCV,
Channel C is the power supply to the VCV and Channel D is the current flow through the VCV (resistance is 3.3 Ω).

I have added the negative duty cycle math channel to Channel B: Duty(-B), approximately 41%.

I have also added the math channel C-B, which subtracts the negative PWM from the supply voltage to reveal the voltage differential across the VCV.  Where there is a differential, there will be current flow (assuming that the load (VCV) is serviceable).

The frequency of the PWM is changing approximately 143 times per second (143 Hz), so If you were to measure this voltage with a multimeter I am not really sure what value will be displayed!

I have tested two multimeters across this VCV. One displayed 4.65 V DC (Fluke) the other exactly 5 V DC (Megger).
Just for fun, I then switched the meters to AC to obtain 8.08 V AC non-TRMS (Fluke) and 9.05 V AC TRMS (Megger).

Looking at the measurement values above (all for channel B Negative PWM) our DC Average is 9.739 V and True RMS 12.35 V. These values highlight the ability of the scope, in comparison to the multimeters, to capture peak to peak values and incorporate this data into the numerically displayed measurement value. The sample rate for this capture was 2MS/s!

Graphing average PWM

I want to thank Martyn here once again for his invaluable input. To graph the average of the PWM we can use (integral(B))/T where we obtain approximately 9.597 V (T = time in our math channel).

A tip here is to use a trigger on the rising edge of the PWM at 0% pre-trigger. This equation would trace a set value for the high part of the PWM cycle, and then slope down to the next rising edge. At this point in the math channel, where you meet the next rising edge, you will capture the average of the cycle (see image below).

Based on ohms law, I have added the math channel (C-B)/3.3 above. This demonstrates the theoretical current flow through the VCV, based on the effective voltage across this component (peak 4.408 A).

What I like about this math channel, is how clearly it demonstrates how theory and practice differ as we are not accounting for the impedance of the VCV circuit, the PCM control and the temperature. The math channel in this scenario divides the voltage by a fixed resistance value (3.3 ohms), hence the instantaneous current rise time and peak value (food for thought).

Graphing RMS PWM

Following on from graphing PWM above, we demonstrated how the math channel (integral(B))/T returns the Average of the PWM (Channel B).

How about graphing the RMS of the PWM signal of Channel B?
Here we use sqrt((integral(B*B)/T)) to graph the RMS where we obtain 12.32 V.

I hope this helps and goes some way to remove the confusion surrounding the effective voltage across the component.