What's new
What's new

OT: Reading PWM Values

CatMan

Hot Rolled
Joined
Apr 12, 2005
Location
Brandon, MS
Anybody in here deal with PWM signals?

I deal with a valve block that is controlled by an industrial computer. All the communication between the two is PWM values.

It sure would be nice to measure/read these PWM values so I can tell which one of the cables is giving me an issue.

Short of an oscilloscope, does anyone know of an option? Something handheld for field use would be ideal, but I'm open to something larger for shop use.
 
If you had a good channel to compare to, a simple *analog* voltmeter might give you enough information. But the
right way is an oscilloscope. Much easier to interpret what's going on that way. You can probably get one for not much
more an a simpson meter would cost these days .
 
A capacitor and resistor to discharge it. Set the RC time constant to about the PWM frequency. The PWM high will charge the cap while it is on, the resistor will discharge it continuously. The closer the voltage is to the PWM voltage the closer the signal is to 100%. A DVM will sort of do this by itself, maybe well enough for your need. But if it is high enough impedance it may not discharge fast enough and get stuck close to the max value.
 
The problem with any kind of circuit or meter that just averages out the pulses to give you a DC value to display is it will respond to noise just as readily as to the actual signal. I don't think any of the meter type devices will tell you if a cable transmitting these signals is good or bad. I have had to trouble shoot many circuits with PWM and other forms of digital signals and always reached for a scope, usually a $3000 to $10,000 scope. And no, I don't own such a scope myself but I do want/need one. You can get a good one used for a few hundred. Since you need to see the actual waveform for this type of work, I would not recommend a digital scope unless it has a bandwidth that is at least ten times the highest frequency you will need to observe. That's a bare minimum, even higher would be good.
 
The Picotech PicoScope 2000 series can be purchased for about $120, found easily via Google search. It utilizes a PC computer display. I've used one often, they are handy.
 
The OP asked for a scopeless solution, a properly design RC circuit will do fairly well in rejecting noise, because it is tuned for the right amount of charge in the right amount of time. It is not perfect, but it also doesn’t start with Tek.
 
The problem with any kind of circuit or meter that just averages out the pulses to give you a DC value to display is it will respond to noise just as readily as to the actual signal. I don't think any of the meter type devices will tell you if a cable transmitting these signals is good or bad. I have had to trouble shoot many circuits with PWM and other forms of digital signals and always reached for a scope, usually a $3000 to $10,000 scope. And no, I don't own such a scope myself but I do want/need one. You can get a good one used for a few hundred. Since you need to see the actual waveform for this type of work, I would not recommend a digital scope unless it has a bandwidth that is at least ten times the highest frequency you will need to observe. That's a bare minimum, even higher would be good.

ummmm.......

The USE of the PWM signal is SPECIFICALLY to get a particular analog value at the receiving end.

The PWM is put through a "reconstruction filter" that essentially acts like the R-C filter, although it may be a little more sophisticated, to end up with an average value. That average value IS the signal. So talking about all the details is nice, but the OP wants to see a reasonable version of the analog signal to determine what part is causing trouble.

It i fairly likely that the trouble is not a tiny error, but something fairly large.

I suspect that unless he is complaining about something under a 1% accuracy, he can determine the problems reasonably well with just an R-C filter set for a frequency below the "carrier", but above the rate at which the control signal is expected to change.
 
I know the OP asked for something other than a scope, but he also said he is trying to find bad cables. And he gave absolutely no hint of what frequency range these pulses are in. Hz? KHz? MHz? GHz? It could, just possibly make just a wee bit of difference. Or the Voltage level. Or the impedance of the line. Or how long the cables are. Absolutely none of this was stated.

And just how these PWM pulses are being read by the equipment at the destination end of the cable could also make another wee bit of a difference. Voltage averaging? Actual detection of the timing between the rising and falling edges? Or what?

A bad cable could manifest itself in a variety of ways. He is apparently not dealing with a simple open or dead short which could be found with a $10 Ohm meter. He may have impedance incontinuities due to kinks or other physical damage to the cables. Or bad connectors. Or bad grounds. Or ??? Believe me, I have fought and found them all. So, I suspect that a scope may be the only way to actually find the problem(s) he is fighting.

Or just get some known good cables and try substituting, one at a time. Age old troubleshooting technique.

SBD!
 
A digital scope will make short work of checking. Analog scopes, welll,,, they can work, but you will do a lot more work yourself.

Before holding out for the best, I'd try to measure things with what you have/can get. If that is not good enough, OK.

If it IS good enough, and you can show the problem, plus maybe make some educated guesses and test them, you will be done soon.
 
Having used both digital and analog scopes for over 55 years I must disagree with the ease or use. Analog scopes, at least a decent one, are far easier to use and will provide displays that are far easier to interpert than any digital one that I have ever seen. When using an analog scope the only thing you really need to worry about is having sufficient bandwidth to show the signal/problem you are dealing with. But with digital scopes, beyond bandwidth concerns which are still 100% present, you must always be thinking about what the sampling frequency will be doing to the signal you are observing. And this is of prime importance when you are observing a digital signal due to alias effects. This is why I recommended that if you are going to try to diagnose this problem with a PWM signal with a digital scope, you should use a digital scope with a sample rate at least 10X the highest frequency IN the PWM signal being checked.

