150 likes | 280 Views
Implementing a JPEG Camera Module on the Rover. Subrata Debnath Team: T3 Fall 2011. Objective (on progress). Configuring the camera module to work with the Arduino Uno ( ATmega 328p). Mounting the camera module on the Rover and take pictures ( on progress).
E N D
Implementing a JPEG Camera Module on the Rover SubrataDebnath Team: T3 Fall 2011
Objective (on progress) • Configuring the camera module to work with the Arduino Uno (ATmega 328p). • Mounting the camera module on the Rover and take pictures (on progress). • Using the camera module during the mission to take pictures of the targets/plaques (on progress).
Parts List • Arduino Uno. • Linksprite serial JPEG Camera (TTL interface). • microSDHC 16gb Card with FAT32 filesystem (SD card of equal or under 2gb and FAT16 file system preferred). • Adapter for microSD cards (optional if SD card is used). • SD card breakout board (included level shifter for 3.3v to 5v translation preferred). • Wires.
How does it Work? • The camera module captures JPEG images of low to mid ranged resolution (160 X 120 – 640 X 480). • It’s able to transmit raw image data (HEX) over serial port. • Using Arduino’s USART subsystem, the camera can transmit the data and store it in the memory card. • Default baud rate for transmission of data is 38400 Hz and default baud rate for storing data in memory card is 9600 Hz.
Future Research/Development • Reading the camera’s TVOUT signal and transmitting a live video wirelessly for augmented reality projects. • Replacing the IR sensor with the camera and processing the incoming video to measure the distance of the targets/plaques for the mission (if at all possible by the processing power of ATmega 328p)
Sample Program (Codes) #include <NewSoftSerial.h> #include <byteordering.h> #include <fat.h> #include <FAT16.h> #include <fat_config.h> #include <partition.h> #include <partition_config.h> #include <sd-reader_config.h> #include <sd_raw.h> #include <sd_raw_config.h> byte incomingbyte; NewSoftSerialmySerial(4,5); long int a=0x0000,j=0,k=0,count=0,i=0; uint8_t MH,ML; booleanEndFlag=0; FAT TestFile;
Continued void SendResetCmd(); void SetBaudRateCmd(); void SetImageSizeCmd(); void SendTakePhotoCmd(); void SendReadDataCmd(); void StopTakePhotoCmd(); void setup() { Serial.begin(38400); mySerial.begin(38400); if(!sd_raw_init()) { while(1); } TestFile.initialize(); TestFile.create_file(“plaque1"); }
Continued void loop() { byte a[32]; SendResetCmd(); delay(4000); SendTakePhotoCmd(); while(mySerial.available()>0) { incomingbyte=mySerial.read(); } TestFile.open(); while(!EndFlag) { j=0; k=0; count=0; SendReadDataCmd(); delay(20);
Continued while(mySerial.available()>0) { incomingbyte=mySerial.read(); k++; if((k>5)&&(j<32)&&(!EndFlag)) { a[j]=incomingbyte; if((a[j-1]==0xFF)&&(a[j]==0xD9)) EndFlag=1; j++; count++; } } for(j=0;j<count;j++) { if(a[j]<0x10) Serial.print("0"); Serial.print(a[j],HEX); Serial.print(" "); }
Continued TestFile.write((char*)a); Serial.println(); i++; } TestFile.close(); Serial.print(“Done Storing"); while(1); } void SendResetCmd() { mySerial.print(0x56, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x26, BYTE); mySerial.print(0x00, BYTE); }
Continued void SetImageSizeCmd() { mySerial.print(0x56, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x31, BYTE); mySerial.print(0x05, BYTE); mySerial.print(0x04, BYTE); mySerial.print(0x01, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x19, BYTE); mySerial.print(0x11, BYTE); } void SetBaudRateCmd() { mySerial.print(0x56, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x24, BYTE); mySerial.print(0x03, BYTE); mySerial.print(0x01, BYTE); mySerial.print(0xAE, BYTE); mySerial.print(0xC8, BYTE); }
Continued void SendTakePhotoCmd() { mySerial.print(0x56, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x36, BYTE); mySerial.print(0x01, BYTE); mySerial.print(0x00, BYTE); } void StopTakePhotoCmd() { mySerial.print(0x56, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x36, BYTE); mySerial.print(0x01, BYTE); mySerial.print(0x03, BYTE); }
Continued void SendReadDataCmd() { MH=a/0x100; ML=a%0x100; mySerial.print(0x56, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x32, BYTE); mySerial.print(0x0c, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x0a, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x00, BYTE); mySerial.print(MH, BYTE); mySerial.print(ML, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x20, BYTE); mySerial.print(0x00, BYTE); mySerial.print(0x0a, BYTE); a+=0x20; }