Pages: [1]   Go Down
Author Topic: How can I read VGA signals w/ an Arduino?  (Read 1732 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 0
Posts: 297
Arduino rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to know if it is possible to read the signals coming out of my computer's VGA connector using an Arduino UNO R3 or Arduino Mega R3 running at 16MHz. I want to read the signals so that my μC can correct typo's and such while I type on my keyboard and also act as a stepping stone for me to better understand how VGA commutation works.

(Example: I type the following: "can i type this."  Once I stop typing, the μC corrects the typo(s) to this: "Can I type this?")

I recognize I could just read the keystrokes but the reason I am doing this is so I can get some experience in some areas I have never touched up on before.

So my question is this: "Is an Arduino running at 16MHz fast enough to read the color of only one pixel on the entire screen running @ 16bit color w/ a resolution of 800x600?"
Logged

As always... Thanks for posting!!!

Holland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
Troubles are there to be solved!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i searched on the net because i'd like to know the awnser myself.
i found wikipedia page for vga and the interesting stuff wich we're looking for is listend under 'technical detials'->'Signal'

there are two table's:
the virtical timings
& horizontal timings

note that all detials are for: 640×480@ 60Hz non-interlaced
the frequenty's are
Horizontal frequency 31.4686 kHz
Vertical frequency     59.94      Hz

so i would say yes, based on this information i suggest i'd be okay.
the next question now would be: how about 800x600 pixels..

well, i dont think that the frequnties would raise more than 100%, but even if they did.. the frequenties would be like 60kHz × 100 Hz, i think it should not be a problem (correct me if im wrong, i just looked into it i have no expertise on this..)

nick
Logged

humankind cannot obtain anything without
sacrificing something of equal value.

Offline Offline
Sr. Member
****
Karma: 0
Posts: 297
Arduino rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks nick...
Logged

As always... Thanks for posting!!!

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8443
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I can see no way to do this with an Arduino, you not only have to read the high-speed analogue signal in real time but you have to decode that into characters then lookup a dictionary/thesaurus/grammar checker.

All with a 16MHz 2k RAM processor.

You do the maths smiley

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8443
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll believe you about the dot clock being 60kHz (I'm too lazy to work it out myself), and I guess the VGA is digital so you don't have to do analog readings, but you still have to save and re-align the bit patterns (because a character is spread over several scan lines), decode the patterns to get characters, then do all the dictionary stuff.

EDIT: Doh, how can the dot clock be 60kHz, that's the refresh rate. (Previous post where someone said the dot clock was 60kHz has been removed)

______
Rob

« Last Edit: May 26, 2012, 05:53:21 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31448
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So my question is this: "Is an Arduino running at 16MHz fast enough to read the color of only one pixel on the entire screen running @ 16bit color w/ a resolution of 800x600?"
And my answer is no way is it fast enough or has enough memory or processing power.
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 297
Arduino rocks!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was thinking that too...
Logged

As always... Thanks for posting!!!

Holland
Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
Troubles are there to be solved!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i geus it should be fast enough, i mean, why not? the frequenty is way below the avg frequentie right?
but if you look into how to procces those damn singals with an atmega328, than i would say: its not even worth trying..

i belive its way too much data to be dealing with combined with an atmega328
Logged

humankind cannot obtain anything without
sacrificing something of equal value.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31448
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i geus it should be fast enough, i mean, why not? the frequenty is way below the avg frequentie right?
No it is not fast enough.

You have to look for a line sync pulse, then you have to delay by a precise amount, then you have to capture the pixel.
Lets suppose you want to capture a whole line.
First you wait for the frame sync pulse, then you have a short delay and then take 640 digital samples and put them somewhere. This requires quite a lot of memory, processing power and an external digitiser.
What you can do is sample one pixel per line in the same X position, this gives you 480 samples and a bit of time to store them somewhere. You still need an external flash A/D converter.
Way back in the 80's I made several TV video digitisers using this technique. With one column taking one frame to sample the 640 samples at 60 frames per second will take 10.6 seconds to read in a whole frame. Assuming you have external memory to put it in and some time to do the actual processing, your response time would be quite slow.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24329
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
note that all detials are for: 640×480@ 60Hz non-interlaced the frequenty's are Horizontal frequency 31.4686 kHz
Back of a beer mat calculation:
31.4686kHz gives a line time of a little over 31 microseconds.
Ignoring blanking, this gives a minimum pixel period of 31us/640 = 49 nanoseconds.

And that's ignoring blanking, remember.
From memory, the dot rate is about 25MHz for VGA at 60Hz.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Cumming, GA
Offline Offline
Edison Member
*
Karma: 18
Posts: 1627
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I would think that even my 3Ghz Windows 7 Machine with 4G ram  would have difficulty with it.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24329
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure about that, given the right hardware.
I've captured VGA on a 1990s 486 PC with the capture hardware on an ISA bus card.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31448
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I captured full video on the first ARM computer from Acorn in the late 80s. It had an ARM chip running at the then very fast speed of 40MHz.
Logged

Pages: [1]   Go Up
Jump to: