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

Sorry…
Sorry about the anoying download solution -> Wait 10 secs etc…I’ll find a better upload site later…

What about releasing the

What about releasing the source?

 

Hi guys

I’ll post the code later. Didn’t do it right away cause it’s a mess. Thought I’d clean it just a BIT 1st. Right now there is more unused code than used code etc…

About exporting to linux…I’d say it’s a no go. 99% of the code is DirectX/Win32 specific (all the hard parts). Better start off from scratch, or use this:

accrochages.drone.ws/en/node/90

That’s what I did but I got tired of louse performance, which is the reason I made this program: to get GOOD performance.

A bit more info here (I’ll post more later):

www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1254899716

 

PS: Try the program and most of you questions are answered. Doesn’t handle voltages just BYTES? :slight_smile:

 

This sounds like a really

This sounds like a really interesting project! specially if you get it working on Picaxe ! Would want a bit more info on it; what so I need to wire up and that sort of stuff…

Picaxe

Well, I’m not gonna make it work with a Pic since I don’t have one and don’t intend to get one (ever). But it should work. Serial is serial. As long as you send a stream of bytes (values between 0 and 255) it should work. And as long as the COM port and BAUD rate match, and you’re using 1 stop bit and NO parity bits. That should be it :slight_smile:

Try it and let me know if these settings aren’t adecuate for a Pic. I could easily add configuration of these settings to the user interface…

More Picaxe…

Just did a quick google on Picaxe serial standards. It seems you’re good to go: 8 data bits, no parity bit and 1 stop bit. Just remember to add N in the serout command before the BAUD rate (eg. N9600) meaning NOT inverted polarity, and it should work fine as is…

Source code added…

Source code added at the request of Simon and Tinhead.

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

Curious how fast it can go
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.

Testing

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

Hey, Aniss!Thanks for

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.

You’re welcome :slight_smile:

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

Just wondering…

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

Congratulations

 

I do think it is a good idea.

I haven’t had time to check it, but I will as soon as possible.

OK?! Interesting…

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…

Go for it :slight_smile:
It’s extremely easy to use, it’s fast (up to 8 Bytes per millisec seems to be the limit) and the filter and scaling makes it a pretty usefull tool :slight_smile:

There’s absolutely no

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.

 

Nice… but I think I will
Nice… but I think I will look into the code I’m a Mac User, so maybe I’ll give it a try porting …

**Im making a low speed**<br><p>Im making a low speed oscilloscope with the arduino to help debug a couple of other projects but the files from the original post seem to have expired or been taken down.

Can you reupload them Aniss? Or does anyone else have the newest version?