Pages: [1] 2 3 4   Go Down
Author Topic: Real Time Plotting Tool ( Oscilloscope )  (Read 39762 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Webpage with more information http://www.negtronics.com/simplot

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

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

Download it from http://code.google.com/p/projectsimplot/downloads/list

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

Code:
/*

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);
}
« Last Edit: August 15, 2012, 11:18:10 pm by Brijesh » Logged

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: July 22, 2011, 06:39:05 pm by Brijesh » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post some (prelim) screenshots?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?



« Last Edit: May 26, 2011, 08:17:50 am by Brijesh » Logged

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

New webpage with more information: http://www.negtronics.com/simplot

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?

« Last Edit: May 30, 2011, 09:27:27 am by Brijesh » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Rob,

Thanks for your input.

- 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.

Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Brijesh,
Quote
- 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) -


Quote
- 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
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Logged

Sherbrooke
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Dominic
Logged

Dominic Létourneau
http://www.openecosys.org

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: June 16, 2011, 04:02:14 pm by Brijesh » Logged

Sherbrooke
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Dominic Létourneau
http://www.openecosys.org

USA
Offline Offline
Newbie
*
Karma: 1
Posts: 30
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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



« Last Edit: July 22, 2011, 06:57:56 pm by Brijesh » Logged

Pages: [1] 2 3 4   Go Up
Jump to: