follower:
Camera modules are notorious for having poor data sheets and while this one is perhaps better than most it’s quite dense.
–Philip;
I’d extend that by saying any component not designed for use in the hobby electronics market has a more complex datasheet. Do you need a degree in engineering to read one of those datasheets? No. (How would I know? I don’t have a degree, and I’m not currently a student.) Does it take patience? Always.
The camera interface is as follows:
In RGB mode the camera sends 2 bytes (16 bits) per pixel. These 2 bytes are encoded using, as leon mentioned, a 565 sequence. The first 5 bits are the red value. The next 6 bits describe the Green channel. The final 5 bits describe the blue channel. (Leon already mentioned this, but it bears repeating.)
The camera spits out the data in relation to Dclk. The vd line tells you that there’s a new frame (image) available. The hd line tells you that a new scan line has started. When both lines are high, the data will be clocked out of the D0-D7 lines. Every time the clock transitions from low to high the next byte is available. (It’s a pretty standard clocked 8 bit parallel bus design.) When HD goes low, You know that the current scan line is done. Once HD comes back high, you’re clocking data out for the next scan line. After all the scan lines have been sent the camera will take HD and VD low, and hold them there until it’s ready to clock out more data.
Setting the camera up is done using the I2C bus connections. Sending the camera’s address (it’s in the data sheet) along with the register you want to change settings in, and the value for the register, will change the setting. According to the report from the Army, the only command you need to send to the camera is 0x02.
NOTE: The camera is NOT a 5v or 3.3v device. It might work with those voltages (I wouldn’t try it) but most likely it’ll release the magic blue smoke and crap out on you. Logic High will be the same as the camera’s voltage source (it’s in the datasheet.) Logic low is ground, or 0v. ALL the IO pins on the camera are digital IO.
What do you need to provide the camera?
-Voltage (VDD) and Ground (VSS)
-Dclk - A square wave with a frequency >= 6mHz
-I2C interface - You’ll need to tell the camera to start taking frames.
-2 digital inputs for the camera’s control lines. You NEED to make these interrupts, because the camera will start sending data whether you’re ready or not.
-8 digital inputs – This is your parallel input bus.
Keep in mind that you have .16 microseconds (assuming Dclk of 6mHz) to read the byte, process the byte and get ready for the next byte. With the Arduino running at 16 mHz, that gives you approximately 2 processor clock cycles to play with. 2 clock cycles isn’t much to play with. You may have time to execute 1 ASM instruction. Even with a processor running at 20 mhz, you’ve only got 3 cycles. A Dclk of 6mHz also only gives you ~ 9 frames per second. Great for still shots, but if you want full motion video, you’d need about 15-18 mHz at Dclk.
In short the Arduino has nowhere near the processing speed to handle directly interfacing this camera.
If you really want your arduino to interface with this camera, you need something in between, that can buffer an entire frame’s worth of data from the camera and spit it back out slowly to your arduino. You could use an ARM7 or ARM9, or program an FPGA to do the job. The clock for a DSP would need to be approximately 50-100mHz to make it able to handle the task.