voltage measurement
tehmoordar
Posts: 52
hi
I am doing this one project and I am controlling the motor speed with help of PWMPAL. I am trying to calculat ewhat torque is there at motor for that purpose I am taking voltage across one sensing resistor that I have placed in series with motord and MOSFET. but the problemis may be due to motors voltage across 1 ohm resistor is not persistent but jumping all over the place like in ripples
My multimeter shows me Voltage to be like 0.25V but if I see on Oscope it is choppy and ramping ( see screen shots)
How can I get a nice clean signal across resistor on Oscope, what kind of filter can help me out
Thanks
·
I am doing this one project and I am controlling the motor speed with help of PWMPAL. I am trying to calculat ewhat torque is there at motor for that purpose I am taking voltage across one sensing resistor that I have placed in series with motord and MOSFET. but the problemis may be due to motors voltage across 1 ohm resistor is not persistent but jumping all over the place like in ripples
My multimeter shows me Voltage to be like 0.25V but if I see on Oscope it is choppy and ramping ( see screen shots)
How can I get a nice clean signal across resistor on Oscope, what kind of filter can help me out
Thanks
·
Comments
Something I have noticed is that the second picture's waveform is contained within the first picture. The waveforms are not identical so it is clear the second isn't a zoomed in version of the first picture.· The reason why I have drawn attention to the similarity is that I believe this is an accurate representation of the current drawn by the motor. The coils in the motor are big inductors, so when you switch the motor on or off you are going to get a spike like shown in the second time division of the first picture. As to the ramping effect, is your motor a speed controlled motor? The ramps are consistant, meaning at the start there are frequent fluctuations in the drawn current as the motor is obtaining it's full speed, as it approaches that speed, it elongates the fluctuations. A speed controlled motor would likely have this type of current draw. So it is my opinion you are seeing valid data, motors are notoriously noisey on the supply lines, it's one of the reasons motors are frequently given thier own power supply.
Now with all that said, you can clean up the signal some at the expense of data accuracy if that is what you desire. The two simplest methods are a low pass filter and a window averaging.
The low pass filter is a resistor (in series) and capacitor (with the negative terminal tied to ground), the cutoff frequency is dictated by the time constant of the RC circuit (1/RC) the larger the time constant, the lower the cutoff frequency, and the more smoothed output signal you'll see.
A window average is a software solution which mimics the behavior of the low pass function, the simplest formula (say for 4 data points) would be (V0+ V-1+ V-2+ V-3)/4, V0 is the current measured value, V-1 is the previous measured value and so forth.·The result is a smoothing out of the signal, the more data points used to calculate the current value, the more smoothing that occurs. This equation can be modified depending on your needs, like if you want the current value to me more heavily affected by recent samples you can use the weighted equation (V0+ 0.5V-1+ 0.25V-2+ 0.125V-3)/1.875. If you are interested in the weighted equation, I can give you an algorithm which only requires one word sized variable of storage and is extremely fast (it's window length is equal to the number of bits used to calculate the value, so for a word sized variable, the window uses the last 16 values).
Post Edited (Paul Baker) : 7/14/2005 7:20:06 PM GMT
you are correct the time scale is visible in screen shots it is like 100usec which is quite small , but you idea of using windows is new to me and I am really intrested in implementing that.
These Dc motors are installed in track robot ATR from roguerobotics.com and Iam controlling them through pwm usin pwmpal.
how cna I clean that signal with software solution.
Thanks
I can have a try at it though I am not a good programmer but I will stay in touch if I am unsuccessful
Thanks
The first is the equal weighted smoothing algorithm:
The second is the log2 weighted smoothing algorithm:
The second algorithm is a more accurate representation of the low pass filter, the only difference is the low pass filter is a ln (natural logorithm) weighted smoothing function (ln = log2.71818). Ok for some terms used that you may not know, modulo is an operator which returns the remainder of a division, this has the effect of rolling over the index into the array, so if you decare an array of size 4 (consisting of elemets indexed 0 through 3), when the pointer gets incremeted to 4, the remainer of 4 /·4 is 0, so the pointer wraps back to the beginning element. The·expression (x·>> b) operator means shift the value x to the right b bits, (x >> 1) is the same as (x / 2), but the way microprocessors work the >> is much faster than /.
If there is anything else you have questions about, ask.