Arduino Forum

Forum 2005-2010 (read only) => Hardware => Interfacing => Topic started by: OpenSource on Nov 17, 2008, 08:47 pm

Title: Arduino and camera/webcam
Post by: OpenSource on Nov 17, 2008, 08:47 pm
Hello,

Is is possible to use the Arduino with a camera/webcam?

I've seen this item on sparkfun:
http://www.sparkfun.com/commerce/product_info.php?products_id=8739

Is it possible to connect this camera to the arduino-board and use the serial output to send data (image's) to a computer?

I don't know if this is also possible with a webcam? Is it easier?

I am pretty new into open source hardware/electronics!

Thanks in advance,

OpenSource
Title: Re: Arduino and camera/webcam
Post by: Grumpy_Mike on Nov 18, 2008, 05:56 pm
I think this came up some time ago but basically no you can't transfer the data along the serial link fast enough and there is not enough space in the memory to buffer the picture.
Title: Re: Arduino and camera/webcam
Post by: trialex on Nov 19, 2008, 12:48 am
Quote
use the serial output


It doesn't output serial data - it outputs raw video - you could solder an RCA connector on it and connect it directly to your TV.

There are camera modules that output "serial" data - sparkfun has a few. Typically they were designed for use in mobile phones.

As grumpy_mike points out though, the arduino doesn't have enough bandwidth or storage space to capture/process/do anything with it. You need something like an FPGA board. Search sparkfun's forums for some examples - it's a fairly advanced project.
Title: Re: Arduino and camera/webcam
Post by: BigMike on Nov 19, 2008, 03:09 pm
Whilst I agree with Mike about capturing / storing / sending the video in real-time, it may be possible to do something with the arduino, but not in real-time.

For example, if the application was such that the picture was stable for minutes at a time one could imagine the arduino could capture, store and transmit the picture without breaking into a sweat.

How close you can get to real-time would be interesting to work out.

Mike
Title: Re: Arduino and camera/webcam
Post by: salernos on Nov 19, 2008, 04:41 pm
If you are already committed to sending video data to a computer, would it work for you to connect a web-cam camera to the computer directly, trim the data into the useful info and send it to the arduino?  I suppose this all depends on the application, but I have created a project with the arduino with this arrangement for a real-time image tracking system.  

What are you trying to do?  With a bit more info we may find that it is not needed to connect a video stream directly to the arduino.
salernos
Title: Re: Arduino and camera/webcam
Post by: Grumpy_Mike on Nov 19, 2008, 05:50 pm
Mike
Quote
How close you can get to real-time would be interesting to work out.

I did this in 1987, using a BBC micro and external hardware. The answer is that it depends on the image resolution you want to capture but I got to 3.5 seconds per frame. The text is here, I will try to look out the schematics but they might be long gone.

http://www.doc.mmu.ac.uk/STAFF/A.Wiseman/Acorn/BodyBuild/BB87.html

This is based on a technique used by radio hams for SSTV (Slow Scan TV) which transmitted an image every 8 seconds. This was before computers.
It is based on sampling a column of pixels every frame, then moving the column along the line. How far you move it determines the number of pixels in the X direction and also defines how long it will take you.
Title: Re: Arduino and camera/webcam
Post by: drone on Nov 19, 2008, 08:05 pm
You know, I wonder, if you could hack together something using a DOSonChip and a Serial camera like the C328R.  

Use hardware serial between the arduino and camera, software serial between the arduino and the DOC.  So, you set the data packet size on the camera to the data packet size for the DOC.  Tell the camera to take a picture, and then start receiving the data - for each packet you receive, you tell the DOC to write a data packet.

Obviously, you couldn't reach speeds equivalent of video, but you can store photos once every second or two.  This way you don't need enough memory to store a whole image (just one packet size worths).

!c

Edit: here are some links:

http://www.electronics123.com/s.nl/it.A/id.2027/.f?sc=8&category=241
http://www.sparkfun.com/commerce/product_info.php?products_id=8215

Title: Re: Arduino and camera/webcam
Post by: seanreynolds on Nov 25, 2009, 04:31 pm
Grump Mike,
I think a better answer is what can we do?

Surely we could read one pixel per frame of the video output.
What If I wanted to have "really low res" images?
I would like to computer vision on a micro controller because micro controllers can go on remote control helicopters.

If I wanted to read one pixel per frame could I construct a 10 by 10 matix of pixel compositions?

Lets figure out what we can do and go from there.
Title: Re: Arduino and camera/webcam
Post by: Grumpy_Mike on Nov 25, 2009, 05:04 pm
Quote
Surely we could read one pixel per frame of the video output.


How without the hardware I described above? Schematic at:-
http://farm3.static.flickr.com/2693/4055078865_827d4e8205_b.jpg

Quote
If I wanted to read one pixel per frame could I construct a 10 by 10 matix of pixel compositions?

Yes you just have to modify that hardware to give you only one pixel per frame. As it stands you get one pixel per line.
This means adding a Y axis counter in a similar way to the X axis one. Then using a comparator to sample the pixel when the video scan reached the selected point. Alternatively you could throw them away in software.
The hardware could be modified to give as few pixels as you want in the X direction. The Y direction is tied to the scan lines of the video and must be averaged in software.

Quote
I would like to computer vision on a micro controller because micro controllers can go on remote control helicopters


Are you sure you would get anything useful out of such low resolution?
Title: Re: Arduino and camera/webcam
Post by: AWOL on Nov 25, 2009, 05:10 pm
Quote
Are you sure you would get anything useful out of such low resolution?

You might get an idea of where the horizon is, but by the time you've worked it out, it could be too late!
Title: Re: Arduino and camera/webcam
Post by: agentsmith on Nov 25, 2009, 07:08 pm
go and get a fonera 2.0!
it costs 40 euros, have a ARM9 150 Mhz processor with 32 MB RAM, USB host and Linux. You can connect a USB webcam and process the images on that with OSS software.
Plus you can connect Arduino through USB port or internal serial port and have all the I/O pins that makes Arduino so wonderful!

Even a C64 have more RAM than Arduino, you would have problems working on still pictures, let alone video feed
Title: Re: Arduino and camera/webcam
Post by: seanreynolds on Nov 25, 2009, 07:21 pm
Look what I just found!!

http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/Level/a/ProductID/566/Default.aspx?SortField=ProductName%2cProductName
Title: Re: Arduino and camera/webcam
Post by: seanreynolds on Nov 25, 2009, 07:26 pm
Only one Line Scan of image data, but that might actually help matters for some applications.
Title: Re: Arduino and camera/webcam
Post by: seanreynolds on Feb 16, 2010, 11:55 pm
You can get a serial camera for the arduino at .7 fps.
Again... the point is: What can you do?

http://www.sparkfun.com/commerce/product_info.php?products_id=9334
Title: Re: Arduino and camera/webcam
Post by: mheermance on Jul 28, 2010, 04:08 am
I'm new in the forum and saw this thread as it is related to something I'm doing.

I ordered the Parallax line scan camera and should have it shortly. I've seen some pretty neat applications people have come up with for it.  Mike Davey uses it for simple OCR in his Turing machine.

I've also seen people use it to locate a candle and follow a line.

As I have an Arduino and a BS2e, so I can run the PBASIC samples and then translate them into C for the Arduino.  It uses a synchronous serial interface to shift in the pixel values and in reading through their docs it looks pretty straight forward.
Title: Re: Arduino and camera/webcam
Post by: zoomkat on Jul 28, 2010, 04:38 am
Well, back in the day (~'95 or '96) there was a connectix quick cam made for a mac that I think used a serial connection. When connectix came out with the windows version it used the parallel port. The early video conference types (including me) would use cuseeme. I initially used a 14.4 modem but later went big time with a 33.6 on my 486x66 with 8mb of ram. So one can actually have bidirectional video over a serial port in certain conditions. I later made a dialup point to point video netmeeting connections with a relative in another state and a roommate's other phone line. The arduino just doesn't have a lot of horsepower, but inquiring minds keep thinking.    
Title: Re: Arduino and camera/webcam
Post by: palchescotty on Aug 11, 2010, 05:11 pm
I'm a beginner as well, so this is manly a question, but also a suggestion if it works.

Would it work to hook up a webcam (which already has a live image if you hook it up to the usb port on your computer) to a usb adapter and put the usb adapter on a breadboard along with a radio transmitter. Then put a radio receiver on your computer. Then attach the aforementioned breadboard (w/ webcam attached) to a robot, and voila!! you see what the robot sees from the comfort of our desk chair. Then go even further and make the robot an RC.

Who here thinks that this idea would work?
Title: Re: Arduino and camera/webcam
Post by: RanTalbott on Aug 12, 2010, 10:54 pm
Quote
Would it work to hook up a webcam (which already has a live image if you hook it up to the usb port on your computer)


No:  the PC is doing a lot of work,  by Arduino standards,  to generate that live image from the webcam data.

It's like hooking an RV to your bicycle:  you might be able to generate a little movement movement with a lot of effort,  but it's not a feasible way to do any real travel.
Title: Re: Arduino and camera/webcam
Post by: keeper63 on Aug 12, 2010, 11:17 pm
Quote
Well, back in the day (~'95 or '96) there was a connectix quick cam made for a mac that I think used a serial connection.


Actually, most likely (though I never saw it, so I don't know for sure) it used the ADB connection on the Mac; while such a connection theoretically allowed for a higher-speed data rate than a regular serial port - supposedly it wasn't really possible, unless they were doing some software trickery to get the speed up (certainly a possibility).

I suppose if you bumped the serial speed of the USB/FTDI connection on the Arduino, and wrote some really tight code on both ends to parse things as fast as possible, you might be able to get a decent frame rate (10fps or so). The thing with the original QuickCam, though, was the fact that it only had 16 shades of grey at 320x200 resolution - so it was only needing to push 32000 bytes per frame (roughly, not counting overhead).

If you could get the raw pixel data from the camera, it might be possible to send a stream of pixel data values, perhaps with inter-frame pixel difference values (and key values every so often) to keep the data rate down, perhaps a small buffer with simple RLE to further lower the data rate (or some other on-the-fly, per scan line compression scheme)...
Title: Re: Arduino and camera/webcam
Post by: zoomkat on Aug 13, 2010, 12:22 am
One of the low bandwith provisions of cuseeme was that the large frame was composed of a lot of small frames. Only the small frames that had a certain amount of change were actually sent to the community server. This saved the overhead of sending the small background frames that had little change. I still have some of the B/W windows parallel port cams. In the past the CCD chip in them was popular for use with telescope projects.