PC Oscilloscopes and LINUX?

Hi,

because I am retired and looking for something interesting to do I would like to buy one of the Velleman PC-scopes and make the software for it in Linux environment. I almost for sure know the answers for these questions before even asking, but here we go.

Is the specs for the communications available from Velleman?
I am mostly interested with a scope which connects with USB.

If answer is yes - which is great. Then is the source of the Windows-program available, maybe under NDA. That would make the job easier.

I think Velleman should GPL the software to keep up with evolving hardware - but that’s just my opinion.

Best Regards
Kari Laine

[quote]I would like to buy one of the Velleman PC-scopes and make the software for it in Linux environment.[/quote]This is a nice challenge!

[quote]Is the specs for the communications available from Velleman?
I am mostly interested with a scope which connects with USB.[/quote]Sorry - at the moment no specs for the communications are available.
We can anyhow prepare for you the communication specs for the new PCSGU250, 2 channel USB-PC SCOPE + GENERATOR.

[quote]Then is the source of the Windows-program available, maybe under NDA.[/quote] Sorry - the source code is not available.

[quote]I think Velleman should GPL the software to keep up with evolving hardware - but that’s just my opinion.[/quote]The communication specs for the PCSGU250 can be released - I think.

[quote=“VEL255”][quote]I would like to buy one of the Velleman PC-scopes and make the software for it in Linux environment.[/quote]This is a nice challenge!

[quote]Is the specs for the communications available from Velleman?
I am mostly interested with a scope which connects with USB.[/quote]Sorry - at the moment no specs for the communications are available.
We can anyhow prepare for you the communication specs for the new PCSGU250, 2 channel USB-PC SCOPE + GENERATOR.

[quote]Then is the source of the Windows-program available, maybe under NDA.[/quote] Sorry - the source code is not available.

That one is quite slow scope…
Anyway it is cheap here in Finland. Little over 200 euros. This could be nice learning project. So please could you provide the communication specs and whatever other information that you can release. I will buy it when I have the specs. My email address is klaine8@gmail.com .

On the other hand if I would buy a scope for my electronics hoppy - what would be the best from Velleman? PC-scope which connects to host PC with usb and software works in 32-bit and 64-bit XP and in 32-bit and 64-bit Vista. Naturally I will later (much later) have a Windows 7 machine - are there plans when the software is available for that?

Thanks again.

Best Regards
Kari

The communication procedures of the PCSGU250 are quite straightforward. Please wait a couple of days, I’ll prepare the document and send to you.

[quote]On the other hand if I would buy a scope for my electronics hoppy - what would be the best from Velleman? PC-scope which connects to host PC with usb and software works in 32-bit and 64-bit XP and in 32-bit and 64-bit Vista. Naturally I will later (much later) have a Windows 7 machine - are there plans when the software is available for that?[/quote] I think this may be the PCSU1000.
◦real time sampling frequency: up to 50MHz
◦sampling frequency for Repetitive signals: 1GHz
◦bandwidth: DC to 60 MHz

The software is tested to run on 64-bit Windows 7.

Before starting the “low level” communication specifications I’d like to ask if you have checked the DLL made for the PCSGU250 ?
There are lot of ready built functions to begin.

Is it possible to use this DLL in Linux?
Do you need the source code for the DLL to rewrite it for Linux?

The DLL is a “link” between the full running PcLab2000LT.EXE and the user application. It just transfers the commands and data between these applications.

Using this DLL also the function generator control is very easy.

You may easily get the oscilloscope hardware operating and you can read the raw data from there.
Using the raw data you can do the further calculations e.g. FFT (Fast Fourier Transform) needed for the spectrum analyzer.

Also you may calculate and display the RMS value of the AC component and calculate and display the other waveform parameters.

On “low level” you have first to parse and send a binary .BIT file to the FPGA of the oscilloscope to get it running.

Also to get the function generator working, a wave table have to be calculated according to the selected output voltage level and the step attenuator settings. For the function generator wave generation in the DDS (Direct Digital Synthesis) core the RAM address increment and the increment of this increment for frequency sweep have to be calculated and sent to the generator.
I put here below a fraction of code how this all is done in the existing software. (Easier methods may be anyhow…)
At the end of this code you’ll see how the data buffer [color=#008000]tmpo [/color]is sent to the oscilloscope.

This is just a fraction of the “jobs” to do.

You may download the DLL package from the downloads page.
pcsgu250_dll_rev1.zip
Software development kit for PCSGU250, DLL with examples.

[code]var s:string;
i,j:integer;
incr, sw, swp,t1,t2,t3,t4,f,di:double;
n,m,o,p:cardinal;
a1,a2,a3,a4,a5,a6:byte;
a:array [0…20] of byte;
b:array [0…20] of byte;
begin
if filtteri>5 then di:=6.25e6
else di:=12.5e6;
if not demomode_on and USB_open then
begin
if aalto=6 then
begin
swp:=16256256*(stop_s-start_s)(Exp((44)ln(2))/di)/(step_s1e4);
if Form1.log.checked and (stop_s>start_s) then
swp:=128
256*(stop_s-start_s)(Exp((44)ln(2))/di)/(step_s1e4);
if Form1.log.checked and (stop_s<start_s) then
swp:=128
128256(stop_s-start_s)(Exp((44)ln(2))/di)/(step_s1e4);
if filtteri>5 then swp:=swp
2;
if swp<0 then swp:=-swp;
if swp<1 then swp:=1;
// label32.caption:=floattostr(swp); //*****
for i:=0 to 11 do b[i]:=0;
for j:=0 to 11 do
begin
sw:=swp/(Exp((88-j8)ln(2)));
swp:=frac(sw)
(Exp((88-j
8)*ln(2)));
for i:=0 to 7 do
begin
t1:=sw/(Exp((7-i)*ln(2)));
if t1>=1 then
begin
b[11-j]:=b[11-j]+round(Exp((7-i)ln(2)));
t1:=t1-1;
sw:=t1
(Exp((7-i)ln(2)));
end
else
begin
sw:=t1
(Exp((7-i)*ln(2)));
end;
end;
end;
a[0]:=b[0];
a[1]:=b[1];
a[2]:=b[2];
a[3]:=b[3];
a[4]:=b[4];
a[5]:=b[5];
a[6]:=b[6];
a[7]:=b[7];
end
else
begin
for i:=0 to 7 do a[i]:=0; // load sweep increment = 0 in NO sweep mode and sync mode setting
end;

 // Form1.label37.caption:='';              //******
 //for i:=11 downto 0 do Form1.label37.caption:=Form1.label37.caption+' '+inttostr(b[i]);  //*****

case f_alue of
  1: f:=taajuus/1000;
  2: f:=taajuus;
  3: f:=taajuus;
  4: f:=taajuus;
  5: f:=taajuus;
  6: f:=taajuus;
  7: f:=taajuus*1000;
  8: f:=taajuus*1000;
end;
incr:=f*(Exp((44)*ln(2))/di);
if aalto=6 then incr:=start_s*(Exp((44)*ln(2))/di);
//label10.caption:=floattostr(incr);         //*****
for i:=0 to 7 do  b[i]:=0;

for j:=0 to 5 do
begin
  sw:=incr/(Exp((40-j*8)*ln(2)));
  incr:=frac(sw)*(Exp((40-j*8)*ln(2)));
  for i:=0 to 7 do
  begin
    t1:=sw/(Exp((7-i)*ln(2)));
    if t1>=1 then
    begin
      b[5-j]:=b[5-j]+round(Exp((7-i)*ln(2)));
      t1:=t1-1;
      sw:=t1*(Exp((7-i)*ln(2)));
    end
    else
    begin
      sw:=t1*(Exp((7-i)*ln(2)));
    end;
  end;
end;
a[8]:=b[0];
a[9]:=b[1];
a[10]:=b[2];
a[11]:=b[3];
a[12]:=b[4];
a[13]:=b[5];
//label26.caption:='';
//for i:=7 downto 0 do label26.caption:=label26.caption+inttohex(b[i],2)+' ';
// for i:=7 downto 0 do label26.caption:=label26.caption+inttostr(b[i])+' ';

// number of cycles of 100us
if aalto=5 then num:=0 else num:=100000;        //num:=0  -> noise on
if aalto=6 then
begin
  if filtteri>5 then num:=round(1e4*step_s/2)
  else num:=round(1e4*step_s);
  if Form1.log.checked then num:=num div 8;
end;

//label30.caption:=inttostr(num)+'  '+floattostr(step_s);      //*****

asm
  mov  eax,num
  mov  a1,al
  shr  eax,8
  mov  a2,al
  shr  eax,8
  mov  a3,al
  shr  eax,8
  mov  a4,al
  shr  eax,8
end;
a[14]:=a1;
a[15]:=a2;
a[16]:=a3;
a[17]:=a4;
a[18]:=0;
if Form1.log.checked then a[18]:=2;
if stop_s<start_s then a[18]:=a[18] or $04;    // neg sweep
if aalto=5 then a[18]:=1;
a1:=3;
tmpo[0]:=14;  //load general setting
tmpo[1]:=2; //load increment on-the-fly
tmpo[2]:=19;   //number of bytes
for i:=0 to 18 do tmpo[i+3]:=a[i];
//Form1.MPUSBWrite(OutPipe,@a1,1,@SentDataLength,10);
//Form1.MPUSBWrite(OutPipe,@a,19,@SentDataLength,10);
Form1.MPUSBWrite(OutPipe,@tmpo,22,@SentDataLength,10);

end;
end;[/code]

Hi Velleman,

thanks for answering. No it is not possible to use DLL-libraries in Linux (as far as I know).
So I would need source for it.

I must write a device driver for the scope in Linux.
Actually this depends what kind of USB-device the Scope is.

Then I would need to write a library (.so-lib) to have the calls to use in user programs.
This would be my first USB-device driver but as I said I have time to learn as I go.
So I need the documentation to the lowest level communication with the device.

Best Regards
Kari

The PCSGU250 oscilloscope is using full speed USB communication.
At the moment two alternative drivers WinUSB and Microchip’s MCHPUSB drivers can be used.

If you anyhow like to do the Linux version of the scope “from scratch”, I’ll first write a draft description of the low level communication principle.
I’ll just write what commands you have to send via the USB to the oscilloscope / function generator to get them operating and how to get the data read from the oscilloscope.

Hi,

both of those are for windows environment and their sources are not available. That doesn’t matter because that won’t help anyway.
Idea of both is that you can control USB from user space.
There is a crossplatform version of such in SourceForge called libusb. Which I probably could use.

If you have time please send me the low level communication principle. I am not promising fully functional scope but I will do at least so that you get signals on the display and control the function generator. The Fourier Transform is still not understood by me but I have a math book waiting.

Is the priciple that PC polls the scope hardware all the time or does it use interrupts? I think you cannot use interrupts in user space.
I would rather implement this as a device driver. I have to see what chip is on the hardware when I get it.

Thanks again for your time - good service these forums.

Best Regards
Kari

[quote]Is the principle that PC polls the scope hardware all the time or does it use interrupts? I think you cannot use interrupts in user space.[/quote]Yes, polling is used. To save CPU resources a 10ms timer is used to check if there is data available from the oscilloscope.

[quote]I would rather implement this as a device driver. I have to see what chip is on the hardware when I get it.[/quote]The USB chip is PIC18F2450.

[quote=“VEL255”][quote]Is the principle that PC polls the scope hardware all the time or does it use interrupts? I think you cannot use interrupts in user space.[/quote]Yes, polling is used. To save CPU resources a 10ms timer is used to check if there is data available from the oscilloscope.

Techically that chip is a microcontroller which includes USB-functionality - but that’s splitting the hair. What I meant with after getting hardware was that whether Linux usb stack notices the device. That would make my job easier. I could then use the libusb-project. Naturally now I am waiting to get the protocol definition from you.

I found a quite nice USB-protocol analyzer which on the paper looked perfect. The price was not perfect although…
Does anybody know a good USB-protocol analyzer which runs on the same host as the program doing communication via USB?

Best Regards
Kari

Hello there,

I am also interested in getting to know the low level communications spec to that scope, and yes also for the purpose of a Linux implementation. I would wager that a lot of hobbyists (more than average, anyway) are also Linux users.

Maybe we can get a collaborative effort up and running, here?

Lars

[quote=“ljuul”]Hello there,

I am also interested in getting to know the low level communications spec to that scope, and yes also for the purpose of a Linux implementation. I would wager that a lot of hobbyists (more than average, anyway) are also Linux users.

Maybe we can get a collaborative effort up and running, here?

Lars[/quote]

Hi Lars,

Yes I would highly appreciate all the help I can get. Do you happen to know QT-programming …?

Here is what I have made and plan to make.

I have been active now for about 2 months. I can start scope and get something out and in - in text. For the last two weeks I have been studying QT-library. I made one version and it got so glumsy I started again yesterday. My goal is to get the userinterface v0.000000000000000000000000002 done this week. Then I probably write the communication part again with C++. Mind you I don’t have all the communication done yet. The function generator is very sophisticated - you can do a lot things with it and I don’t complete understand it yet. So this has been very slow going from my part. Velleman has been VERY supportive and therefore I am committed to this project. Actually the person responsible for the software is a finnish guy. I don’t mention his name here because I don’t know whether it is allowed or not.

I am putting something like 40 hours a week for it.

I invested to a USBStrace - program made by SysNucleus, sysnucleus.com . This has saved me more than once - I recommend.

I also have now two PCSGU250s to make possible same time test things with a Windows-machine having USBStrace and running other one on Linux.

PCSGU250 Windows-program has lot of features and I really don’t undestand all of it yet. Fourier-transform is totally unknown to me. I did spend some time with the Wikipedia and got my head spinning. So that feature will not be done first - at least not by me.

My original idea was/is to get some kind of version running and put a project page in the SourceForge.net. I also registered my own domain with the GoDaddy - which is empty at the moment.

So this writing is an official opening of this project.
All who would like to use or develop this project please contact me at klaine8@gmail.com

And I am not probably the most qualified person to lead this project - so if more suitable person is found - I don’t mind to take a side role. I have had to learn a lot of new things so far and there is no end to new things I have to still learn. But we have to take into account that there is a single person who communicates with the Velleman - otherwise it will be too time consuming to Velleman and they might dislike it.

Again lot of thanks to Velleman!

Best Regards
Kari Laine

Hi Kari,

I just unpacked the scope, but as I do online applications GUI designs for a living maybe I can help with the Qt bit. Mind you, I need to learn that first, but that’s not an issue.

I suggest that we get the sourceforge project up and running and use that forum for communication.

/Lars

Hi Lars,

Yes if you are interested of userinterface programming in Linux-environment - QT is a good choice. Other one is the GTK+ (GNOME project, GIMP)
This scope project is great - because it depends of so many areas.

  • programming in general
  • USB-programming (user-space using libusb)
  • userinterface programming
  • threads
  • math
  • signal processing
    – and so on. So if you need a hobby this is as good as any…

I think we should wait until we have some kind of a runnable version.

Other big area where I would need help is to make the configure.in and automake.am and other autotools stuff so that this program can be compiled on different Linux distributions.
Leaning those and making necessary files will take from me 1-2 weeks.

As I told I have basic communication sorted out. This is done with C. I plan to reimplement with C++.
I can send this over to you if you mail me.
I am now working with the userinterface made with QT. And it is taking more time that I thought.
I can send the old version over.

I think we could put up a project page in source forge, when we have

  1. scope can show wave on the screen
  2. function generator can output the three basic waveforms.

The biggest problem for me now is the UI and howto link that to communication part made in C.

Also as I told I am not a professional programmer the architecture of the program is probably not optimal. I hope that when the first version is out, someone system architect in profession will chime in and give comments. I am prepared to rewrite this program 2-3 times to get the architecture right.

Best Regards
Kari

Kari,

Would you like me to set up the sourceforge project?
Since you are the guy who did all the work, you should name the project.

/Lars

Hi Lars,

thank you for the offer. That should help. I am not very well versed in the HTML and SourceForge. Also I have to learn the SourceForge version control system It would be good idea if you took care of the SouceForge side of things and give me one page instructions what to do and what not to do :slight_smile:). Let’s get familiar with each other by private mail klaine8@gmail.com .

Status of the user interface
I now have got another version of the user interface coming up. When I have it done I will post it to QT-mailing list for comments and hopefully for suggestions how to make it better.
I think I am able to make this posting this weekend. If I get feedback then I redo it next week. That should be the interface for some time to come.

After that I redo the communication part with C++ to make it easier to integrate with the user interface.

My time table is to have first version available mid January 2010…maybe earlier… we will see.

For the heck of me I don’t know what this project should be named… I think it can not contain pcsgu250 or Velleman or part of them in name because this is not their official project.
Although I am willing to have Copyright By Velleman - licensed GPL 2 or later in the README file. Maybe you can come up with good name? How about Scope :slight_smile:)

On the credits side I want to include that one dude who is responsible for the Windows-version - he has helped immensely. I will ask him.

Best Regards
Kari

Hi All,

I don’t have this new scope, but I got the old K7103 for many years now. There is a sourceforge project for this scope.
it can be found at k7103.sourceforge.net/

This project has allready a user interface and for instance the Fourier transformation.

This program is written in Pascal with the Free Pascal Compiler and the Lazarus RAD IDE to design the graphical user interface. Both run on various operating systems including Linux and Windows as well as on various platforms (i386, x86_64, ARM, …). With Lazarus you design an application once and can compile it anywhere. It wraps the visual elements and provides interfaces to GTK1, GTK2, Qt, Windows, …

