VGA plus arduino

Intel or AMD? nVidia or ATI? Lenovo or ASUS? All things computing hardware go here

VGA plus arduino

Post by pretentious on Mon Sep 14, 2015 9:57 am
([msg=89745]see VGA plus arduino[/msg])

So here comes a wall of text because I'm working on this right now and it's all still swirling around.

My first idea was to use the 5v pin on my vga port to power my arduino. I had an old vga cable and I'm always looking for a power source. I stripped the cable and was trying to think of a project idea. I was really curious about the information being transmitted and have tried to use a multimeter in the past to get a reading on say the red pin for instance but because of the serial nature of the connection, I couldn't get anything solid. I thought maybe I could have nothing but red on the screen and at every moment, the red pin should have a voltage but for some reason this didn't work out. I then turned my attention to the sync pins. Read this http://www.javiervalcarce.eu/html/vga-s ... cs-en.html to get some more info on the protocol. My idea is pretty much to reverse engineer the signal and get the data i want. Now I can't use a multimeter to read it because it's sampling rate is far too low. I don't have an osseloscope because I'm not made of money. This is where the arduino comes in.

I could pole an arduino pin at a specific rate and switch on a led or do a serial output in a way that my eyes are not competing with a 60hz refresh rate.

First thing I do is read the above link and get a general idea that the vsync signal is a square signal at 5v, which can be read by the arduino. Now rather than jumping straight into the programming which I have little experience with, I decide to hook up my earphones to the vsync and ground(VSYNC) pins. Sure enoung i get an audible tone(btw this is super loud, just a heads up), which was fucking exciting lol because vga programming has been on my todo list for a while.

I've put the vga cable away at this point and have a vga head I bought at jaycar, soldered some leads to the pins of interest and set up my arduino with some example code from the ide plus some of my own

Code: Select all
int led = 13;
int vga = 12;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  pinMode(vga, INPUT); 
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, digitalRead(vga));   // turn the LED on (HIGH is the voltage level)
  if(digitalRead(vga) == false){
  Serial.print(digitalRead(vga));
   Serial.print("\n");
  }
  delay(1);
}

My idea was to run an initial delay quicker than the refresh rate of the vsync, it would pole the status of the signal and when the low point was found, I'll exit the loop and can assume i have a synchronized program.

My final project idea is to completely decode the signal and pull the rgb value of the top left pixel and light and rgb led with that value(super uselful).

Where I'm at at the moment though is
Code: Select all
  Serial.print(digitalRead(vga));
   Serial.print("\n");
  }
  delay(1);

haha that's me rage quiting :lol: I originally tried just using a a long delay that wouldn't sync up and change the led to the value of of the sync signal, this was it will eventually get to the dip and will hold that for the next 110 milliseconds or something and I'll be able to notice it lol

So anyway, that's my first real attempt at something embedded and I didn't crash and burn as hard as I thought i would 8-) It still doesn't work but I mean, lol

I'll update this thread as I get this slowly figured out
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
Can you say brainwashing It's a non stop disco
User avatar
pretentious
Addict
Addict
 
Posts: 1189
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: VGA plus arduino

Post by ghost107 on Mon Sep 14, 2015 4:00 pm
([msg=89750]see Re: VGA plus arduino[/msg])

For a 640x480 resolution you would need 25Mhz dedicated for the monitor to draw at 60fps(1920x1080 you would need 125Mhz dedicated for the monitor)
http://lslwww.epfl.ch/pages/teaching/co ... es/VGA.pdf

Since ardruino has ATMEGA328(20Mhz clock), you can get to run it at the resolution 640x480 at around 60hz
User avatar
ghost107
Poster
Poster
 
Posts: 315
Joined: Wed Jul 02, 2008 7:57 am
Blog: View Blog (0)


Re: VGA plus arduino

Post by pretentious on Tue Sep 15, 2015 11:58 pm
([msg=89758]see Re: VGA plus arduino[/msg])

this is the second time I've underestimated a project by orders or magnitude :lol: I just can't catch a break with this signaling stuff. I actually can't make my screen resolution that low :)
I figured even with the high resolution, the vsync shouldn't be more than the refresh rate, but alas I'm still kind of lost.
Without doing any real research I tried to interpret some kind of signal from the vsync pins
I noticed that it fluctuates between 4.97 and 4.98 volts. This could easily just be within the normal working limits of the hardware or something
Code: Select all
int led = 13;
int vga = 12;

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
  pinMode(vga, INPUT);
  digitalWrite(led, 1);
Serial.begin(9600); 
}

// the loop routine runs over and over again forever:
void loop() {
 
  int analog_value;
  float analog_voltage;
  boolean syncing = true;
  while(true){
    while(syncing){
      analog_value = analogRead(A1);
      analog_voltage = analog_value * (5.0/1023);
      if(analog_voltage <4.97 && analog_voltage > 4.00){
        syncing = false;
        digitalWrite(led,syncing);
        break;
      }
    delay(1);
    }
   
  // timer should be in sync now
    analog_value = analogRead(A1);
    analog_voltage = analog_value * (5.0/1023);
    Serial.println(analog_voltage);
    if(analog_voltage < 4.00){
      syncing = true; //if we lose sync
      digitalWrite(led,syncing);
    }
    delay(16.5);
  }
}

You know when you really feel like you're on to something but you just can't get a proof of concept working? :( :D
Anyway I'll update this thread in like 4 months when I get it figured out and have something useful 8-)
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
Can you say brainwashing It's a non stop disco
User avatar
pretentious
Addict
Addict
 
Posts: 1189
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: VGA plus arduino

Post by cyberdrain on Wed Sep 16, 2015 9:13 am
([msg=89769]see Re: VGA plus arduino[/msg])

I once tried to get a laptop LCD working on my Pi using the outputs available. Let's just say I gave up once I understood I was in way over my head, needing hardware costing the same as a new screen. Still, at least conversion to VGA isn't your problem here, so maybe this is a bit easier. I wish you all the best with it :)
Free your mind / Think clearly
User avatar
cyberdrain
Expert
Expert
 
Posts: 2160
Joined: Sun Nov 27, 2011 1:58 pm
Blog: View Blog (0)



Return to Hardware

Who is online

Users browsing this forum: No registered users and 0 guests