It's a shield that lets you process analogue video from a camera or other source, right on the Arduino. I've recently made one installation with it to display low-resolution video on an 8x8 LED matrix.
It's currently only tested with PAL, but I think NTSC should work too.
I've tried to put as much detail as possible on the page if you wanted to try it for yourself. There are lots of ways of improving it and I've love to hear your ideas.
great work! And easy to understand too. What camera are you using and how is it hooked up?
As you say, you could get much higher resolution by going at the port directly. With a dual comparator and 2 bit grey scale you could store a 32X32 image in (I guess) only 128 bytes of memory.
I wonder too what you can do with low resolution or only part of the image - what are you thinking of?
There's a RCA socket on the board there - so the camera just plugs in. I've tried it with another camera and a PAL signal converter from my mac - which both work.
I'm not 100% sure how to write the port manipulation code to get the higher resolutions working - so if anyone can help me out that'd be much appreciated.
The next thing I wanted to try with it was a vision based control for an iPod, using the good work folks have down with the control protocol. So for instance you wave your hand (or shine a flashlight) left/right for forward/back and up down for the volume.
I think any more ambitious image processing might be tricky, but I'd like to see how far it could be pushed!
I can't see which pin number is your videoPin but if you put it on pin 8 then
picture[x][y]=PINB & B00000001;
should be equivalent to
picture[x][y]=digitalRead(8);
i.e. the bottom bit of PINB is pin 8. You still need all the other stuff like pinMode. try it out as a direct swap and see how much of the picture fits in your 8 samples.
There are a bunch of other things that will slow your code down but I have a feeling that you're just as well with low-res because your match to the sync is likely going to be a bit uneven.
By the way, it would be just as easy for you to declare picture as byte rather than int. it will take half the space and shouldn't change anything else. You should be able to do 32X32 with no trouble at all on an atmega328.
This is very impressive work and well worth pursuing.
If it wasn't snowing like the end of the world in Ottawa I'd be out looking for a camera.
I love this! I wrote a video driver for Arduino last year - all in assembly to get small pixels This could work in reverse, using LOAD (from port), OR, SHIFT per pixel, with a STORE per 8 pixels (which is fine since the first shift & or are not needed). Make sure you use an entire 8-bit port for the 1-bit (digital) sampling input, with all other bits zero, to avoid extra masking ops.
I think that makes 3 cycles per pixel, which is 256 pixels across the screen (memory is hazy; haven't touched Arduino for a while).
Triggering this accurately may be difficult since the precise interrupt latency of Arduino varies depending on what code is executing. But, if the code was idle in a loop of a single instruction this would be predictable, and you could get reasonably good line-to-line synchronization.
Using this method I think you could capture full vertical resolution and 256-pixel horizontal resolution, yielding a hell of a lot of data!
Quite what to do with that data, I don't know ... you can't store it anywhere Perhaps you could somehow modify the data and combine it back with the video signal to create some cool effect?
I'd love to combine this with a larger LED matrix. My dream would be to make a VideoPeggy Peggy 2.0 + Quartz Composer = Video Peggy! that didn't need a PC to do the video processing.
Awesome work! I've looking around for a simple, cheap way to do video with any microcontroller. I only ever came up the CMUCAM. Granted the CMUCAM does alot of neat stuff, but this will work extremely well for simple video projects. Line recognition, motion detection... Awesome!
And, it's apparently installed in the window of a British pub with the display being in an 8X8 matrix of Cide Bottles. Which is pretty darned cool and makes me think about what you can do with very limited video resolution. http://curiositycollective.org/v2/blog/entry/reflections-in-cider/
I am curious to know whether, at a low level, the ADCs would be quick enough to let you do 32X32 video with 8 bit grey scale or color which would be pretty darne cool and maybe be a complement to this from the other day http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259929221/6#6
I shall definitely be trying the port manipulation Bill - trouble is I've made the classic mistake of only having one built right now - and that's in my installation! But I've got all the bits - just need to solder up another.
So the thing I'm thinking about at the moment is what to do next. I'd really like to offer it as a kit, but before that I want to make sure version 1 is going to allow people to do a whole range of interesting things. I also need to work on getting some cheaper chips I think.
Really like the idea of having video out too Eddie.
From a quick look at the Peggy 2 board it seems that there's an serial line in - so I guess getting the two to talk would be very possible.
I'm intrigued too on whether you could get an recognition going on it - we'd need to pull every trick! Edge extraction would be one first step, I wonder if it's possible to get the hardware to assist with that...
You say that the reference voltage is set dynamically by the arduino, is this by reading the video chip, or do you have a potentiometer or something else controlling it?
You only read either the odd or even lines, and this is because of a lack of processing speed/power, correct?
Here's my idea: combine the eye shield with a laser pointer to make a basic laser rangefinder using the brightest pixel (where ever the laser hits) and triangulation.
Hi - yes that's right. The design depends on creating a digital version of the video, using a op-amp set up as a comparitor to compare the video signal with the reference voltage.
The reference voltage is set by a PWM output, with a simple low pass filter (resistor/capacitor) to turn it into a true DC level. In the new design I'm working on you can also set it via a potentiometer.
The way PAL/NTSC works you get all odd lines then all the even lines and they are interlaced. For my purposes it was convenient to read the data into the array on the even lines and process it on the odd lines. If the frame rate really mattered to you then I'm sure there are other workable schemes.
A rangefinder would be a great application! I guess that as the laser light would appear very small in the frame you'd need to work at a much higher resolution. That's something I'm working on now following the previous helpful pointers from the folks here.
A rangefinder would be a great application! I guess that as the laser light would appear very small in the frame you'd need to work at a much higher resolution. That's something I'm working on now following the previous helpful pointers from the folks here.
From some of the projects I've looked at out there, the easiest way to build your own is to use a glass rod as a lens, and break the laser into a vertical line. This would make it easier to find the laser amongst the other pixels. And if the intent is to find the brightest pixel at a certain distance, you could limit the number of lines to look at.
This would maybe free up enough time to do other things like the triangulation math (or killer robot AI ;D ).
And since all that you have to do is look for the brightest pixel (where the laser is) the reference voltage would be quite high.
Hello , congrats for your project. Where is the open source licence for your shield ? it's very important to publish it, because when big business build your ideas, they pump your energy.
1/ Coax cables are usually terminated with the characteristic impedance of the cable (for video that's usually 75ohms). For a very short cable not having the termination won't make any difference, but for a longer one it will degrade the signal. In this case the effect on the signal probably doesn't matter at all given the slow way you're sampling the video and the crude form of analogue to digital conversion you're employing. However there's a complication - the equipment that drives the signal also has to match the cable, and a common way to do that is to employ a driver with a gain of 2 and a series 75ohm resistor. So the driver produces a 2V video signal, instead of the standard 1V signal, and relies on the potential divider formed by the 75ohm resistor at the output and the 75ohm resistor at the input to take the signal back to 1V. Without the input resistor you'd see a 2V video signal and I'd guess that's what you've designed your circuit around (in this case the free gain of 2 suits you since you want a reasonable range of voltage to present to your comparators). For a hack it's fine ('whatever works' is the hackers motto!) but the levels would be wrong if it was connected to a source that didn't use series termination into the cable.
2/ The AD811 is a beautiful amplifier but it's way over the top for what you're trying to do. You're also using it outside its spec (it's not designed to run on a single +5V supply rail), though obviously it's managing to do something in your circuit. How about trying a low cost dual comparator like the LM319N? It looks like it's just about fast enough, far cheaper, and will probably give you less problems on your pcb layout. Just to try it out, ditch the follower and drive the comparators directly (the follower isn't doing much here, anyway). Remember the output pull-up resistors (that's the voice of experience speaking!) For 50p from Rapid it's worth a try.
3/ If you're going to look at improving the resolution, you'll need to consider better the colour subcarrier that's added to the luminance signal. It might be worth having a simple notch filter to try and remove as much as possible.
Jonathan
(If I came to meetings more often, I'd have realised you'd done this - I just assumed, with the cider display, that you were pushing the video through an Apple something-or-other.)
Hi, sorry for the extraordinarily long delay in replying.
Jonathan - thanks very much for that really helpful - would you have time to sit down and go through this with me? Promise to post the resulting circuit up for all to see.
Pop - what would suggest for the license? Creative Commons Attribution Share-Alike license for the schematics?
Hi all. I am looking for a way to use arduino and video as a timing trigger for RC slope glider competitions. I wonder if this project could trigger a timer when the glider is passing a vertical line in the middle of the cam field of view. I thought that processing/analyzing only a rather limited vertical band of the cam view would be sufficient, and the cam could even be set on its side to have a higher FOV. Any thoughts welcome, of course. A well, I forgot to mention the glider may pass as fast as 100km/h and also that the passing by can be at different distances from the camera (maybe 5 to 50m). Of course I am sure threshold between plane luminosity and background would be of importance. Thanks for your feedback!