Pages: [1]   Go Down
Author Topic: TVout Oscilloscope  (Read 19700 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have just finished a simple Oscilloscope using the great TVout (http://code.google.com/p/arduino-tvout/) library.

It displays the average, the minimal and the maximal voltage, and the sampling frequency. 100 sample points are displayed. The maximal sampling frequency is about 8kHz (on an Arduino Uno).

The input voltage is taken from analog pin A0. Add a button to digital pin 2 to scale the voltage range, and to digital pin 3 to scale the sampling frequency. Note that scaling the voltage range, the oscilloscope will middle the average voltage.

Let me know what you think.

Juerg


* tvoutOscilloscope.jpg (166.81 KB, 640x471 - viewed 346 times.)
* TVoutOscilloscope.pde (6.23 KB - downloaded 195 times.)
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hehe.. did a simple version of this myself but you've taken it to the next level!

I think I may dedicate a 328 to a "permanent" build for this.. still can always ICSP flash with upgrades...
Logged

When the testing is complete there will be... cake.

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 5611
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is a pretty neat application of the TVOut library - I like it. Suggestions for future releases:

1) More speed/bandwidth (may or may not be possible)
2) Allow for negative voltage readings
3) How about a second channel (will reduce sampling speed in half, probably)
3b) Of course, adding things like A+B, triggering and such (just like a real scope)
4) Can the resolution be increased?
5) How about a different scope - a digital analyzer scope?
6) Storage and Recall of sample data?

Anyway - great project!

smiley
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Boston Suburbs
Offline Offline
God Member
*****
Karma: 16
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, we know it can handle spectrum analysis (I did it as a mere light show, but...) by FFT, my spectrum analyzer with tvout project did it.  Add a few labels and it might actually be useful instead of just cute.

The Integer FFT code I lifted from a post and made into a lib for re-use, google Arduino Integer FFT on google code.
Logged

When the testing is complete there will be... cake.

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@focalist: if you make a box for it, don't forget to add some extra buttons for future releases. :-)

yes, adding FFT would be nice.

@cr0sh: thanks for the suggestions.

1) More speed/bandwidth (may or may not be possible)
i know. but it's not possible.
"It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second."

2) Allow for negative voltage readings
what do you mean? just draw a scale from -5 (input=0) to 0 (input=1024)?

3) How about a second channel (will reduce sampling speed in half, probably)
yes, it would be nice to have. and yes, it will cut speed in half.

3b) Of course, adding things like A+B,
yes, that would be possible. are thing like that important? (i'm not an expert on oscilloscope...)

3c) triggering and such (just like a real scope)
the code already has a (simple kind of) triggering: at the beginning, it waits for a while until the voltage crosses from below the average voltage to above the average voltage. what other kind of triggering would be nice to have?

4) Can the resolution be increased?
of the screen? i guess not.

5) How about a different scope - a digital analyzer scope?
how would that work? just display 0 or 1 for different inputs? yes, maybe that would be nice to have. it might even be possible to get higher rates (reading digital is much faster than analog)

6) Storage and Recall of sample data?
yes, that would be nice, but the RAM on an arduino seems to be pretty limited, especially since TVout already takes its part. (i once added another int array of size 100 and TVout didn't like it as i started to write into its memory!) so i guess that will not be possible.


Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14026
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Storage and Recall of sample data?
yes, that would be nice, but the RAM on an arduino seems to be pretty limited, especially since TVout already takes its part. (i once added another int array of size 100 and TVout didn't like it as i started to write into its memory!) so i guess that will not be possible.

In the storage section there is a amazing discussion about fast storing data on SDcard  - http://arduino.cc/forum/index.php/topic,64314.0.html
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 5611
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1) More speed/bandwidth (may or may not be possible)
i know. but it's not possible.
"It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second."

Maybe not with the Arduino alone - but what about an externally clocked RAM (with separate ADC)? Ok - I'll admit I'm not super-serious on this; its well outside the scope of the project...

smiley

2) Allow for negative voltage readings
what do you mean? just draw a scale from -5 (input=0) to 0 (input=1024)?

Well, I mean allow for a true AC signal (from -2.5V to +2.5V) to be input (centered around 0 volts) - what you'd have to do then is bias the signal to raise it above the 0 volt threshold to sample it with the ADC - then alter the display output labels, of course.


3) How about a second channel (will reduce sampling speed in half, probably)
yes, it would be nice to have. and yes, it will cut speed in half.

3b) Of course, adding things like A+B,
yes, that would be possible. are thing like that important? (i'm not an expert on oscilloscope...)

It can be useful in some cases - you can use it for filtering (subtracting out noise and such), or other things like have one channel control the vertical component while the other controls the horizontal (you can then draw Lissajous patterns, which can be used to test components with - if you add on an "octopus interface").
 
3c) triggering and such (just like a real scope)
the code already has a (simple kind of) triggering: at the beginning, it waits for a while until the voltage crosses from below the average voltage to above the average voltage. what other kind of triggering would be nice to have?

