Go Down

Topic: VGA Interface (Read 5795 times) previous topic - next topic

Crowe T. Robot

I'm incredibly new to electronics in general, but am a pretty snappy coder.  I'm having some trouble though making the jump from an all software background to a now hardware environment.

I have been looking _everywhere_, but I can not find anyone who has successfully interfaced the arduino with a standard VGA monitor.

I don't know if this means it can't be done or simply no one has bothered to try.

A few concerns:
1. I believe the VGA RGB values are analog values.  Can these be accurately output by the arduino's PWM?

2. For video memory, if I want to display a color image on an 800x600 resolution, are my calculations correct that I would need 3 x 8 bits of data for each pixel?  That's a ridiculous amount, about 12mb.  Am I thinking of this wrong?

3. In order to sync with the video data, is the arduino simply fast enough?  I don't need blazing graphics, or even fast scrolling... I just want to display crisp text onto the screen.



Any ideas on how to proceed?  And please keep in mind, I'm inexperienced, so I may have misconceptions of what is required (even on the apparently most basic levels :D ), so if I'm incorrect in an assumption, please tell me (and hopefully offer a tid-bit of wisdom).

Thanks in advace.

Crowe T. Robot

Hrmm, couldn't edit my post.  But, anyways.

I was thinking.  I was also reading around and seeing there were some parallel (not specifically dual core) arduino configurations.  Filling the pixel data for the display, I think, would be a hefty task.  If it would require too much power from one, do you think it would be possible to have one driving the VGA memory while the other one read it and displayed it on the screen (one lagging slightly behind the other).

I guess that's one of my major questions, is that: Coming from a PC coding environment, I have NO clue how powerful the arduino can be / what its limitations are.  I'm hoping some of you can enlighten me :)

kg4wsv

The Arduino won't drive VGA directly - not enough horsepower.

To put it in perspective, folks who want to drive NTSC with the arduino are having trouble, and VGA is a lot more resource intensive than NTSC.

Your best bet is to find some VGA driver peripheral, and use the Arduino to drive it.  I have no idea if such a beast even exists.

-j


Crowe T. Robot

