Real Time Plotting Tool ( Oscilloscope )

Hello All,

In my projects I needed a simple tool that could plot real time data from a microcontroller. There was no such tool available out there. There are various scripts using Processing and Python that can be used to plot the data, but nothing that is simple, easy to use and ready out of the box.

So I ended up writing a tool to plot real time data for my Quadrotor project. I thought others also may find it useful hence the birth of generic plotting tool

SimPlot Currently has following features

• Plots data from serial port
• 4 Channels of data
• 16bit signed data type (Arduino int datatype)
• X & Y axis range user selectable

Video of the tool in action: http://youtu.be/a9lTem0GWe0

Project page with source code http://code.google.com/p/projectsimplot/

Arduino Code samples: http://www.negtronics.com/simplot/simplot-code-samples

Here is an example sketch that was used to generate 4 sine/cosine waveforms that are plotted on the figure above.

``````/*

SimPlot Demo Arduino Sketch.
Generates and sends out 4 channels of data to be plotted using SimPlot.

*/
void setup()
{
Serial.begin(57600);

}

int buffer[20];
float deltaAngle = 3.14/51; //Arbitrary angle increment size
float angle = 0;
int amplitude = 100;

void loop()
{

int data1;
int data2;
int data3;
int data4;

//Generating data that will be plotted
data1 = amplitude * sin(angle);
data2 = amplitude * cos(angle);

data3 = (amplitude/2) * sin(angle);
data4 = (amplitude/2) * cos(angle);

angle = angle + deltaAngle;

plot(data1,data2,data3,data4);

delay(100); //Need some delay else the program gets swamped with data

}

void plot(int data1, int data2, int data3, int data4)
{
int pktSize;

buffer[0] = 0xCDAB;             //SimPlot packet header. Indicates start of data packet
buffer[1] = 4*sizeof(int);      //Size of data in bytes. Does not include the header and size fields
buffer[2] = data1;
buffer[3] = data2;
buffer[4] = data3;
buffer[5] = data4;

pktSize = 2 + 2 + (4*sizeof(int)); //Header bytes + size field bytes + data

//IMPORTANT: Change to serial port that is connected to PC
Serial.write((uint8_t * )buffer, pktSize);
}
``````

New Version: 1.1 Date: July 22th 2011 Notes: 1) Can change X axis length. 2) Can change Y axis min and max values. 3) Change the channel legends. 4) Enable or disable individual channels. 5) New version number scheme with only 2 fields x.x

New Version: 1.0.8 Date: May 29th 2011 Notes: 1) Fixed a bug which caused the program to crash on startup when there were no serial ports (Ardunio board not connected). 2) Changed version number from x.x.x.x to x.x.x

New Version: 1.0.0.7 Date: May 3rd 2011 Notes: 1) Fixed bug in Y axis autoscale feature. 2) Displaying program version info in the status bar.

Hei, thanks for this post. I am working on something similar to what you have done here, I need to read some data from arduino board via serial port and plot the data as a real time graph. Can you please put me through how to use this SimPlot? I download it already but could not run the executable file. Thanks.

Can you post some (prelim) screenshots?

Emmak,
Can you give more information. What happened when you tried to run the executable? What kind of error messages did you get, if any?
What operating system are you running it on? What version of the .Net framework do you have?

Rob,
Are you asking for a screenshot from me or Emmak?

New release of the tool. Found and fixed a bug. The program would crash on startup (never start) if there were no serial ports in the computer. This would happen if you have not plugged in the Arduino board before you run the program. My computer has a serial port on the motherboard, so I never saw this issue. Thanks to EmmaK that I found the bug.

Arduino Code samples: http://www.negtronics.com/simplot/simplot-code-samples

Created a video to show SimPlot in operation: http://youtu.be/a9lTem0GWe0

Looking for suggestions to impove the tool and add more features. For the next release I am debating about these features, not sure if they are useful. What do you guys think?

1) Remove Y axis auto scale feature and provide a way for user to set the range. 2) Provide feature to change X axis range. 3) Inculde Serial Monitor functionality in the text window. 4) Add more channels?

Not checked the tool yet ...

• For analog signals I would like to have a running average line. This can be based on a (configurable) number of samples or the samples in the last second/minute/...

• It would be great to have an X-Y plot -> analog1 on X and analog2 on Y

• Baudrates of 230400 and 345600, Although the Serial Monitor of the IDE don't support these baudrates, the Arduino - 2009/UNO - do. I've used them for few weeks now without a problem. The highest rate without a problem was 500.000 baud with putty.exe but that is a non standard rate. Maybe I want the free baudrate like in putty.exe so I can go to the limit (own risk of course)

• plot signal through some function e.g. I have an analog signal 0..1024 and I want to map that on temperature through some function e.g. a temperature function float T(int s) { return -50 + s/4.0; } The scale should be temperature degrees Celsius of course

my 2 cents for now Rob

Hello Rob,

• For analog signals I would like to have a running average line. This can be based on a (configurable) number of samples or the samples in the last second/minute/…
Nice idea, it is added to the list of things to be done.

• It would be great to have an X-Y plot → analog1 on X and analog2 on Y
This one is more difficult to implement. Not so sure where it would used.