Well - allow the user to set the voltage to trigger on, or to set the trigger on positive change vs negative change (or both). Also - if you are doing dual channels, then triggering on one channel while sampling the other could be useful (or trigger on a digital input?).

4) Can the resolution be increased?
of the screen? i guess not.

It just didn't look like you were using the highest res of the TVOut library, but maybe that's just me...

5) How about a different scope - a digital analyzer scope?
how would that work? just display 0 or 1 for different inputs? yes, maybe that would be nice to have. it might even be possible to get higher rates (reading digital is much faster than analog)

Yeah - just look for highs and lows on a digital port (do a port-based sample), and plot each over time as a square wave. Allow for triggering on one or more of the pins (maybe also allow for definable binary pattern triggering)...

6) Storage and Recall of sample data?
yes, that would be nice, but the RAM on an arduino seems to be pretty limited, especially since TVout already takes its part. (i once added another int array of size 100 and TVout didn't like it as i started to write into its memory!) so i guess that will not be possible.

I was thinking of an SD card (as was mentioned), or perhaps using an external I2C/SPI EEPROM or flash memory for such data. It also sounds like with the TVOut library, you're on the edge of what is possible code-wise anyhow (you'd have to work hard to get all of the extra features I noted put into place on it)...
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, that SDcard or external RAM sampling sounds really good, but i must say it is a bit outside of the scope of my little project.

from the other suggestions i might at some point implement some.

Quote
It just didn't look like you were using the highest res of the TVOut library, but maybe that's just me...
ok, maybe i'm just doing something wrong. i don't really know how to increase the resolution. the few higher resolutions that i tried all resulted in no picture at all on my old TV. maybe it's my TVs fault?
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14026
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but i must say it is a bit outside of the scope of my little project.
This discussion should inspire you to rise to unknown heigths and a chance on eternal f(l)ame smiley-wink

Seriously, you have created something people like and is really usefull. Use that energy to let your little project grow, but do it in your pace. Take some time to think in what order to take the next steps.

Succes,
Rob

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Montreal
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2610
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote from: wullschj on June 19, 2011, 04:04:33 PM
1) More speed/bandwidth (may or may not be possible)
i know. but it's not possible.
"It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second."

Maybe not with the Arduino alone - but what about an externally clocked RAM (with separate ADC)? Ok - I'll admit I'm not super-serious on this; its well outside the scope of the project...
You could increase bandwidth up to 20 times ( 6 usec/sample ) if you replace analogread
( 120 usec/sample ) with direct access to ADC registers. Look at:
http://oscilloscopeexpress.blogspot.com/

Plus it will allow you to change bandwidth ( time per division ) settings.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You could increase bandwidth up to 20 times ( 6 usec/sample ) if you replace analogread
( 120 usec/sample ) with direct access to ADC registers. Look at:
http://oscilloscopeexpress.blogspot.com/

Plus it will allow you to change bandwidth ( time per division ) settings.

Thanks a lot, Magician! that code works great. I realized that it is in fact possible to read even a bit faster by starting the ADC as soon as the last value is read out, so we have to wait a little less before the next value is ready.

Here is an updated version of the Oscilloscope which can sample at a speed up to 140kHz. At higher frequencies the readings are a bit less accurate...

Juerg


* TVoutOscilloscope.pde (9.45 KB - downloaded 97 times.)
Logged

Brazil
Offline Offline
God Member
*****
Karma: 3
Posts: 626
Beat707.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I love this. I got a unused old TV that I will put just for this and some other Arduino TVOut related projects. ;-) Thanks for sharing!

Wk
Logged


Brazil
Offline Offline
God Member
*****
Karma: 3
Posts: 626
Beat707.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quick question. Any updates on this project? I'm really loving it.  smiley-cool

I wonder on doing a VGA output to add color to this. (will require tons of changes, I know)

Wk
Logged


0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 51
Arduino - I have become the revolution.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sweet!
This is exactly what I was looking for since I just found my old LCD pocket television from the 90's.
Thanks!
Logged

First we ignore them, then we make fun of them, then we fight them and then they win so let's cut the crap and just expose them for the corrupt liars they are.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could someone please help me with this sketch? i want to use another pin to measure the negative voltage so it can display whole sinusses etc.

i have been dragging through the code, but it is not easy readible txt.

what i want to do is convert the negative voltage with diodes to a positive voltage on the 2nd pin. then it is just a matter of making the pixels(y) go negative (y becomes -y)
Logged

Pages: [1]   Go Up
Jump to: