Serial oscilloscope

I just finished programming 1st version of a software oscilloscope to use with Arduino. It's made in C++/DirectX so it performs pretty good (unlike the Processing dittos I've seen so far).

Here is a screenshot:

A few notes:

  • Currently it ONLY accepts single byte values so you'll have to map int values down to 0-255 and send them off as bytes -> Serial.print(value, BYTE);

  • The first few readings are weird due to Arduino resetting when the serial connecting is established. We're talking a few microsecs so it's no major problem. After that it's VERY stable.

  • The application draws as fast as it receives the values. So you control the speed by sending faster or slower from Arduino. Though if you send TOO fast it messes up and you'll get error messages like "*Buffer overrun" (that means slow down..hehe). However 1000 values per sec don't seem to be a problem.

  • Obviosly the COM port and BAUD rate must match that of Arduino.

Here is the application:

www.4shared.com/file/138189588/3813eae8/SerialScope.html

All feedback is very welcome :slight_smile:

Ah...forgot to add a tiny Arduino sketch for testing:

byte val;

void setup() 
{  
  Serial.begin(115200);  
}

void loop() 
{
  Serial.print(val, BYTE);
  val++; 
  delay(2);
}

Hi
Your oscilloscope's really good! Is there some way you can adjust the time axis? And an option to save the waveform will really spice up your application!! :slight_smile:

Currently, i can only think of using the 'printscreen' option

Do try to include the changes.. :slight_smile:

This is a useful tool.

¿Would you share your Windows source code?

Thanks
Nice Tool

Great, linux version is possible?

Nice, but as you are comparing with Processing oscilloscopes, did you gave a chance to this 2-bytes per channel, 12 channel, open-source, Win/Mac/Linux Arduinoscope ?

I'm glad others find it usefull too. For my purposes it's perfect :slight_smile:

I'm planning to make several improvements (when I get the time):

  • Multichannel (atleast 2..probably more)
  • 10/16 bit capable
  • Recording + rewind/pause + save as file + printscreen
  • X axis scaling (aka time axis)
  • Start up sync (to avoid the hickups at start up)
  • Change analog in FROM the scope (which off course would require some arduino code as well)

Unfortunately I don't have much time these days so it may take a while before I get around to it.

The app is based on DirectX (for graphics) and Win32 (for serial) so it isn't exactly portable to Linux/Mac. Sorry! That was the price of good performance.

I uploaded a new version. Only changes are: it's capable of running much faster and it can display statistic info: FPS (frames per sec), BPF (bytes per frame) and TBR (total bytes received). Press RETURN to toggle info on/off. Here it is:

www.4shared.com/file/139947578/d080e5cc/SerialScope_2.html

I also uploaded the source code here:

www.4shared.com/file/138412518/630d2562/SerialScope_Source.html

