Is there any further info on this. The data sheet is a bit sparse.
Specifically, I want to read without JPEG compression.
Is this possible? Also, is there a definition of commands that might allow
me to do this and anything else the sensor is capable of?
There is a demo code on the Electronic Brick - Serial CMOS Camera website. SerialCamera -> SerialCamera_Mega
You also need to download the SD card lib from this link. code.google.com/p/fat16lib/downl … p&can=2&q=
Connect like this: plug Music Shield to the Mega, the mega’s SPI pins are compatible with Music Shield’s SPI pins.
aduino/seeeduino Mega -------------- Electronic Brick - Serial CMOS Camera
RX1 ------ TX(white wire)
TX1 ----- RX(yellow wire)
GND ------ GND(black wire)
VCC ----- VCC(red wire)
The picture will be save in the SD card as its name is pic00, pic01 etc.
Please let me know if you need more help.
Regards.
I have just received that camera and wrote code to capture an image, using Linux and an FTDI card (actually porting the relevant parts from the demo code to Linux).
There are 3 documented commands:
Capture VGA (640x480) image.
capture QVGA (320x240) image.
Send data-block (starting at byte, block-size bytes).
Results are pretty nice, but very slow. Receiving a 320x240 image in 64 byte blocks took me 6 seconds in average. Larger block size makes it faster, but it’s not practical if I want to use a microcontroller (block size if limited by the available ram). Also, it may not be practical to decode jpeg on an 8 bit microcontroller.
Searching LSDC030M01 on the internet I see hints that the camera supports lower res (160x120) and also different baus rates. I could not find any documents that explain how it can be done.
I am having trouble getting a response from my electronic brick camera. I’ve tested the camera with an oscilloscope. The correct values are transmitted to the camera, but there is nothing being received.
Did you have a similar problem, or know how to troubleshoot by an chance?
Also, what is the LED for?
It looks like you are using Linux. The attached code has worked for me some time ago
(Change cmdtry to either cmdVGA or cmdQVGA to get VGA or QVGA pictures).
Why can’t I attach a C source file ?
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termio.h>
#include <unistd.h>
int capture(int port, int file);
int readCamSaveToFile(int port, int file, int size);
int main(int argc, char **argv) {
struct termios termios;
if(argc != 3) {
fprintf(stderr, "Usage %s SerialPort OutputFile.jpg\n", argv[0]);
exit(1);
}
int port = open(argv[1], O_RDWR|O_EXCL/*|O_NONBLOCK*/);
if(port < 0) {
perror(argv[1]);
exit(1);
}
if(tcgetattr(port, &termios)) {
perror("tcgetattr");
exit(1);
}
cfmakeraw(&termios);
cfsetospeed(&termios, B115200);
cfsetispeed(&termios, B115200);
if(tcsetattr(port, TCSANOW, &termios)) {
perror("TCGETS");
exit(1);
}
int file = open(argv[2], O_CREAT|O_TRUNC|O_WRONLY, 0666);
if(file < 0) {
perror(argv[2]);
exit(1);
}
int res = capture(port, file);
exit(res);
}
#define PIC_BUF_LEN 4096
#define SHIFT_BIT 12
unsigned char cmdtry[] = {
0x55,0x41,0x52,0x54,0xCA,0x00,0x00,0x00,0xff,0x00,0x00};
unsigned char cmdVGA[] = {
0x55,0x41,0x52,0x54,0xCA,0x00,0x00,0x00,0x00,0x00,0x00};
unsigned char cmdQVGA[] = {
0x55,0x41,0x52,0x54,0xCA,0x00,0x00,0x00,0xFF,0x00,0x00};
unsigned char cmdGetDat[] = {
0x55,0x41,0x52,0x54,0xC7,0x00,0x00,0x00,0x00,0x00,0x00};
int capture(int port, int file) {
unsigned char replyBuf[3];
if(write(port, cmdtry, sizeof(cmdtry)) != sizeof(cmdtry)) {
perror("write cmdVGA");
return 1;
}
if(read(port, replyBuf, sizeof(replyBuf)) != sizeof(replyBuf)) {
perror("read cmdVGA reply");
return 1;
}
unsigned long picTotalLen = (replyBuf[0] << 16) | (replyBuf[1] << 8) | replyBuf[2];
printf("picTotalLen = %lu\n", picTotalLen);
//read pic data from camera and write to file in SD card
unsigned long count = picTotalLen >> SHIFT_BIT;
unsigned long tail = picTotalLen & (PIC_BUF_LEN - 1);
unsigned long addr = 0;
cmdGetDat[5] = 0;
cmdGetDat[6] = 0;
cmdGetDat[7] = 0;
cmdGetDat[8] = PIC_BUF_LEN >> 16;
cmdGetDat[9] = PIC_BUF_LEN >> 8;
cmdGetDat[10] = (PIC_BUF_LEN & 0xff);
for(int i = 0; i < count; i++){ //get and save count*PIC_BUF_LEN data
write(port, cmdGetDat, sizeof(cmdGetDat));
if(readCamSaveToFile(port, file, PIC_BUF_LEN))
return 1;
addr += PIC_BUF_LEN;
cmdGetDat[5] = addr >> 16;
cmdGetDat[6] = addr >> 8;
cmdGetDat[7] = addr & 0xff;
}
cmdGetDat[8] = tail >> 16;
cmdGetDat[9] = tail >> 8;
cmdGetDat[10] = tail;//get reset of the pic data
write(port, cmdGetDat, sizeof(cmdGetDat));
if(readCamSaveToFile(port, file, tail))
return 1;
return 0;
}
int readCamSaveToFile(int port, int file, int size) {
unsigned char dataBuf[PIC_BUF_LEN];
while(size > 0) {
int n = read(port, dataBuf, size);
if(n <= 0) {
perror("read dataBuf");
return 1;
}
write(file, dataBuf, n);
size -= n;
}
return 0;
}
Since there is nothing else on the market at the moment (working on 5v cam module with easy API) i bought this one.
But i hoped to find the answers in the meantime on the exact same questions:
How do you switch to the QQVGA ?
How do you disable JPEG and get the frames RAW?
I know that the (chinese) reseller only gives the complete API/datasheet when you buy there stuff, and since seeedstudio bought a lot of those cam modules, could you please give us the complete manual/datasheet of the camera protocol?
I guess i can put (another) cam module in the trash again
Without the info i can’t do anything with this - except for using it as an overpayed webcam of some sort
Wished i went directly for the more expensive modules on the web that do deliver support and an API…
Hey, guys, seems you are so there. Sorry for the inconvenience brought.
On the documentation, you can find that there are two commands for capturing different type of pic.
Sorry to tell you that the module does not support the RAW data output. Maybe in the future we will provide one with that function.
For the datasheet of Serial Camera all we have is what you see now. We translated it from the Chinese version, and add an Arduino demo code. If that is not enough for you guys, please tell us where should we improve.
But the reason i’m has to do with my quest to get a camera module were i can process the RAW image on the fly.
In the description of this module it states that it is possible to get it RAW (and in QVGA or less) this is exactly what i need.
Also getting it over UART is a nice feature.
I figured that this would be a OV6620 cam module (since it powered by 5v) with the needed interface pre-soldered in a ‘brick’. Just like the CMUcam or other popular cam modules on the market.
But since the documentation is lacking a LOT of features (i really think that there is a lot more possible) we can’t do anything with it - except for capturing an image and send it to a sdcard … but why would i pay so much money for something that simple - you can buy a snap-cam for a few bucks.
So there must be a bigger use for this ‘brick’ - could you please contact your reseller again and ask for the complete technical document for this ‘brick’ ?
I almost know for sure that you can set a lot of registery options - also RAW and QVGA etc…