Pages: 1 [2] 3   Go Down
Author Topic: New oscilloscope for arduino (linux-only for now)  (Read 5504 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I did some upgrades to both sketch and UI and this is how it looks right now. Changes are not yet pushed to github.



New features:

* Single shot (triggered) - nice to observe transients.
* Freeze/unfreeze.
* Dual channel (YEAY!). A-B-A-B sampling method with trigger support on channel 0. Will work on full-frame A-B later, A-B-A-B has some drawbacks at low prescale values.

What you can see on this specific screenshot is a triggered sample (frozen) of arduino PWM output set at 190, and a 9.63KHz sinewave generated by my function generator. As 9.63 is slightyly above nyquist frequency [1] (depicted as fMax/chan since we use two channels) you can easily see the aliasing. I'm planning to add windowing functions [2] later to filter this out. I already have a somehow working frequency analiser using FFTW3 also. When it's ready I'll post and upload.

Comments and sugestions ?

selfonlypath: I'm still working to get you a Mac OS X version. Only a small problem yet which should be overcome this week. I'll let you know.

[1] http://en.wikipedia.org/wiki/Nyquist_frequency
[2] http://en.wikipedia.org/wiki/Hamming_window#Hamming_window
Logged

Boston
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino design
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alvaro -

Is there some way to compile your gtk+ oscilloscope program for Windows ?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there some way to compile your gtk+ oscilloscope program for Windows ?
Yes, think so. You'll need some extra DLL to run, but I'll try to build a version for you.

I just have to figure out first how I can access the USB serial device, but should not be very hard.

Álvaro
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, my friends.

I have spent weekend mocking up a java version of the scope for you to enjoy. This reminded me how much I hate Java btw smiley

This is only a preliminary version - it does not yet support all features - only trigger level, holdoff, and dual channel.

Dual channel has a bug -  the first one (or two?) samples of the second channel belong to the first channel. This is hard to overcome because there is some latency changing channels and we always trigger on the 1st channel before swithing to second, whose sample only comes 2 ADC cycles later. I'll work on it when I have time.

This should work in Linux, Windows, and MacOS.
You should have arduino java interface installed, you'll need some files from there.

(1) First, download the .jar file and the "run.sh" or "run.bat" script here:

http://www.alvarolopes.com/resources/oscope/

(2) Save them in some folder.

(3) Now, scan your arduino (not sketchbook, the place where it is installed) for a file named "RXTXcomm.jar". Copy this file inside the oscope directory you created on step (3)

(4) Now, depending on your system, you'll need a .so (linux), .dll (windows). This file is named  librxtxSerial.so (linux) or rxtxSerial.dll (windows). Copy this file also to folder (2). Not sure about mac here. In doubt, see RXTX homepage (www.rxtx.org).

(5) Connect your arduino and upload the sketch.

(6) Start application by calling "run.sh" or "run.bat". Or alternatively do
Code:
java -jar arduino-oscope.jar
.

(7) Select serial port from the menu.

(smiley-cool Play smiley

Please send me some feedback and bugs you find. Either here or use email " alvieboy at alvie dot com ".

Álvaro
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have not received any feedback yet, are you able to run it at least ?

Just found some page about a PC oscilloscope that has a number of interesting features:

http://www.accimt.ac.lk/electronics/PC%20based%20Oscilloscope%20-%20Information.pdf

I think most of them are feasible for arduino oscope. What do yout think of it ? And what you think are the most interesting features on that list ?

Álvaro
Logged

Boston
Offline Offline
Newbie
*
Karma: 0
Posts: 36
Arduino design
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Java version runs fine on Windows XP.  I'd be curious to see how the Java source compares to your previous C++ version.  I've been using Processing and NetBeans to work on my "stripchart" like Oscope program.  That at least allows running a debugger.

I'll read your ref when I get some more time.  A software Oscope program can do all sorts of things.  Depends on what one is wanting to measure.  I'm interested in plotting out robotic states (position, velocity, current etc) and then trying to figure out how they are related (ala Matlab kind of things).  Could scripting computations be done with something like SciLab maybe?
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For Mac users, I've had some private mail exchange with Alvaro plus found some other info in the web. I'm still not able to have arduino scope fully work but feel maybe best start a specific thread for Mac users.

Alvaro, let me know if you prefer Mac questions on your thread so i'll paste back my post from new thread I'm about to initiate.

Muito obrigado
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'd be curious to see how the Java source compares to your previous C++ version.
Everything's on github:

http://github.com/alvieboy/arduino-oscope

The Java version was written entirely by hand, but you should be able to use at least Protocol on your designs.

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
(4) Now, depending on your system, you'll need a .so (linux), .dll (windows). This file is named  librxtxSerial.so (linux) or rxtxSerial.dll (windows). Copy this file also to folder (2). Not sure about mac here.
For Mac, the file is named librxtxSerial.jnilib and so far, i've installed the complete RXTX set via this link http://www.efianalytics.com/TunerStudio/mac/MacInstructions.html but maybe it is not latest java version libraries !

Quote
hey Alvaro, the way I understand your project but i could be wrong:
- free Running-mode ADC totally independent of the way you'll transfer the samples to a computer via USB
- a specific arduino sketch to capture the ADC samples via ISR management so the samples are stored inside arduino local memory
- a special fast transfer protocol to send samples from local arduino memory to a computer via USB
- miror protocol on the computer able to decode protocol then display nicely on the screen a scope like
so there are 4 distincts modules.
I suggest you create a new sketch with 3 parts clearly isolated or software modular:
- ADC self-triggering capture and ISR management
- protocol transfer of samples stored locally into arduino
- commands and controls of ADC parameters
so it is possible to clearly isolate the arduino sampling function or routines whatever protocol type being used to communicate with a computer (PC or Mac or ...) via USB

« Last Edit: November 13, 2009, 12:20:59 am by selfonlypath » Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Max sampling speed is maximum ADC sampling speed in Free Running Mode - which is 13 ADC clock cycles + 1 for the self-trigger. If you use the max. prescaler (128) you get an ADC clock speed of 125KHz. This makes about 9Ksamples/second. Doubles whenever you divide the prescaler by two (meaning a prescaler of 64 will give you almost 18ksamples/s). See page 254 of ATMEGA datasheet for more details.
Are you sure Free Running mode uses 13+1=14 cycles because diagram on page 255 shows 13 cycles !
Why is there one cycle lost by self-triggering on Free Running mode ?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a comprehensive explanation on how to install and use this? It looks promising but I am unable to get it working. My operating system is Linux, Ubuntu 8.04
TIA

SubMicro
Logged

SubMicro
Electronics newbie & Home Machinist

0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Are you sure Free Running mode uses 13+1=14 cycles because diagram on page 255 shows 13 cycles !
See table 23-1. Auto-triggered conversions. Conversion time = 13.5.

Quote
Why is there one cycle lost by self-triggering on Free Running mode ?
See Figure 23-6 in page 254. I think is due to prescaler reset, but not sure.

Álvaro
Logged

France
Offline Offline
Sr. Member
****
Karma: 0
Posts: 262
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How do you understand the sentence "Switching to Free Running mode (ADTS[2:0]=0) will not cause a trigger event, even if the ADC Interrupt Flag is set." on page 266 ?

Figure 23-7 on page 255 really shows only 13 cycles per conversion on Free running mode so Free running might not be related with auto-triggering since no trigger event will be generated !

This poses the question about your software on how it really handles trigger.

I might be wrong but just trying to understand the spec of Free running mode smiley-sad
« Last Edit: November 23, 2009, 03:43:02 pm by selfonlypath » Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what kind of probes are required?
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 126
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How do you understand the sentence "Switching to Free Running mode (ADTS[2:0]=0) will not cause a trigger event, even if the ADC Interrupt Flag is set." on page 266 ?
Means that you have to start sampling by yourself, in case your trigger (on this scenario, the ADC own "sampling end" signal) does not come after you enable the free running mode.
Quote
Figure 23-7 on page 255 really shows only 13 cycles per conversion on Free running mode so Free running might not be related with auto-triggering since no trigger event will be generated !

I'll reply soon to this. I'll explain some stuff in detail, like why 962 samples, how timebase is computed, how dual-channel works and how can it work otherwise, why only 16 prescaler for now. Cause now I'm sleepy. smiley

Best regards,

Álvaro
Logged

Pages: 1 [2] 3   Go Up
Jump to: