Go Down

Topic: Getting 640x480 images from camera modules at 1FPS (Read 5529 times) previous topic - next topic

wdzhou

My goal is to get 640x480 images from a camera module and save them into a SD card every one or two seconds. I have been looking into this problem for several days, and also have read to some posts on this forum (such as http://arduino.cc/forum/index.php/topic,133680.0.html). Most solutions use serial port-based cameras, which work well with Arduino. For the sake of serial ports, the transmission time for images is pretty long. For example, a 640x480 JPG image normally has 120k bytes. If Arduino's serial ports are set at 115200 bps (approximately 14k bytes per second). It takes about 8.5 seconds to get an image from the camera. It's too slow for some productions which need live experience. So I want to find out the way to make getting images faster. Meanwhile, I want to control the price of the final solution low. Some hints I thought of are as follows: (Since I am a software engineer don't know many about microelectronics, just trying to show what I found out and to ask the suggestions. )

1) A SPI connection-based camera module
I did found one, which provides both serial port and SPI interfaces. (http://www.diytrade.com/china/pd/9560940/SPI_high_speed_JPEG_Camera_Module.html)
SPI can provide up to mega-level bps and seems suitable for image data. Unfortunately, I can't choose the type of the CMOS sensor within it. Its price is a little high for my final production, since it costs about $35 USD.

2) 'Raw' camera modules
I found some such as ov7670 with AL422B, which has 380k bytes internal buffer and provides so-called 'FIFO' fetch. (http://www.emsysedukits.com/camera/ov7670-camera-module-with-al422b-fifo-p-232.html?cPath=87) It seems to work fine with STM32 system (or other 51 MCUs). But when I looked into its schematic, I was confused about how to connect it with Arduino. It has 8 data pins and several clock pins. Is it possible to connect these pins to digital pins on Arduino and then read the data according to its clock pins?

3) USB host shield + USB cameras
Circuits@Home provides such shields and some USB devices libraries. There are some digital camera controller projects based on them (http://www.circuitsathome.com/category/camera-control). I thought it may be possible to use a common PC USB camera plugged in the USB shield and to drive it according to corresponding Linux camera driver codes. Has anybody already done such works on other MCUs?


pylon

Why don't you use a linux based computer like the Raspberry Pi? Why does it have to be an Arduino? With Linux you have the drivers already to get the image from a USB cam and you have the horse power to read and save that amount of data.

If you have to do your project on an Arduino for whatever reason you'll be on the cutting edge, driving the thing to the absolute limit (reading with 1Mbit/s and writing with the same speed on a shared SPI bus with a device with a 16Mhz system clock. Think about it. Forget about libraries and C-Code, you have to write highly optimized assembler code to get near your target if it is possible at all.

wdzhou

#2
Nov 25, 2012, 05:58 pm Last Edit: Nov 25, 2012, 06:23 pm by wdzhou Reason: 1
>>Why don't you use a linux based computer like the Raspberry Pi?
It looks interesting. I never knew it before and will look into it later. Thanks for telling me that.

>>Why does it have to be an Arduino?
Because my final goal is just to forward(or save) camera data somewhere, and I want to keep the final hardware small enough and inexpensive. Arduino seems such one.

>>If you have to do your project on an Arduino for whatever reason you'll be on the cutting edge...
Yes, I had considered this. And most camera module's clock can be slowed down by setting some internal registers. I saw an example which used a 51 MCU to sample an ov7670 camera module by doing so. But the best way is to buffer the data from the camera with a hardware mechanism. The so-called 'FIFO camera modules' just do this. They can be sampled by MCUs according to a digital output pin which simulates a read clock to advance the pixel reading.

Moreover, I met a guy yesterday, who promised me to make a special camera module for me(as well as for Arduino). The module will support SPI/UART interfaces, and can transfer maximum size of 2M pixels JPEG images with both interfaces. He needs two weeks for making it. If it works, we will consider to release it someday. Let's go and see.

sbright33

I'd like to see that when he's done!  I am able to transfer a lowres pic in a few seconds from a serial JPG camera.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

wdzhou

By the way, the main problem prevented me to use a FIFO camera module (like this: http://www.emsysedukits.com/camera/ov7670-camera-module-with-al422b-fifo-p-232.html?cPath=87) is its operating voltage is 3.3v. It seems not able to work with Arduino. Besides its data is uncompressed.

PeterH


Besides its data is uncompressed.


Somebody here - sbright33, I think - got some interesting successes reading JPG format images from a camera using Arduino. The problem with that format is that the Arduino can't sensibly decompress them so it is hard to do anything at all with the images. If you are able to get the 'raw' image data then this could potentially be far more useful.
I only provide help via the forum - please do not contact me for private consultancy.

sbright33

It does take a long time to decompress with Arduino.  In theory it could be done if you have a Quadram board.  But what's the point really?  It is much better to send the data to a PC then decompress...
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

wdzhou

I never hoped Arduino can process the images themselves. The reason I mentioned 'uncompressed' is the size of the higher resolution images'. A normal 640*480 JPEG image has only 120K bytes, however a 16-bit color bitmap has more than 600K bytes. Even though we could read images from a FIFO camera module with Arduino, we couldn't reach a reasonable time due to its uncompressed size.

So the best solution I thought is to get JPEG images from a FIFO camera with SPI bus. The next step is to wait for the hardware a guy promised me to do in two weeks. I'll tell you the progress of it later.

BulletMagnet83

Isn't the rasp-pi actually cheaper than a high-end (genuine) Arduino board? If cost is a huge factor here I doubt changing over to the pi would make an enormous difference. And they're tiny :D As long as you can learn how to do what you want on that platform, you can't lose.

sbright33

In this case I agree.  But I've heard that RPI is not as good at some things that we do with Arduino.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

pylon

Quote
In this case I agree.  But I've heard that RPI is not as good at some things that we do with Arduino.


This is definitely try but in all cases where masses of data have to be processed and custom-off-the-shelf end-user hardware should be accessed (like webcams) a full-fledged OS with drivers, enough RAM and the horse power needed for that task is clearly better. Reading a picture from a webcam and store it on a SD card really is easy on a Linux platform like the Raspberry Pi and it definitely is hard on an Arduino (if it even is possible).

My credo is "the right tool for the job" and not "it has to be an Arduino".

holmes4

You of course could just get rid of the arduino/raspberry and use a wireless IP webcam such as these.

http://foscam-uk.com/ They work out cheaper than an uno and a cam module.

Mark

sbright33

The range sucks.  How do you combine them with an extender, separate router,  or external directional antenna like I have?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

holmes4

Quote
The range sucks.  How do you combine them with an extender, separate router,  or external directional antenna like I have?


Thats upto you!.  But they do solve the OP's problem.

I just hook 'em upto the PC like any other WiFi device.

Mark

sbright33

You're assuming he can place the PC near the camera.  I don't see where he said that.  Instead maybe he can buy one of those cameras that stores the picture on SD card every 1 seconds, like the hunter camera I have.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Go Up