Go Down

### Topic: Real Time Plotting Tool ( Oscilloscope ) (Read 93665 times)previous topic - next topic

#### brijesh

##### Apr 19, 2011, 05:17 amLast Edit: Aug 16, 2012, 06:18 am by Brijesh Reason: 1
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.

Code: [Select]
`/*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 sizefloat 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);}`

#### brijesh

#1
##### May 03, 2011, 06:48 amLast Edit: Jul 23, 2011, 01:39 am by Brijesh Reason: 1
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.

#### emmak

#2
##### May 26, 2011, 12:27 pm
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.

#### robtillaart

#3
##### May 26, 2011, 03:14 pm
Can you post some (prelim) screenshots?
Rob Tillaart

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

#### brijesh

#4
##### May 26, 2011, 03:15 pmLast Edit: May 26, 2011, 03:17 pm by Brijesh Reason: 1
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?

#### brijesh

#5
##### May 30, 2011, 05:49 amLast Edit: May 30, 2011, 04:27 pm by Brijesh Reason: 1
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.

#### robtillaart

#6
##### May 30, 2011, 08:56 am

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
Rob Tillaart

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

#### brijesh

#7
##### Jun 03, 2011, 04:23 am
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.

#### robtillaart

#8
##### Jun 03, 2011, 08:55 am
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 -

Still not trivial
Rob Tillaart

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

#### Enn40

#9
##### Jun 05, 2011, 09:07 am
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

#### brijesh

#10
##### Jun 11, 2011, 02:07 am
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.

#### doumdi

#11
##### Jun 16, 2011, 08:06 pm
Please have a look at this and tell me what you think :

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

Dominic

#### brijesh

#12
##### Jun 16, 2011, 10:57 pmLast Edit: Jun 16, 2011, 11:02 pm by Brijesh Reason: 1
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.

#### doumdi

#13
##### Jun 20, 2011, 02:58 pm
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

#### brijesh

#14
##### Jul 23, 2011, 01:37 amLast Edit: Jul 23, 2011, 01:57 am by Brijesh Reason: 1
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

Go Up