And consider this; I did not say 10X the base frequency of the PWM signal, but the HIGHEST frequency PRESENT in that PWM signal. For example, lets consider a PWM signal with a base frequency of 100 KHz. And it's Width is Modulated from 1% to 99% of the pulse width. The pulse width at 50% modulation level is 1/2 of that 100 KHz rate or 5 us. But at 1% modulation that pulse width is only 1/100th of the basic frequency or a pulse width of 100 ns. That's 100 nano seconds. A digital scope that is sampling at 1 MHz will have a sample window of 1 us (a bit less actually because adjacent samples can not overlap). That 100 ns pulse will be captured only around 50% of the time so about half of them will be completely missed. AND, even when that 100 ns pulse does occur in that 1 us sample window, it will not last for the full duration of the sample window. So it will not be captured at it's full Voltage level. And, worse yet, the actual Voltage level that is captured may vary due to exactly when in that capture window it occurs. Pulses that are earlier in the window will have more time to decay before the window closes so they may show up as smaller samples than ones that occur closer to when the window closes. So, if you want to faithfully capture a 100 Khz, PWM signal with a digital scope, you should have a digital scope with a sampling frequency that is at least 100 times the base frequency or around 10 MHz. An even higher sampling frequency would be highly desirable.

And when you are looking at the signal displayed on a digital scope you need to keep all possible types of "digital" effects in mind. It is a lot easier to think, "my analog scope rolls off above 25 MHz so if I am seeing a 30 MHz signal displayed, it is probably about twice as strong as what my scope is showing me. Analog scopes do not have all those digital problems, just a smooth roll off which the digital scope will also have because the input stage of a digital scope is also an ANALOG circuit.



A digital scope will make short work of checking. Analog scopes, welll,,, they can work, but you will do a lot more work yourself.

Before holding out for the best, I'd try to measure things with what you have/can get. If that is not good enough, OK.

If it IS good enough, and you can show the problem, plus maybe make some educated guesses and test them, you will be done soon.
 
Those issues are generally NOT an issue unless you misapply the scope. I like analog scopes, and meters. I recognize what they are good for and what they are not good for. Both analog and digital scopes can lie to you if you are not careful.

However, the digital scope has features that are made for the purpose here.

You will generally have a range or trigger options that allow you to find "runt pulses" and all manner of other things that pass by on analog scopes so fast that you may not even be sure you saw them.

Pulses less than a minimum, pulses more than a maximum, pulses over or under a limit, you can usually store a long sequence and look back from a trigger event, or forward from it.

And, you can get the DC level for the signal, which is of course, the point of PWM in the first place.

It's pretty ideal. And to top it all off, they are usually small, and often do not have their chassis as the signal common, so they can be used for signals which are not ground-referenced. My scopemeter has a big screen, and can look at a grounded signal and a floating gate drive at the same time. The gate drive may be superimposed on a 350V pulse, yet it can be seen clearly at 1V/div scaling. Such things are not common on analog scopes, despite their value for observing glitches of some kinds.

The wide variety of trigger modes usually will allow a digital scope to trigger specifically on the condition you want to see, relieving you from watching like a hawk to see the issue, and then trying to find that odd transient again. The trace can be stored to be used in documentation, etc.

There are many reasons to like even a simple digital scope, if it is a good one with the bandwidth needed.
 
Anybody in here deal with PWM signals?
I deal with a valve block that is controlled by an industrial computer. All the communication between the two is PWM values.
It sure would be nice to measure/read these PWM values so I can tell which one of the cables is giving me an issue.
.

Valve block under variable control and some sort of feedback. I'd be not so sure it is cable.
One can just ring cables end to end without worrying about signals, shape or speed here.
Any-who this will not be GHZ or even MHZ territory. An el-cheapo pocket DSO will let you see the signal there or not even if it distorts rise time or aliases.
Time constant in the valve is going to be well under 10K so small oops in timing do not matter.
Big plus to a DSO is storage so that you can capture, go back and look at a few signals and what went on even if sampling 1/2.
Not to downside analog scopes which are the sweet.

Is this an air valve or a hydraulic valve? Servo valve or just plain.
It maybe a card in the computer, the brains in the valve or other. IMO and experience you are very correct to chase the cable first.
Hydraulic servo vales are picky devices with many points of failure so hoping this is not the what you are dealing with.
Bob
 
Thank you all very much for the discussion. Obvious that I have asked in the right place as there are several people here that know far more that I do about PWM.

The valve block is in fact hydraulic. It's a HydraForce block with four spool valves. 12V system. The valves I am using are HydraForce SP08-47CLM proportional spool valves. https://www.hydraforce.com/Proport/Prop-pdf/2-111-1.pdf

I know the cable definitely was my problem this last instance as I was able to do a swap and check with every other component. And even though the pertinent wires in the "bad" multi-conductor cable had zero ohms resistance, something was still amiss. I obviously ended up replacing this cable to solve the problem, but it's a last resort as the terminations on the cable go into the plug for the controller. And this controller plug also has about a dozen other wires terminating into it as well.

And maybe when I was opposed to an o-scope, I had flashbacks to those giant boxes they rolled out on the cart and started looking at green lines on a CRT screen while adjusting one of the dozen knobs.

Like I said, I'm looking for something to verify the signal at the valve with some sort of numerical value. I can plug my laptop into the computer and see that the computer is sending out a value ( say 700 ). It would be great if the meter on the valve end would say 700, but I would be OK with any kind of signal that would be proportional to the PWM value. I'd be looking for cases where the computer says it sent out 700, but the valve only received 400.
 








 
Back
Top