Damn :(

Thanks for the help.  I was reading an interesting thing about using an FPGA to drive a VGA.  Might look to getting one of thems.  But they are kinda pricey.

kg4wsv

They're pricey, but  they're slick.  I've done VGA on a couple of Altera boards (or was one CGA?)   I've got a DE2 on my desk right now.  The combination of FPGA and the VGA DAC onboard makes it relatively easy. The basic clock rate for the VGA chip on the DE2 board is 25MHz; the 16MHz Arduino can't even generate a sync signal, much less have time to do anything interesting.

I think the Altera DE2 is in the neighborhood of US$300.  Even if it's out of the budget, you can get the docs, look at the schematic and get the specs for the VGA driver, and maybe find a cheaper FPGA (I think sparkfun even has some mounted on breakout boards).

If you can live with black and white NTSC, there's the MAX7456 on screen display.  The IC is a bit pricey and surface mount (hints: samples and Sparkfun adapter boards), but a few folks have interfaced it with the arduino successfully.  It can overlay a video source or generate its own black background.

-j


Oracle

How hard would it be to use an ISA framebuffer video card from the early 90's?  The ISA bus was parallel (though only 8 or 16 data bits), so you'd need some form of IO expansion.  I'm not even sure it's possible on an arduino but it might be fun to try.

The original PC was a 4.77 MHz core and could drive at least a CGA card on the ISA bus.

kg4wsv

Quote
The original PC was a 4.77 MHz core and could drive at least a CGA card on the ISA bus.

Yeah, but all it did to "drive" it was to pass data off to a frame buffer and let a dedicated circuit (i.e. the graphics card) worry about generating sync, displaying data, etc.  And CGA is a simpler than VGA to generate.

I did see where someone took an Atmel microcontroller of some flavor and drive an ISA ethernet card with it, so you may be able to do something similar with graphics.

-j


Oracle

My first VGA card was definately in my XT, so VGA did work on 8-bit ISA.  I was trying to remember when I posted the last message.

And what I was saying was not that the Arduino can do the VGA natively because the XT had VGA, but the Arduino  should be able to use an ISA VGA card and pass off the frame buffer and allow the graphics card to worry about generating sync, etc.

kg4wsv

Quote
... but the Arduino  should be able to use an ISA VGA card and pass off the frame buffer

Gotcha.  I agree, that may be within the realm of possibility.

But you'd have to find an ISA VGA card...

-j


westfw

It's possible:
 http://www.circuitdb.com/show.php?cid=69
(16MHz ATmega16 driving 20 character*20 line display, using no additional "active" hardware.  This is raw hand-crafted AVR assembly language rather than arduino code, but it's a good demonstration of what sort of thing is possible...)
You wont get full VGA resolution, of course (but the above is WAY impressive!)

However:
Quote
1. I believe the VGA RGB values are analog values.  Can these be accurately output by the arduino's PWM?

no, it will need true analog values.  Or you can get some limited colors by driving the VGA pins with digital values.  The example cited above drives 0/1 on all three pins simultaneously, so it's just black/white.

Quote
2. For video memory, if I want to display a color image on an 800x600 resolution, are my calculations correct that I would need 3 x 8 bits of data for each pixel?  That's a ridiculous amount, about 12mb.  Am I thinking of this wrong?

Nope.  That's about right.  note: 12Mbits.  Clearly you don't get a full res display from an arduino with 160kbits total of memory...

Quote
3. In order to sync with the video data, is the arduino simply fast enough?  I don't need blazing graphics, or even fast scrolling... I just want to display crisp text onto the screen.

It looks (from the example) like the arduino is about fast enough to put close to 200 dots across the screen in each scan line, when the VGA monitor is in its minimum resolution mode (640x480)

Crowe T. Robot

Quote
But you'd have to find an ISA VGA card...


Might not a problem.  I'm holding in my hand a Paradise EGA 8-Bit ISA graphics card.  The problem being ... I don't have a friggin EGA monitor laying around!  Lol.

I have to look around... I know I have an 8-Bit ISA VGA card around here somewhere...

The question still remains.  What do I do with it once I find it?  Being so damned old, I doubt I'm going to be able to find much information on it, let alone schematics or pinouts.  So how does one go about figuring out which data pin does what?

I mean, I can find this: http://upload.wikimedia.org/wikipedia/commons/3/3d/XT_Bus_pins.png

But without reference specifically to this hardware, I don't know how one would go about using this.  This may be beyond my current skill level to do.

...

However, Thank you very much for the interesting VGA Arduino hookup that you posted.  An unfortunately low resolution, but it is better than nothing at this point.




Thank you for all your help fella's, truly a helpful bunch here.

agent smith

I thought about something more powerful (like ARM boards with embedded Linux like the NSLU2) with a DisplayPort USB-VGA adapter or monitor. Too bad the company didn't release a linux driver....

I guess it's easier to get an EeePC (so cheap and small) and then interface it to the Arduino...

Oracle

I'm nearly 100% sure I still have my ISA VGA card lying around somehwere, but I'm only 50% sure I could find it in less than 6 hours.

If I did use it, it would be my most expensive Arduino accessory at about $650 in 1989 dollars.   It was an ATI VGA VIP board, and one of the earliest VGA boards made.

I just checked ebay, there's a bunch of VGA ISA boards in the $1 range (and yet a handful in the $100 range -- why do people waste their listing fee?).

drspectro

I do think it is possible to do color output to a CGA monitor by modifying the NTSC video code.    That would top out at 240 lines split up in 38x28 pixels.  There is plenty of room in the NTSC video buffer for 4 bits/pixel.  I just picked up a CGA monitor to try this out on.  

A lot of VGA monitors will support CGA TTL input, but the pinouts vary a lot.  I am not sure if "standard" VGA will support this but I know the "multisync" monitors did.  I want to try it out on a monitor that I am sure where the TTL pins are first...

I'm not sure if this is an illegal "cross post' but the NTSC code is here.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231475982

retrolefty

Not a real cheap product but the below allows one to drive a VGA monitor using simple serial data from a micro-controller. I guess if the application really requires the size and resolution it's a cool solution.

http://www.sparkfun.com/commerce/product_info.php?products_id=8541

Lefty

Go Up