Thursday, April 02, 2009

How to: Use Arduino to Generate Glitchy Audio VGA Visuals


This post is a guide for people that are interested in my previous posts about dual monitor VGA hacking (see 1, 2 and 3).

You will need:
• A laptop or a computer with a VGA output
• A breadboard (optional) and some wires or a strip board for soldering
• Wire and breadboard jumpers (optional)
• 2 female VGA connectors
• 1 male VGA connector
• up to 3 lots of 15x1 or 15x2 pin headers (optional)
• An Arduino, Picaxe or other microcontroller with an onboard ADC or a standalone ADC
• Audio cable and connector
• 1 or 2 CRT or LCD monitors

Hardware Setup:
The idea here is to connect the horizontal and vertical sync signals from the computer / laptop to the other monitors. However, the actual RGB data lines will be controlled by the Arduino / µC / ADC. You can see the pinouts for the VGA ports below (taken from pinouts.ru).

So, either solder or breadboard up some connectors!

From the VGA output of the computer / laptop to the first external monitor, connect pins:
4, 5, 6, 7, 8, 10, 11, 12, 13 and 14.

From the first external monitor to the second external monitor, connect pins:
5, 6, 7, 8, 13 and 14. Then connect pin 1 of the first external monitor to pin 2 of the second external monitor, pin 3 to pin 2 and pin 2 to pin 3. By changing this mapping, you can change the way the colour of the second monitor looks like compared to the first one.

For my setup, I used an Arduino board. So I took an audio signal and connected the signal wire to analog pin 0 and the shield to Arduino ground. I also connected Arduino ground to pin 5 of the VGA connectors. Then I connected Arduino pins 4, 5 and 6 to pins 1, 2 and 3 of the first external monitor connection.

Also, for my setup, I basically made up three little jumper boards with pin headers that connect all fifteen VGA pins to the breadboard. Then it was simply a matter of using breadboard jumpers to connect each appropriate pin to the other - easy!


Software Setup:
All that is happening with the software is that the Arduino or whatever is doing a digital conversion and then setting an output digital pin port to the lower 8 bits of the 10 bit data. That's all!

The code is as simple as this:


void setup() {
DDRD = B11111111;
}

void loop() {
PORTD = analogRead(0);
}


Of course, you can edit this an muck around with adding delays etc to get different effects and so on.

7 comments:

Alex C. Weiner said...

this looks pretty cool man. i wanna do this. can you maybe take some pictures of the wiring you did. i'm having a little trouble understanding what you did. are you connecting 2 monitors in series?

anderp h said...

Trippy! i did it and it was cool - but now you need to work out how to get the arduino to generate the hsync/vsync too so i can have an all-in-one solution :)

roscoe said...

Hi
I love your work man, this hack looks awesome, I would like to give it a try but I am real novice when it comes to arduino and breadboards! can you post a picture of the wires connecting & set up? that would help me so much
all tha best
roscoe

djpulseboy said...

Just wondering, is it possible to use a projector to project on a wall?

Wout said...

Hey thanks for this tutorial, we tried it on a workshop and it turned out great: http://vimeo.com/7160664

However, we had the hardest time understanding what exactly the arduino was doing. Is that assembler code or something?

jangdan said...

Cool! I have a computer monitor that nobody uses so I would like to hack this.

But Its hard to undue stand the wiring. Can you take pictures of the wiring, or, even better, a schematic?

Anonymous said...

http://www.gammon.com.au/forum/?id=11608