It’s been a while since I updated these VGA experiments. I’ve mainly been working on audio synths recently, but a recent conversation on VJ Forums sparked off a flurry of activity.
Littlescale, aka Sebastian, got in contact after reading the last experiments page. He created some nice visuals using an arduino board to to relay midi messages from Ableton Live, through the digital outputs via a MAX/MSP patch he wrote.
It inspired me to blow the dust off of mine and try a few things out. Firstly i took the RGB led dimmer program from the tutorials and made a few changes, but ultimately it took an audio input, split it into bass mid and treble via an additional circuit and pumped it into 3 of the analogue inputs of the arduino. From there it converted these voltages into PWM signals which normally drove an RGB led, but i patched them straight into the RGB lines of my VGA break out box instead.
The result was entertaining. It produced scrolling lines of color that pulsed on and off, no fading, in line with the peak of the frequency in the color it represented. The more grain per frequency, the more intense the colors became, filling more of the screen, but all mixing with each other to create vivid bands of color in sync with the music, much the same as Littlescales, but much more basic (think Spectrum ZX cassette loading graphics…) and rough looking. On the “Aesthetically Pleasing Scale of 1 to 10″, it scored a paltry 4.
“Where’s the video’s you say?” Aye, good one…. You should know by now that I’m crap at this documenting thing.
I’ve also been using some very buggy code that i wrote for Arduino to produce the Vsync and Hsync signals needed to produce a stable VGA signal. But it wasn’t stable, and it went out of sync very quickly, and i’ve since realised that the Arduino might not be able to produce the clock signals needed due to it’s timing commands. Please feel free to prove me wrong though. ;o)
However… Over the past few nights i did bread board a few things to see what i came up with, and the results were very interesting!
<previous> <next>

November 5th, 2008 - 12:22 am
Hi,
), can you spot an error in mine, or can you show yours? Thanks !
I’ve been reading your VGA experimentations with a lot of attention, since i’m trying to produce really simple graphics with my Arduino (plain colors, actually). I began with borrowing the sync signals from my computer and sending my own RGB signals via 3 PWM outputs. The result was what you described, scrolling lines of pulsing colors. The next try was sending a constant voltage, but it didn’t work : the color would only appear on the voltage’s rising edges. I then started to think about being more respectful of VGA timing, and I plan to dedicate another Arduino only to create sync signals, so below is my attempt. For some reasons, it doesn’t work. I checked my timing with an oscilloscope, and it seems to be pretty accurate. I get some jitter with the Hsync. Since I’ve read that you succeeded in writing a piece of code that works (more or less
// 640 * 480 @ 60Hz
// HSync : pin 7
// VSync : pin 6
//Vpulse, pin 6 à 0V
//Hold à 0V : théorique : 63,55 us
//Fin du Vpulse, pin 6 à 5V
//Front Porch V: théorique : 317,77 us
//Hpulse, pin 7 à 0V
//Hold a 0V : théorique : 3,81 us
//Fin du Hpulse, pin 7 à 5V
//Front Porch H : théorique : 635 ns
//Display Time : théorique : 25,422 us
//Back Porch H : théorique : 1,906 us
//Back Porch V : théorique : 1048 us
int i = 0; // count
void setup() // run once, when the sketch starts
{
DDRD |= B11000000; // it sets pins 2 to 7 as output without changing the value of pins 0 & 1, which are RX & TX
// 76543210
November 5th, 2008 - 12:31 am
Oops, my comment seems too long… You can get my code here : http://olb7.free.fr/arduino/SyncPortManipulation.pde
November 8th, 2008 - 2:08 pm
Hi again !
After some hours of sleep, i ‘m very close to my goal. Vsync is ok, the screen is slowly drifting upwards in 1 min cycle. Hsync was more tricky to debug, but its almost ok. I think I did not understood vga sync as well as i thought, as my Hsync was not running all the time. Thanks anyway for your great works on videosynths !
November 8th, 2008 - 2:33 pm
Hi Dwan,
i was just looking through your code, and to be honest my coding knowledge even in arduino is a little basic, but based on the timing standards for VGA you appear to be close! I’ve been trying to find the one i wrote, but have a nasty habit of not saving things with proper names, its there somewhere….
there is a russian guy who has VGA sync working with the atmega 168 chips, but he’s not using the arduino IDE. http://www.vga-avr.narod.ru/main.html
From what i understand the arduino system might not be able to handle the timing correctly. I tried to email him but never got a response, but i ended up butchering his code and came up with something that vaugely worked, so a step in the right direction at least.
let me know how you get on, i’d love to try it out with some circuits i have to avoid using the computers vga output.
cheers,
bod.
November 10th, 2008 - 6:54 pm
Hello bod,
I come back with good news ! I completely re-wrote my program. Now, it outputs very clean sync signals (with a tiny little bit of horizontal jitter, though). Pin 5 is HIGH when you can send video signal, so you can trig some other signal with it. All the sync thing is done in a timer interrupt, so you can put whatever you want in loop() without breaking the timing. On the other hand, I think that using timer2 may have broken the PWM on pins 11 & 3. The code is here : http://olb7.free.fr/arduino/syncInterrupt.pde
Have fun !
November 10th, 2008 - 8:24 pm
sweet mate! well done, i can’t wait to try it out!! i do however have a done of projects to finish, but i’ll see if i can give this a shot at the weekend.
yeah, the timer2 function will use 2 pwm outputs making them useless for other operations, but it is a small price to pay for nailing this!
congrats. ;O)