Maths is cool
Re: Maths is cool
Thanks for your reply...
I think what I am trying to get across is how can I use Pico to display / indicate the "effective" voltage applied onto the component when it's being controlled by a negative PWM...
When one analyse a positive PWM signal, the software can easily be used to show the DC Average or RMS voltages or whatever you want to look at as the software can use the time the voltage is "high" for the calculation. i'm not sure how to view that info for a negative PWM.
Referring to the screen shot you attached (on the awesome Pico 7 interface), I can calculate that the "effective" voltage "felt" by the component would be 16.44% of the maximum available voltage as this is the time the voltage is in the low state, its probably a very theoretical value, but I think it's quite accurate as the DVOM measured close to that value (around 2.2V  2.4V).
I am trying to find a way to show technicians that on a negative PWM the component is "on" when the voltage is low and also how much that voltage is that the component experiences, in an attempt to get them to understand +PWM vs. PWM control easier.
Thanks again for the input

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
Just reading through "I think what I am trying to get across is 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 believe adding an additional channel will help here.
Whilst we can add numerous measurements to the PWM signal, this refers to the signal itself and not the total voltage across the component with current flowing
As we know, PWM is about controlling the current flow/characteristics and we can see in your capture how this is achieved using Negative PWM
To find the effective voltage applied to the component when its being controlled, (i.e. with current flowing) if we add a channel to the supply side of the component as well as measuring the PWM of the return voltage we should have near battery voltage when current is flowing. (Assuming no voltage drop across the power supply and ground paths)
I will try and capture such an event later today if time allows to demonstrate what I think will help
Take care.....Steve

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
Referring back to “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
Channel B below is the Negative PWM control of the VCV
Channel C is the power supply to the VCV
Channel D is the current flow though the VCV (Resistance 3.3 Ohms)
I have added the negative duty cycle math channel to Channel B Duty(B) approx. 41%
I have also added the math channel CB with subtracts the negative PWM from the supply voltage to reveal the voltage differential across the VCV and where there is a differential, there will be current flow (assuming the load (VCV) is serviceable
If you were to measure this voltage with a multimeter; the frequency of the PWM is changing at approx. 143 times per second (143 Hz) and so depending on the sample rate of the meter, I am not sure what value will be displayed!
I have tested 2 meters across this VCV, one displays 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 meters) 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
Thanks to Martyn here once again for his invaluable input, to graph the Average of the PWM we can use (integral(B))/T where we obtain approx. 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% pretrigger, 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 of 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 (CB)/3.3 (above) which 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 it clearly demonstrates how theory and practice differ as we are not accounting for the impedance of the VCV circuit, PCM control and 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 someway to removing the confusion surrounding the effective voltage across the component
Take care……Steve
Re: Maths is cool
Thanks a mil for this info... I'll play a bit with it and try it on different systems when we are back at work. It is just amazing what one can achieve with the Pico, if you know what to do .
Thanks again for all the input, research and effort that went into these replies.
Stay safe!
Gerhard

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
Most certainly this is possible if we know the circuit we are measuring, capture the voltage & current flow (under load) and use Ohms Law to calculate resistance
Below is a typical example looking at starter motor voltage/current from the first Maths is Cool post here
Such resistance measurements are fine where the circuit is complete and both voltage and current are present under load. But what about measuring the resistance of a component removed from a circuit?
This can be achieved by creating your own voltage divider circuit in conjunction with PicoScope
In the example below I have used a 10 kohm panel mount resister (rated at 25 W) and a 12 V power supply (13.81 V to be precise)
Channel A is measuring the supply voltage with reference to ground before the 10 kohm, 25Watt resister (Supply)
Channel B is measuring the voltage across our unknown resister “R?” (V2)
Using our knowledge of resisters in series (10 kohm and R?) we bear in mind they have the same current flow, but the voltage divides.
Equally as important; The sum of all partial voltages (V1 & V2) is equal to the total voltage (Supply)
Utilizing math channels, we can now work out the missing values V1 and R?
In the above capture, a 15ohm resister was placed between the signal and ground wires of the test lead connected to channel B. Using PicoScope, this 15ohm resister was correctly measured and identified so confirming it is possible to measure and graph component resistance when removed from the circuit
Below we have replaced the 15ohm resister above with a 2200ohm resister and correctly identify this value using math channels
Again, below we replace the 2200ohm resister above with a 120ohm resister.
Below the 120ohm resister above is replaced with a 0.1ohm resister
Whilst the above examples perform exceptionally well with the resisters used, there is a trade off as the chosen component resistance (R?) increases (using this style of voltage divider circuit)
The method described above will be OK for measuring component resistance up to approx. 50 kohm, thereafter, the accuracy of the measurement will be affected due to the impedance of the scope in parallel with our voltage divider circuit.
We could overcome the accuracy concern using a math channel to plot V2/V1 whilst measuring known resister values from 0, 1K, 10K, 100K & 1M (ohm) and then create a custom probe to reflect these values. This will most certainly return accurate values at these chosen resister values but the accuracy between 100K & 1M would be compromised.
All the above concerns however have been removed for users of the 4225A & 4425A scopes as the math’s, accuracy & scaling at all resistance levels are taken care of using the intelligent Resistance Lead here
The creation of a resistance lead for your scope could be simplified using a project box housing a 10 kohm resister with 4 mm banana inputs in order to ease connectivity for the end user. However, be aware that current will be required to flow through the voltage divider circuit in order to calculate resistance (R?) and where there is current flow, we must consider the power rating (wattage) of the resister.
Power = I * V or V²/R
Consider a closed circuit at R? (Zero resistance)
13.81 V / 10,000 ohm = 0.001381 A (1 mA)
Power = 13.81 V x 0.001381 A = 0.01907161 Watt (19 mW)
Or,
Power = 13.81 x 13.81 / 10,000 = 0.01907161 Watt (19 mW)
Using a wire wound panel mount resister rated at 25 W is fine (overkill) but the temptation to use a lighter and cheaper resister will be hard to resist, however, power handling will be the compromise.
Likewise, using a smaller resister than 10 kohm could be an option but if you half the resistance you double the current!
For example, using a 5 kohm resister:
Consider a closed circuit at R? (Zero resistance)
13.81 V / 5,000 ohm = 0.002762 A (2 mA)
Power = 13.81 V x 0.002762 A = 0.03814322 Watt (38 mW)
Or,
Power = V²/R=(13.81²)/5000 = 0.03814322 Watt (38 mW)
Finally, be aware that an open circuit (infinite resistance) at R? throws a curved ball at the math channel as there will be miniscule current flowing through the voltage divider circuit!
Below, the math channel range has been amended to show 100 kohm but in theory this would be infinite when R? is open circuit
I hope the above helps to demonstrate "graphing resistance" with your scope but I also hope it highlights the considerable pitfalls and challenges which are all taken care of with the new 4225A & 4425A in conjunction with the Resistance Lead
Take care…..Steve

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
The principle of EC is something we must grasp given this is the same technology that will be powering the vehicles of the future (Hybrid/Electric Vehicle ((EV)) via 3 Phase Motors)
Long story short, we have a 3.0 litre V6 Gasoline Audi SQ5 with engine code CWGD
The fuel pump (G6) fails to deliver adequate fuel pressure.
N.B. The fuel pump (G6) is integrated with the fuel sender assemblies in a single fuel delivery unit (GX1) immersed inside the fuel tank. Control of the fuel pump is via an external Fuel Pump Control Unit (J538) where conversion from DC to 3 phase AC is implemented
To quote Ben Martins “Pressure is generated by the opposition to flow” and so bear in mind our fuel pump is required to generate sufficient flow of fuel from the tank to the engine under all load conditions
The image below reveals how PicoScope 4823 was connected to simultaneously capture the 3phase voltage and current to the offending fuel pump
So why such an elaborate control system for a fuel pump?
In a nutshell, performance, finite control, reliability and durability are the collective answers as such motors are virtually wear free other than support bearings.
Thanks to the absence of motor brushes, there is no contact between moving motor parts which eliminates, friction, drag, & arcing. (Such motors are referred to as BLDC = Brushless DC)
For a typical brush type motor wear pattern take a look at the images contained here viewtopic.php?p=100434#p100434 and here https://www.picoauto.com/library/cases ... powerloss
Rather than try to explain how the EC motor functions could you take a look at the superb animation here https://www.youtube.com/watch?v=bCEiOnuODac
As you can see, in order for the rotor to spin, we need to generate a rotating magnetic field about the stator for the rotor to “chase”. If we then attach the rotor to a pumping element, we can capitalize on the rotation and convert this motion into a physical pressure.
The same principle applies whatever your application, be that an EC Motor connected to a transmission, road wheel or output shaft
Below we zoom in to focus upon the behavior of the voltage and current during operation of the pump/motor. Notice how the voltage appears cut off at 0 V for channels A, B & C yet the current is reversed during this time period!
Our DC voltage captures do not tell the full story as we are measuring with reference to chassis ground (which is correct). In reality the voltage here is reversed in order to reverse the current flow we have captured in the phase windings on channels D, E & F.
Should you wish to capture the reversed voltage, then a differential probe ( https://www.picoauto.com/products/elect ... idvehicle ) would be required to measure across the phases of interest see especially for High Voltage applications which also requires the relevant training and certification for live working.
With all that said, measuring “Current flow” reveals the full story in a nonintrusive fashion and provides evidence of “work done”
Measuring current reveals:
• Additional operational characteristics of the motor (within the waveform)
• The integrity of the magnetic field/coil windings
• The operation of the motor/pump
• The control circuit functionality
• Motor frequency/speed
• Motor load conditions
To digress for just a moment, the influence of magnetic fields upon voltage and current are well documented. One of the best examples I have found is the disruption we capture when measuring current flow into a port injector. Below we capture the initial pintle movement (injector open) as it disrupts the magnetic field (and so current flow) about the coil windings and again in the induced voltage (Back EMF) on the return to is seat (Injector closed)
So how does this relate to our BLDC motor?
The waveform below indicates the momentary disruption during peak positive & negative current events where the rotor poles align with the stator poles at “peak north” and “peak south” respectively
Even more interesting within the waveform above, look at the voltage on channel A and the grey rectangles placed about the start and nearend points of each positive phase. (All voltage phases have the same characteristic) This is the induced voltage created within the phase winding when the current is switched from on to off (Back EMF) and is used by the fuel pump controller to determine the position of the rotor (How cool is that?) No need for an additional resolver or hall effect position sensor in order to determine rotor position.
Knowing the position of the rotor is essential to determine the energise sequence of the stator windings, so creating a rotating magnetic field (EC) for the rotor to chase
Note: We cannot see the reversed induced voltage at the near end points of each voltage phase for the reasons mentioned above (See paragraph beneath image 2A). With that said, we can see a gap where this negative induced voltage would appear shortly before the commencement of the missing negative voltage phase
One further point before we move onto the maths, note the number or electrical cycles/rotations in relation to one mechanical rotation of the rotor/pump.
The multiplication factor between electrical degrees of rotation (cycles) and mechanical degrees of rotation requires knowledge of the number of poles about the rotor:
Multiplication factor = Number of rotor poles / 2
Therefore, our pump contains a 4pole rotor (1 pair of north & 1 pair of south poles)
Number of rotor poles 4 / 2 = 2.
2 is the multiplication factor between electrical cycles and mechanical degrees of rotation for a 4pole rotor.
In other words, for a 4pole rotor, we require 2 electrical cycles for the rotor to complete one revolution
If you don’t not know the rotor pole count you can use an optical pick up (https://www.picoauto.com/products/nvha ... sensorkit ) to capture one mechanical revolution of the motor assembly (where access permits) whilst simultaneously capturing current in one of the three phases
Count the number of electrical cycles between the output events of the optical pick up and multiply by 2 to find the pole count. The image below uses this technique to reveal a 30pole rotor from a different style 3 phase motor
Be aware that some rotors may not be linked directly to the mechanical output you are capturing with the optical pick due to reduction gears etc. This would most certainly return an erroneous rotor pole count
Returning now to the faulty fuel pump what can we diagnose from the original capture (Image 1)
Using the following math channel LowPass((abs(D)+abs(E)+abs(F))*0.333,50) we can determine the average current consumed by the fuel pump (incorporating all three current phases)
"LowPass" smooths out the AC ripple and gives you a moving average.
The "abs(D)+abs(E)+abs(F)" * 0.333 gives the average of the three rectified phases. (Current)
The “,50” describes the level of low pass filtering applied (50 Hz)
To calculate rotor/pump speed the math channel formula is 60*2*freq(D)/4
60 x 2 x Frequency of a current phase / Rotor pole count
60 converts Hz to RPM
Multiply by 2 because of the positive and negative events of the AC current waveform
Divide by 4 because our rotor has 4 poles
Note: Rotor/pump speed is dependent upon the frequency of the current and the rotor pole count.
• Increasing the frequency will increase the speed but reduce torque
• Increasing the rotor pole count will decrease speed but increase torque
Above we can see the fuel pump running at a fixed speed of 10,000 rpm and drawing an average current of 7.6 A
Lets now compare the waveform after pump replacement
Most certainly there is a difference, look at the pump speed & current draw up to 8 seconds, approx. 3200 rpm & 5.4 A (offload) Note how the frequency of the current (Channel D) between the time rulers has reduced to 109.1 Hz so resulting in a reduction in pump speed.
Now look at the pump speed and current when the pump is forced to deliver maximum pressure (on load) approx. 7787 rpm & 10.4 A
To summarize:
The new fuel pump pulls 5.4 A @ 3200 rpm to maintain sufficient fuel pressure during the offload stage (Less current & less speed for sufficient fuel pressure) The original pump pulled 7.6 A @ 10, 000 rpm for insufficient fuel pressure
Most certainly, measuring current reveals the “work done” and never is this more evident than during the pump “onload” test we have captured in image 8A
So, what is wrong with the old fuel pump?
The simple answer is nothing! Remember that pressure is generated by an opposition to flow and the fuel pump activity captured in image 7A is most certainly creating flow at 10,000 rpm, but where is the flow going? Take a look at the fuel pressure regulator diaphragm that is integrated into the fuel delivery unit (GX1)
The diaphragm inside the fuel pressure regulator is torn resulting in the majority of our fuel flow returning to tank rather than along the fuel lines to the engine bay
For more information on this style of fuel delivery system, try searching for the VAG Self Study Program SSP495
Many thanks to our Audi colleagues overseas for their invaluable input with this case study
I hope the information above is of some help, take care……Steve
Re: Maths is cool
I don't understand the formula 60/2*freq (b).
In my opinion is the good formula rpm=60*freq (b).
why is the /2?
period takes 207.8 ms ( 1 revolution)
1000ms/207.8 ms=4.81 revolutions per sec
4.81 revolutions per sec *60 sec =288.74 revolutions per minute

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
With reference to our first post viewtopic.php?p=96371#p96371
Cranking speed is calculated using the math channel 60/2*freq(B)
Channel B contains the current peaks due to cranking load placed upon the starter motor during the compression stroke. With this 4cylinder engine we have 2 compression strokes per engine revolution
The frequency of channel B can be seen below at approx. 9.6 Hz, however, this is for one cranking current peak only and we have 2 peaks per engine revolution hence the divide by 2
If we write the maths in order:
60/2*freq(B)
60 / 2 * 9.6 Hz = 288 rpm
I hope this helps clarify the above and thank you for the feedback
Take care……Steve

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
The formula states that dividing DPF differential pressure by MAF should result in a value below 0.2 if the DPF is not restricted
The formula uses serial data obtained during the road test with the DPF temperature stable > 450°C
For example:
MAF = 25 gm/sec
DPF differential pressure = 2 kPa
Therefore 2 / 25 = 0.08 and so DPF is OK
However, if DPF differential pressure was 6 kPa with MAF at 25 gm/sec then:
6 / 25 = 0.24 and so DPF is restricted.
Given we can calculate MAF using PicoScope, I wanted to test this theory with a couple of nonToyota 2.0 litre diesel engines.
There are a couple of variables to consider before we start condemning DPF’s:
1. I will be using a WPS pressure transducer inserted before the DPF and not across the DPF as with a differential pressure sensor.
2. The temperature of the DPF’s under test was not > 450 °C
3. I will be using a WPS to measure inlet manifold pressure
First, we have a BMW 320 D (2.0 Litre, 4Cylinder) where we apply the math channel LowPass(freq(A),50)*(2.0*0.8 )*(B+1)/2*1.223/60 in order to obtain airflow in grams per second using air mass at 1.223 gm/L as we have here viewtopic.php?p=99396#p99396
Engine Capacity (2.0 L) x VE (0.8 ) x RPM (Using crank signal Ch A) x MAP (Using WPS Ch B +1) / 2 intake strokes per crankshaft revolution = MAF in Litres per minute
1 litre of air = 1.223 gm @ sea level (15°C)
L/min x 1.223 gm/litre for air mass = gm/min
Air mass in gm/min / 60 = gm/sec
To break the math channel down:
We have RPM calculated using LowPass(freq(A),50)
This gives a “smoothed” rpm value and reduces the spikes from the crankshaft missing teeth
N.B. the crankshaft signal (Ch A) is hidden from view in the example waveform below
(2.0*0.8 ) 2.0 is for 2.0 litre engine and 0.8 is a typical Volumetric Efficiency value (VE) for such turbocharged diesel engines.
*(B+1) incorporates manifold pressure measured on channel B and we add 1 because MAF figures are calculated using absolute pressure. Here we are using a WPS to capture manifold “gauge” pressure and so we are required to add 1 bar to obtain absolute manifold pressure
/2*1.223/60 we divide by 2 to accommodate 2 x intake strokes per engine revolution a multiply by 1.223 to amend our airmass value and finally divide by 60 to obtain airmass in gm/sec
Now the formula to evaluate the breathing efficiency of the DPF requires exhaust differential pressure captured in kilo Pascals kPa. This is where one of our variables creeps in as we are going to measure exhaust back pressure using a WPS inserted into the pressure sensing hose before the DPF and not across the DPF
Channel D will be measuring exhaust back pressure in bar using a WPS and so to convert to kPa we are required to multiply channel D by 100
The formula is as follows D*100
Now to complete the entire formula which is DPF Differential pressure (kPa) / MAF (gm/sec) we use
(D*100)/(LowPass(freq(A),50)*(2.0*0.8 )*(B+1)/2*1.223/60)
Remember the theory states that we should obtain a value of less than 0.2 for an efficiently breathing DPF. The results below make for an interesting discussion!
As we can see, throughout the majority of the test we are below magic “0.2” value but do creep above 0.2 during WOT. (This may be due to the variables I discussed above)
Given the performance of the vehicle is fine, I am happy to accept the results above and agree there appears to be some logic to the theory of DPF back pressure / MAF = DPF breathing efficiency
Next is another 2.0 litre diesel (SEAT Alhambra engine code BRT) using the same configuration as the BMW above (WPS installed into the inlet manifold and before the DPF)
The SEAT Alhambra in question is the same SEAT discussed at length here viewtopic.php?p=100270#p100270
As you can see, applying the same formula DPF back pressure / MAF = DPF breathing efficiency we are predominantly above the magic 0.2 during acceleration, suggesting DPF breathing efficiency to be poor! This is where I have my doubts and once again, we must be conscious of the variables. The above vehicle performed well under WOT conditions
All in all, I wanted to share this theory as it appears to work well when simply grabbing data from a scan tool and carrying out the math’s.
i.e., using serial data, grab DPF differential pressure (kPa) and divide by MAF (gm/sec)
Here is an example below:
DPF Differential pressure 15.894 kPa / MAF 97.69 gm/sec = 0.163 (DPF = Good)
I hope this helps and please feel free to experiment; having a data list displaying differential pressure (and not back pressure) removes the main variable and so the scope may not be required. However, having the formulas above will help with graphing the breathing efficiency of the DPF over time
Take care……Steve

 Pico Staff Member
 Posts: 1332
 Joined: Sun Aug 25, 2013 7:22 am
Re: Maths is cool
It seems only right to link them here to as this is often the place to come to look for that magic formula
The first formula looks at 12 V graphing port injection duty cycle which can be seen here
viewtopic.php?p=102294#p102294
The formula to use in PS7 "posduty(sign(A10)*(100))" for a 12 V port injector on channel A
Next up are a number of math channels looking at Permanent Magnet Synchronous motors (PMSM) where the full story can be found here topic22767.html
Here we look at Synchronous speed using the math channel "120*Freq(C) / Number of magnetic poles" for High voltage phase current captured on channel C. In the example below we have 10 magnetic poles, therefore the math channel used was "120*Freq(C) / 10"
PMSM Rotor speed calculated from the road wheel frequency via the ABS sensor, requires knowledge of the number of ABS speed sensor pulses per revolution of the road wheel and the associated gear train ratios between the rotor and road wheel.
Below, the formula used to denote rotor speed was "(60/44*freq(A)/60)*9.756*60"
This formula applies to a vehicle with an ABS pulse count of 44 per revolution of the road wheel (captured on channel A) and a total transmission ratio of 9.756:1 (Amend accordingly to the vehicle under test)
See the magenta waveform below
PMSM Rotor speed via the rotor speed sensor requires knowledge of the rotor magnetic pole count / 2
Below, the formula used to denote rotor speed via the rotor speed sensor was 60/5*freq(H) for rotor speed sensor signal captured on channel H (refer to lime green math channel in Image 4)
Finally, to graph the phase shift between the positive duty of PMSM Phase voltage (Ref to high voltage negative) captured on channel A and Phase current captured on channel D the following math channel will help
"LowPass(Duty(((((atan(1/tan(pi*((posduty(A)50)/10000)))/pi)+((posduty(A)50)/10000))*((atan(1/tan(pi*(D/10000)))/pi)+(D/10000)))+0.25))/0.555555555,10)"
Below we graph the phase shift between phase motor winding voltage and current to denote the status of our Motor/ Generator
The above math channel just had to be posted here!
I hope this helps, take care.....Steve