LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get a smooth signal on my waveform chart? Can someone please help? Mr. Altenbach, RTLSVU, Paul, GERDW? Anyone? I have attached my BD.

Solved!
Go to solution

I do not want square signal. I am using analog input to read the signal, but somehow I kept getting square wave looking signal. I tried to play with scaling; I kept getting same results.

 

This below is what I am getting:

GRCK5000_0-1649436582078.png

I want curvy/smooth signal similar to this one below:

GRCK5000_1-1649436748690.png

 

Thanks in advance for your help guys!

 

0 Kudos
Message 1 of 7
(1,669 Views)

Right click on the plot then in visible items select plot legend, then right click on the plot legend and select common plots and select one that shows the points. 

 

Then you can see where all the samples are. You can also adjust the interpolation style from the plot legend menu. 

 

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 2 of 7
(1,664 Views)

We cannot know how things are hooked up and how the signal actually looks like. These steps are so small that you are probably looking at the digitizer quantization.

 

(Sorry, I don't have your drivers. Do you have documentation? What MCC device do you use for AI?)

 

Your code has still glaring problems:

  • No need to hammer property nodes with every iteration if the property never changes.
  • Don't make your windows oversized
  • No need to branch the empty arrays to the loop boundary
  • "Index array" is resizeable
  • Converting a DBL to a formatted string and immediately back to DBL seems quite pointless.
  • Do you know the difference between a graph and a chart? Growing arrays in a feedback node and wiring that ever-growing array to a chart is pure madness. Just wire the scaled scalar to the chart! No need for arrays!
  • Your stop button still has the wrong mechanical action.
  • ...
Message 3 of 7
(1,654 Views)
Solution
Accepted by topic author GRCK5000

I believe I pointed this out before. I don't believe this will work the way you think it will.

You will probably have a race condition between which VI will run first Set duty cycle or Digital read...

Because as I said the Arduino is neither multi threading nor multitasking.

TFCapture.PNG

Try this:

TF2Capture.PNG

Since your program is one big loop you are speed limited by the slowest part of that loop.

 

An Arduino running Linx has loop rate somewhere around 200 loops per second maybe even lower depending on Linx code complexity.

 

You can't expect 200Hz sampling to make a smooth sinewave graph unless the signal frequency is < 20Hz.

 

See Nyquist–Shannon sampling theorem  and Aliasing

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 7
(1,632 Views)

Can you leave all that arduino stuff out and create a simple program using only the MCC device. Can you create a waveform manually somehow and use it as input?

0 Kudos
Message 5 of 7
(1,618 Views)

For a laugh you can try this, some smooooth plots : ) 

 

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 6 of 7
(1,599 Views)
Solution
Accepted by topic author GRCK5000

As others have mentioned there are going to be timing issues running everything in one loop. You can separate out the MCC Daq from the Arduino stuff to get faster readings on the MCC Daq. It looks like you also want to see the PWM signal, but the rate at which the serial communication for that happens it's not going to be meaningful data (might see half a dozen points per second).

 

Here's a better program structure to start with. UI and Linx are handled in the top loop. The MCC Daq runs separately in the lower loop.

 

smooth_chart.png

Message 7 of 7
(1,593 Views)