It's not very pretty, but it IS a prototype. If you plan to compile it you'll need the following (I recommend installing in listed order):

  • Visual Studio or Visual C++ express (I'm using the latter)
  • DirectX SDK
  • Dark GDK
  • The following Win32 serial wrapper (add Serial.h and Serial.cpp to the project)

PS: I did try the processing based Arduinoscope. It looks nice but it barely moves on my PC (which isn't the fastest one around I admit). Processing is WAY too slow. I used DirectX to get HARDWARE ACCELERATION, thus the performance is really good :slight_smile:

Apart from the usual V-t figures, do try to include an X-Y mode to display V vs V graph which'll help display characteristic curves and lissajous patterns. It'll increase the number of applications involving the serial scope :slight_smile:

Hi Ashwin,

Sounds interesting..but I really don't know what you mean by that? Probably cause I never saw a real LIVE oscilloscope :smiley:

Could you elaborate and I'll check it out?

Hi
:slight_smile:
Generally, oscilloscopes are used to display Voltage-Time curves. However, when two channels are involved, it is possible to plot a graph with the voltage of the second channel on the Y-Axis and the voltage on the first channel on the X-Axis using the 'X-Y' mode. This way, the output becomes a voltage vs voltage graph. This is generally used to determine phase differences between two voltages(given to the two channels). This usually takes the form of a circle, ellipse or a slanted line(depending on the phase difference). This plot is called the 'Lissajous pattern' or 'Lissajous curve'. So, if you can plot the 'channel 2 voltage' vs 'channel 1 voltage' it'll make it look more like a real oscilloscope!! :sunglasses:

Thanks :slight_smile: And like I said it sounds interesting...but complicated and not something I need right now so it wont be the first thing on my todo list...but perhaps some day...

Hi again,

Added a few changes:

  • Button animations. I know..no big deal but I hate buttons that dont react.

  • Start up syncronization to avoid the hickups at start up. You now have to write: Serial.print("START"); in your setup(), otherwise the scope wont start drawing.

  • X/time axis scaling. This was rather problematic as I suspected. And it messes up a bit for a sec when you change scale WHILE the scope is running. Besides the frame rate dropped significantly when I was downscaling...well it has to draw respectively 2,3 or 4 times as many lines each update. And like I said my PC isn't the fastest one around. Perhaps you guys wont notice the difference. Anyway I'll try to improve it later.

Here is the new version:

www.4shared.com/file/141877259/25284f56/SerialScope_3.html

I'm very interested in getting feedback regarding the performance. Like I said RETURN toggles info on/off. How fast/slow are you able to send from Arduino and still get usefull readings? What is you frame rate etc?

Here is a small sketch for speed testing:

#define PERIOD_LENGTH 1
#define BYTES_PER_PERIOD 2

byte val=0;

void setup() 
{  
  Serial.begin(115200);
  Serial.print("START");
}

void loop() 
{
  for(int i=0; i<BYTES_PER_PERIOD; i++) Serial.print(val++, BYTE);
  delay(PERIOD_LENGTH);
}

I'm able to send up to ~8 bytes per millisec, but more than that and I get "*buffer overrun" errors and the likes. Please let me know how your setups perform?!

Aniss :slight_smile:

Nice, but as you are comparing with Processing oscilloscopes, did you gave a chance to this 2-bytes per channel, 12 channel, open-source, Win/Mac/Linux Arduinoscope ?

I'm totally lost in trying to use, compile,... Google Code Archive - Long-term storage for Google Code Project Hosting.

The only thing that works is the dowloaded application-osx.zip java file where I've a nice 6 channels scope display. But when I try to understand, compile the arduino sketch examples downloaded from processing-arduinscope.zip, it is totally esoteric to me.

Has anyone with a Mac succesfully used the open source of arduinoscope server and if yes, would you be ok to provide clear step instructions ?

Thank you

Did you check the issues ? There is a library incompatibility with some Macs.

I'm unfortunately not at the moment checking issues because my first problem now requires to have clear instructions on how to compile arduino code, java code on my iMAc G5 running with Tiger :frowning:

If your first problem has already been encountered by other users, checking issues may avoid you to search the problem on your side but shows directly that the software installation is not good at all (and it seems).

Whatever, I can explain what I did to test it :

  • download the source code from SVN

  • take the sketch (.pde) in "arduino-arduinoscope" directory and put it in a directory with name "arduinoscope" under your Arduino sketch folders, and rename the .pde in "arduinoscope" (character - is not allowed if I recall), and transfer to your Arduino

  • take the examples in the processing directory, and copy "arduinoscope.java" in each of them, beside the example .pde, and copy examples in your own processing sketch folder

It seems that the author tried to make a library from his code but did not succeed. Try to contact him by email.

If your first problem has already been encountered by other users, checking issues may avoid you to search the problem on your side but shows directly that the software installation is not good at all (and it seems).

Ok thx, i'm not very used to share code servers so I see what you meant initially. i've looked on the issues, the only applying to my situation is If your first problem has already been encountered by other users, checking issues may avoid you to search the problem on your side but shows directly that the software installation is not good at all (and it seems). since I have a classic G5 mac hence no intel involved.

I've taken the arduino-scope.pde under an "arduinoscope" skektch folder. It compiles fine then dowloaded ok on my arduino board.

Where do you find "arduinoscope.java" in order to copy it inside each example ?

Another thing: I've moved examples so arduino can compile then dowload but compilation fails with this comment for example on "Simple SerialArduinocope.pde"

error: variable or field 'controlEvent' declared void In function 'void setup()':
 In function 'void draw()':
 At global scope:

As I wrote before, the only thing working is "SimpleSerialArduinoscope.app" which i download from the server under "application-macosx.zip". It dsiplays 6 scope visualisations screen but they are silent so I don't understand how to establich protocol between arduino board and this shell.

the examples are for Processing, not Arduino.

on your Arduino board, you run a program compiled from sketch "arduinoscope" and transferred into your Arduino board using serial cable.

on Processing development platform, you load an example, change some parameters (number of your serial port where the Arduino board is connected), then run the software on your Mac

the cable between your Mac and the Arduino board is used to transfer information from the input/output pins

on Processing development platform, you load an example, change some parameters (number of your serial port where the Arduino board is connected), then run the software on your Mac

Ok I understand now so I'll load Processing software but why the author called these examples under *.pde ?

Have you run successfully this otehr application http://accrochages.drone.ws/en/node/90 or is same issue as arduinoscope ?