Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

ignoring falling edge of a sawtooth

I need to generate a sine wave based on the output of a shaft encoder. The encoder is rotated at a constant angular velocity, so the encoder's output is a sawtooth signal from 0-5V (0-360 degrees).

encoder_sawtooth.PNG

When I take the sine of this signal, I get a "spasm" that corresponds to every falling edge of the sawtooth, though the sine slightly lags the encoder:

encoder_sine.PNG

I understand how the spasm occurs: sin() sees an angle drop back (CW around the unit circle) from 360 deg down to 0 deg so for a second sin() outputs the same or preceding value. However, I don't know why the spasm occurs.

 

I didn't have this issue a couple of months ago when I ran this exact same code. The encoder would still output a sawtooth signal, but the proceeding sin() would behave as if the value of the encoder transitioned smoothly from 360 to 0 degrees. That is, sin(shaft encoder output) = perfect sinusoid.

 

Could a sampling rate or timing issue cause the spasms? 

If not, is there a way to force LabVIEW to ignore the falling edge other than a filter? That is, does LabVIEW/DAQmx have a setting to change the signal reconstruction of the ADC so it doesn't confuse the sine() function? (I know I'm getting hand-wavy here)

 

I know this issue could fall under signal conditioning, but I posted it here because I think I'm not sampling correctly.

0 Kudos
Message 1 of 3
(2,814 Views)

Not likely to be primarily a sampling rate or timing issue.  Looks more like a non-ideal sensor.  The original signal isn't a very clean looking sawtooth.  There's a small flattish spot at the top of the ramp and there are transient spikes during the transition back to 0.

 

Is this a continuous rotation potentiometer?

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 3
(2,806 Views)

Hi Kevin,

 

I'm using one of these magnetic rotary encoders.

http://www.usdigital.com/products/encoders/absolute/rotary/kit/MAE3

They are pretty robust sensors; however, the encoder is in a setup with a lot of noise (1 electric motor, 1 RC-servo, and a 6-axis load cell).

 

To that end, I simulated a sawtooth + sin() in LabVIEW, and I didn't get the same errant response as my physical setup.

sim_sawtooth_sine.png

This is leading me to think that the spikes are causing the sinusoid spasms.

0 Kudos
Message 3 of 3
(2,796 Views)