maybe you can learn from this project.
btw. I’m not one of the programmers. I’m just a user.

Kind regards,

Joris Weijters

[quote=“molekuul”]Hi All,

I don’t have this new scope, but I got the old K7103 for many years now. There is a sourceforge project for this scope.
it can be found at k7103.sourceforge.net/

This project has allready a user interface and for instance the Fourier transformation.

This program is written in Pascal with the Free Pascal Compiler and the Lazarus RAD IDE to design the graphical user interface. Both run on various operating systems including Linux and Windows as well as on various platforms (i386, x86_64, ARM, …). With Lazarus you design an application once and can compile it anywhere. It wraps the visual elements and provides interfaces to GTK1, GTK2, Qt, Windows, …

maybe you can learn from this project.
btw. I’m not one of the programmers. I’m just a user.

Kind regards,

Joris Weijters[/quote]

Hi Joris,

thank you very much for this link. I can read Pascal but I am probably not able to take this project and make a version for the pcsgu250. But I will certainly have a look. You are a second person recommending Lazarus and OpenPascal… there must be something in it.

Best Regards
Kari

Hi

I’m looking forward to buy a PCSGU250. I’m running Linux (Ubuntu 9.04 amd64).

Greetings to klaine8 for trying to provide poor linux users an usable interface for the PCSGU ! Any news from your effort ?

I just have tried to launch the PClab2000LT software (available in the PCSGU250 product page) with Wine and found that it works ! (well, the GUI appears and i can move cursors and click on things without crashing :astonished: )

Could anyone who owns a PCSGU250 try to launch the software with Wine?

If it were reported to work i would buy this super scope and could help you with debugging the linux version !

thanks all

Hello, me too post. I’d love to buy the pcsgu250, especially if there were a native linux GPL app for it!

I offer for debug too

I might go to the shop one of these days with my laptop and ask to see if PcLab200LT in wine detects the scope