• Baudrates of 230400 and 345600,
Although the Serial Monitor of the IDE don’t support these baudrates, the Arduino - 2009/UNO - do. I’ve used them for few weeks now without a problem. The highest rate without a problem was 500.000 baud with putty.exe but that is a non standard rate. Maybe I want the free baudrate like in putty.exe so I can go to the limit (own risk of course)

Added to list of things to be done.

• plot signal through some function
e.g. I have an analog signal 0…1024 and I want to map that on temperature through some function e.g. a temperature function
float T(int s)
{
return -50 + s/4.0;
}
The scale should be temperature degrees Celsius of course

This is far more difficult to implement. I can implement a single operation. To implment multiple operation like you have (one addition and one division) requires me to write a mathmatical expression parser (not sure if that is right term). Way beyond my programming skills, by the way I am not a programmer by profession.

On a side note, is anyone having problems installing the tool? Did anyone try to install on a machine that did not have .NET framework already installed? I am total newbie to this whole GUI programming and .NET stuff so got no idea what will happen if someone does that.

Hi Brijesh,

• It would be great to have an X-Y plot -> analog1 on X and analog2 on Y This one is more difficult to implement. Not so sure where it would used.

It would allow to have two related sensors in one plot, e.g. temperature versus humidity (greenery?) - heigth versus pressure (up in the air or under water) - length vs force - speed vs voltage (testing a generator) -

• plot signal through some function e.g. I have an analog signal 0..1024 and I want to map that on temperature through some function e.g. a temperature function float T(int s) { return -50 + s/4.0; } The scale should be temperature degrees Celsius of course

This is far more difficult to implement. I can implement a single operation. To implment multiple operation like you have (one addition and one division) requires me to write a mathmatical expression parser (not sure if that is right term). Way beyond my programming skills, by the way I am not a programmer by profession. :-)

I know it is a very difficult one but it would give the screenshots a "real world meaning"

google - math parser C# - and you will find free to use classes like - http://muparser.sourceforge.net/ - http://www.codeproject.com/KB/cs/MathParser.aspx - - http://www.c-sharpcorner.com/uploadfile/patricklundin/mathexpparser12062005062213am/mathexpparser.aspx -

Still not trivial

Hi, Its nice lightweight program.

I´d like to see:

1) Remove Y axis auto scale feature and provide a way for user to set the range. 2) Provide feature to change X axis range.

E

Rob,

I agree about XY plots, I will look into what it takes to support multiplie kinds of plots.

Enn40,

Thanks for the suggestions, I will add both those features in the comming releases.

Please have a look at this and tell me what you think :

http://arduino.cc/forum/index.php/topic,64175.0.html

Dominic

Hello Dominic,

It looks like a feature rich system. It has support of multiple devices on the bus, local variable plotting, ADC data plotting etc.

The common thing I can see with SimPlot is that both can plot data. I am trying to keep SimPlot, well simple and easy to use.

It would help the Arduino users if you mention how the tool is useful and what are its use cases. I mean explain features other than plotting analog data. It might not be evident to many people from reading the initial post.

Cheers and good luck.

Hello Brijesh,

Thanks for the comment. I have added information on my original post so it explains a little bit more what is the NetworkViewer.

http://arduino.cc/forum/index.php/topic,64175.0.html

Regards,

Dominic

Hello All,

There is new version of the tool, Version 1.1 I have discarded the .net version notation which uses 4 fields, ie x.x.x.x and chose to go with simpler notation with only 2 fields.

New features 1) Can change X axis length. 2) Can change Y axis min and max values. 3) Change the channel legends. 4) Enable or disable individual channels.

Rob, I tried to implement averaging and X-Y plots, but ran into some issues. You will see that there is empty column in plotsetup window where the average values was supposed to go.

Bug reports, suggestions and comments are much appreciated.

Thanks

as i type this out i realise it's most probably a massive noob question , but i still hope u can help im running and Arduino UNO and im trying to run your sample code for four analogue outputs to sim plot . im confused about where i get the imformation to fill out this line in your code ??

im using com port 10 if that help's any help would be great

``````//IMPORTANT: Change to serial port that is connected to PC
Serial.write((uint8_t *10 )buffer, pktSize);
``````

Hello,

If you have connected the Uno to PC with USB connection that you used to download the sketch, then you don't have to change anything in the sketch. Other Arduino models have more than one serial port and if someone has done something fancy then they need to change the code in the sketch.

COM Port 10 is port number on the PC side. Chose Com Port 10 in the drop down box in SimPlot.

You don't need to make any changes to code in sketch.

brijesh

hello all. My question is how to get real time data from arduino board to computer and then to Excel for further operation like ploting graphs... etc Can some one tell me about PLX DAQ of arduino. Is this use for the same purpose as i describe above? thanks regards.

Hello Fazal,

SimPlot can be used to observe real time plots. Currently it does not have feature to log data for further processing. I am in the process of adding that feature.

PLX DAQ does seem to have all the features you are looking for. You would have to figure out the protocol and use it.

It has been brought to my attention that download link is not working. There appears to be a problem with Google project hosting. Other projects have also reported this problem.