Let's Make Robots!

Serial oscilloscope

Hi guys,

I'm currently programming a software oscilloscope based on C++ and DirectX, thus the performance is very good. It works directly off the serial/COM ports. I was just wondering..is anyone else interested in such a thing?

I'm programming it for my Arduino BUT it should be able to work with Picaxe(or anything else) too. It's not gonna be a fancy pro application, but it works pretty damn well :) For now it's rather limited since it only accepts 8 bit values...well for now...

Second..Any ideas for the user interface (since I've never actually seen a REAL live oscillocope..he he)?

So far I've got a start/stop button, select COM port, smoothing filter, scaling and BAUD rate selection...and that's about it for now...

Here is a screenshot:

scope_s.jpg

I'll be updating as it moves along...Only minor details are missing before beta 0.1 is ready :)

.... Aniss

 

UPDATE: Well, 1st version is ready. Hope you guys will give me some feedback...Couldn't attach the RAR file here (?) so I uploaded it to here:

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

 

UPDATE: As promised here is the source code. It's still a bit messy but it IS a prototype. If you plan to actually compile this here is some info: It's made with Visual C++ 2008 express. It's based on Dark GDK which again is based on DirectX SDK, so both have to be installed first. I also used this Win32 based wrapper for the serial communication, so you'll have to add the files Serial.h and Serial.cpp to your project too. And that should be it.

Here is the source code:

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

PS: Still anxious to get feedback from people who actually used the program :)

 

UPDATE: Even though nobody seems to find it usefull :( here is the newest version of the SerialScope. It's faster, has X axis scaling, shows statistics (press RETURN to toggle on/off) and I removed the start up hickups (NOTE: You now have to start by sending off the string "START" to sync the scope with your MCU). Plus some other minor improvements.

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Is it possible to send serial data from a PIC to a PC using the programmer cable? If no then that would explain why you PICAXE folks don't find this tool usefull. If yes then I recommend trying this tool. Just plug you MCU into your PC (USB or serial) and start sending your analog or digital readings by serial. Open the SerialScope, select the corresponding BAUD rate and com port and you have a pretty neat oscilloscope.

Anyway I'm curious if this also works with PICAXE?!

You certainly can with a PIC, many these days even have USART, a built-in serial interface. PICAXE on the other hand use the same μC hardware but have significantly limited capabilities, so I don't know how easy it is to interface those with a PC via serial using the programmer.

If you can't then it must make debugging your PICAXE code rather difficult?! When I'm working on/debugging an Arduino sketch I'm pretty much logging EVERYTHING via serial. In fact it was the very 1st thing I did with my Arduino (writing "HELLO" via serial), so it never occured to me earlier that perhaps this wasn't possible with PICAXE...

There's absolutely no problem sending serial data to a PC from a Picaxe. The 'serout' and 'sertxd' commands handle this easily. Check the docs if you are interested.

The only problem with Picaxe, which isn't a problem in a lot of cases, is the execution speed, as it decodes a tokenised program.

 

Hey,

Aniss!

Thanks for posting the code. You are probably right about the win32/directX thing and that it doesnt make sense for a linux user to try to convert it to POSIX. Anyhow, its always more interesting to be able to see what you have done - rather then watch an .exe file i cant use. So thanks again. 

BTW, I have an suggestion for your download/hosting situtation;

You should try out googlecode.com or a service similar(github). Will make it easier for you to share code and host the files at the same time. 

 -S.

And on 2nd though perhaps it wouldn't be SO dificult to export it to other other systems. The serial interfacing (which was the hardest part for me) would have to be rewritten off course. But as you see in the code I wrapped it into 3 functions: startSerial(), readSerial() and stopSerial(), which you could replace entirely with whatever works on Linux. The Dark GDK takes care of the graphics using simple functions such as dbLine(xA, yA, xB, yB) <- draws a line between the two point given. Likewise these functions would have to be replaced. But the rest is mostly standard C/C++.

I don't think POSIX would be adecuate. The reason I chose to use DirectX was to get HARDWARE ACCELERATION of the graphics rendering, which is why it performs well. Even though the graphics is simple I'm drawing 1000s of lines every 16th millisec.Without hardware acceleration it's not possible.

I was thinking more in the lines of OPENGL which is a cross platform equivalent to DirectX. But I don't know of any good wrappers/engines based on OPENGL?! Something as fast, easy and well documented as Dark GDK?!

PS: Thanks for the tip (regarding fileshare)...

Serial is not an issue. That can be handled.

Regarding hadware accelleration there are several toolkits:

- libSDL - is developed mostly for games- pretty fast but no fancy windowing

- GTK - windowing toolkit 

- QT  - windowing toolkit

- there are a lot more but the three above are the most used 

 Thanks for posting the source, I took a look at the source and I think I can have a try porting it to libSDL or gtk, but that is not going to happen real soon. 

Also Linux guys  can try Xoscope it looks very nice.

 I am from old school and have a dual trace 35 meg   (.1 us/ div.). Even that is slow to what they have now. I have seen digital scopes but have to be patient with the time delays. The signal can be come and gone by the time you see it on the screen.

Well I was hoping to get some feedback from other people regarding the performance etc..

But here is a small Arduino test program I'm using:

byte val = 0;

void setup()

  Serial.begin(115200);
}

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

I've set the BAUD rate to the max. supported by Arduino  (115200). In the main loop it sends of 1 byte and then waits 1 millisec. It runs very fast on my screen and rather smooth too. In realtime. Sometimes there is a hickup (=it stops for a few millisecs to wait for the serial) but that's it.

When I get more time I will setup a timer calculating the (average) bytes received per sec etc, test it and play with different combinations of settings: BAUD rate, buffer size, delays, timeout etc...

But as is it actually performs pretty well :)

Source code added at the request of Simon and Tinhead.

PS: Still anxious to get feedback from people who actually used the program :)