Turn your Uno into a VGA output device!

Maybe I'm completely wrong but: It is not possible to use a screen with buffer???
Something like the latch on 75HC595 Shift register IC. So you put in the buffer what you want to write, then activate the latch pin, and there is no need for refresh unless you need to change what is shown on the screen.

A screen like this will be perfect, because you can use relative big screens/resolutions with the Atmega IC's without overloading.

This was mentioned in a post above, but I want to ask the same question again, regarding combining Nick's work on generating sync (which seems to consume most of the cycles of an UNO and Sebastian Tomczak's work ( little-scale: Hacking VGA lines with Arduino ) which results in a very rudimentary but very cool "video synth".

Sebastian was grabbing his sync from an external source (in his demo he is using the signal from a computer).

So if one used a second UNO (or similar) could one use that to generate the RGB signals (which are actually being generated from an audio input source in Sebastian's project) and combine that with the sync being generated with Nick's project (on the first UNO) and merely "splice" the signals together at the actual cable socket?

Or better yet, could it all happen on one Arduino? I doubt that given the timing tightness being described, but even if I had to run it on two boards... I have a few laying around, and it would make a cool little AV synth.

Any thoughts?

Hi nick...i'm trying to figure out how to overlay some text on a vga signal....if i understood well just need to detect the vertical sync, count horizontal sync pulses and out some text (video sygnal) over the actual signal on the right time...is this correct?...how can I do this? could you give me some ligth on it?...I don't understand the screenfont.h format...how can i distiguished a single letter from this code?...(sorry for my english)

Nice work,
Quite Helpful too :slight_smile:

Thank you Nick,
your site is awesome, explanatory kind of "makers" experience.
I have just made some experiments with your code, I'd will dig through to
modify it for my project's purposes.

Thank you so much for sharing it!

EDIT:
I spent some time with your code (and description) and I could not get gotoXY work properly.
I'm sending data from other arduino and I wanted following:
CLRSCR
GOTOXY 5,5
print some text

So I used several variation of

char xy[] = {5,5};

 sendString (clearScreen);
 sendString (gotoXY);sendString(xy);
// sendString (strcat(gotoXY,xy));
// sendString (gotoXY+xy);
//   etc...
 sendString ("Hi!\n");

Could you please point me to some good and working solution to that? Thx.

McHa

Hey @Nick Gammon How can i increase the font size from 8X8 to 8X12 ?
Please reply....

I suppose you would change the font definition:

byte screen_font [8] [256] PROGMEM = {

Go from 8 rows to 12 rows. Then you need to re-make the fonts from scratch. And change the part where it copies the font data to the screen to allow for sending 12 rows rather than 8.

VGA library - now with TV output

http://forum.arduino.cc/index.php?topic=150517.0

Gee thanks Nick!

Now I have quit procrastinating and repair my spare 19" Flatscreen.

I really want to try you project. I have a few interesting ideas and will soon have 4 Arduino UNO3 to work with.

I may end up offering a Shield on Ebay, supporting VGA and interfacing with 3 UNO3's. If I do, I'll send you one free.

Keep up the good work.

Thanks for the challenge.

Hey , just came across this Papilio VGA shield.

http://www.robotshop.com/productinfo.aspx?pc=RB-Spa-805&lang=en-US

Not bad, it's exactly the same, except on a nice little breakout board.

The code they link to looks nothing like mine, but the PCB looks like it might bring out the connections and the resistors nicely.

McHa:
I spent some time with your code (and description) and I could not get gotoXY work properly.
I'm sending data from other arduino and I wanted following:
CLRSCR
GOTOXY 5,5
print some text

Could you please point me to some good and working solution to that? Thx.

McHa

This is working for me:

 char gotoXY [] = { ESC, GOTOXY, 1, random(29) };
  sendString (gotoXY);
  sendString ("Hello");

I hope that helps. I'm feeling around in the dark myself!

Thanks for all this Nick. After many long nights of fumbling around in the dark — with several video and VGA out libraries — I finally go this working.

Despite it's simplicity, I'm hopeful that it will fit the bill — finish line placings display for a Pinewood Derby racetrack. I'll let you know if it all comes off!

Beardy241:
Thanks for all this Nick. After many long nights of fumbling around in the dark — with several video and VGA out libraries — I finally go this working.

Despite it's simplicity, I'm hopeful that it will fit the bill — finish line placings display for a Pinewood Derby racetrack. I'll let you know if it all comes off!

Hi,

Sounds interesting.
Can you share your sketch finally?
Thnks.

@2leon76 — Still working on it — it's a bit of a mess!!

@Nick Gammon
There's been some pulling out of hair here! Over the last couple of months I've been working on the various sub-systems for my Pinewood Derby Car Race Control setup — and progressively, each part came good.

Last weekend, during the process of putting everything together, the whole lot fell apart. Disaster! After through-the-night troubleshooting I eventually got the project back on track - so to speak - apart from one nasty bug. Every time the text-sending Arduino issued a sendstring command the display placed a spurious character at the start of the string. It started out as a white on black bullet point.

Going back to your sample code eradicated the problem so I figured the problem was on the text sending end.

I began hacking at my code wildly — starting by commenting out everything that wasn't a Wire command. It worked! So I started uncommenting various categories of code - like servo commands, button code etc. E v e n t u a l l y … it came down to the button!!

I have one button to control the system — press it to start the race, press it again to reset everything for the next race. I wondered if it might be a conflict with the pin I was using. This is when I discovered that changing the pin changed the spurious character! Huh!?

After much head scratching, this is what it comes down to…

When I do this…

int buttonPin = 2;

void setup () 
{
  pinMode(buttonPin, INPUT);      /// race control button
  digitalWrite(buttonPin, HIGH);  /// internal pullup resistor

  Wire.begin ();
  TWBR = 4;   // fast .. fast .. I2C : 16000000 / (16 + 2 * 4) = 666666 Hz
}  // end of setup

I get spurious characters appearing at the start of every sendstring.

Removing the buttonPin variable…

// int buttonPin = 2;

void setup () 
{
  pinMode(2, INPUT);      /// race control button
  digitalWrite(2, HIGH);  /// internal pullup resistor

  Wire.begin ();
  TWBR = 4;   // fast .. fast .. I2C : 16000000 / (16 + 2 * 4) = 666666 Hz
}  // end of setup

… everything plays nicely!

Yep. Assigning the button pin by number, rather than by variable, sorts everything out!

Has anyone else experienced this — or am I 'special'!? :stuck_out_tongue:

I'll take this opportunity to thank you again for the whole VGAout thing — it's brilliant (in a wonderfully retro way!)

kr Marcel

addendum to the above…

Now I apply the 'fix' to my project code rather than the basic test code the spurious bullets are back! This time black on white!

I'll let you know what happens.

Nick,
I tried your mono text driver and it works well, however I am trying to get the display to scale to 128x72, and although I have been able to get output, it does not look like the display will scale correctly on other displays.

Changing the line:

const int horizontalBytes = 20;  // 160 pixels wide

To:

const int horizontalBytes = 16;  // 128 pixels wide

...In the code you had posted decreases the number of bytes, but I think the issue is that there are 16 clock cycles per 8 pixels, and I would need to adjust that .

If I understand your formula correctly for timing it is:
125 * 20 * 8 = 20000 nS (20 uS).

...So to output 16 bytes it should be:
If I understand your formula correctly for timing it is:
125 * 16* 8 = 16000 nS (16 uS).

It might be though that 120 is more ideal than 128, as it is an even unit of 480, and it would be better to target that output resolution, and use 4x wide "pixels" instead of 3x wide "pixels"?

I don't know if you can easily achieve that. The ratio of 16 clock cycles per 8 pixels is because the hardware clocks out SPI at CLK/2. If you changed that (eg. CLK/4) you would get 32 clock cycles per 8 pixels.

See further down the page on my forum for the colour version. That uses a tight loop to clock pixels, but I only got 60 pixels horizontally that way.

Nothing much further to report apart from my Pinewood Derby Car racetrack had its first outing last weekend and it worked pretty well!

As for the VGA output, it was good but every time my code issues a GoTo command it deposits a bullet point on the screen!

Has anyone else come across this?