Hello everybody, maybe the title of this topic seems to be a little complicated but what I want to do (almost in theory) is something absolutely simple.
I want to be able to take a vga signal from any kind of source, read it with arduino, crop it (that means that I want to use just a precise area of pixels with specified dimensions and position in the whole signal), and use it to pilot a small(er than the original signal, about 100x100) RGB hi-lux LED matrix.
Next I want to be able to take multiple matrixes and use them one near another to create a ledwall.
The Idea is that, to pilot the matrix I need a decade counter section to cycle through the horizontal pixels, at least 7 digital outs used to pilot a specific line of the matrix, then few pixel that allows communication between arduinos.
What i thought I can do is to read the hsinc from the vga signal and use the part I need (if the 100x100 square is not in the top left corner I will need to discard the first n pixels data) allowing it to pass throw and control a decade counter, arduino is working as a gate to the clock signal. The same is done with the vsinc I will let the signal pass only if the actual pixel data is inside my crop area.
when a pixel is enabled in my arduino so is the RGB data, otherwise the RGB data is gated and not passed through.
What do you think about this idea? Is there any chance to make arduino able to follow the vga clock?
I can't find too much accurate documentation about VGA, do you have something?
Thank you for your patience in reading this and sorry for my bad english.
In general, the Arduino is not up to processing the whole VGA signal, but perhaps the Video Experimenter (VE) shield might be useful (it has a video chip to handle the signal). I must admit to buying the VE shield, but never actually using it. You might have to modify the software to work with current IDE's, as I think it was originally written for the 0.22 IDE, and there were some changes when 1.0 came out. The VE shield allows you to process low resolution mono video images, and also to send a low resolution overlay to the video signal. Video Experimenter: Arduino shield that lets you do all kinds of experiments with video
Can you please tell me any reference about the VGA signal and where to understand better the bandwidth?
I can also use not the whole VGA signal but also a little part of it like for example a 640x400
is the problem in reading it or in handling the refresh rate? I can even slow the refresh rate
Usually the biggest reason you can't handle video is that there is not enough memory to store an entire frame. You quoted 640x400. That would take 768,000 bytes to store 1 frame if you store it with 1 byte to hold each of the RGB. An Arduino UNO R3 has 2,048 bytes of read/write memory. Ok, if you can reduce the frame size to 128x96, and only represent each pixel as a single binary value (which is what the Video Experimenter shield does), it will 'only' consume 1,536 bytes. So, you could represent one frame. The Arduino is a slow processor, so you probably need to reduce the frame rate as well.
Then in terms of bandwidth is another issue with the Arduino. The Arduino runs at 8 or 16Mhz, and is an 8-bit processor, which means it needs several instructions to process most data. It is highly unlikely you would be able to read all 1,536 bytes in a reasonable amount of time to do any kind of real time processing on it.
If you want to process video, get a Raspberry Pi or similar Arm based Linux system, which runs at a faster clock rate (700Mhz for the R-pi vs. 8 or 16Mhz), and it comes with 256 or 512 megabytes of memory. I believe the R-pi has some basic tools for processing video in real time.
If you need to do things that the Arduino can do more easily that the R-pi can't (such as neopixel lights, running motors, etc.), consider having two systems that communicate via i2c/serial/etc. Or get a Yun (now) or Tre (available soon), which has both processors on one board. If you don't need the Arduino-like processor to be fast at digital I/O, the Intel Galileo might be an answer.
Why can't I just store what I need? and not all the entire frame?
If I discard any info I don't need the very time it arrives I can store just the 100x100 or 100x50 pixels I need. If arduino can read at that speed, I think with some logic is possible to manage this, the only problem is if I can read the input signal fast enough.
Is this a bad Idea? Of course I have to use a single arduino for each module, but every single arduino is up to handle only a smaller part of the data stream.
If you can’t look up VGA specs on the net and understand what it tells you then you probably shouldn’t mess with VGA except through off the shelf complete solutions.
As it is, AVR-chip Arduinos are far too slow to pick up on pixels even at the low end of VGA.
You might as well try to win a Rally in an old Yugo.