Go Down

Topic: Serial oscilloscope (Read 7 times) previous topic - next topic


Oct 07, 2009, 09:15 am Last Edit: Oct 07, 2009, 09:46 am by Aniss Reason: 1
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:


All feedback is very welcome :)


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

Code: [Select]
byte val;

void setup()

void loop()
 Serial.print(val, BYTE);


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!! :)

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

Do try to include the changes..  :)


This is a useful tool.

¿Would you share your Windows source code?




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 ?


Oct 17, 2009, 10:24 pm Last Edit: Oct 18, 2009, 05:23 am by Aniss Reason: 1
I'm glad others find it usefull too. For my purposes it's perfect :)

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:


I also uploaded the source code here:


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 :)


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  :)


Hi Ashwin,

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

Could you elaborate and I'll check it out?


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!!  8-)


Thanks :) 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...


Oct 19, 2009, 09:11 am Last Edit: Oct 19, 2009, 09:27 am by Aniss Reason: 1
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:


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:

Code: [Select]

byte val=0;

void setup()

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

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 :)


Nov 15, 2009, 06:05 am Last Edit: Nov 15, 2009, 10:32 am by selfonlypath Reason: 1
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,... http://code.google.com/p/arduinoscope

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.

Go Up