Subrata Camera Prese..

Report
Subrata Debnath
Team: T3
Fall 2011
 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).
 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.
 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.
Power On
Reset Camera
Create and Open empty JPEG File
Wait 4 Seconds
Take Picture
Transmit data and Write into JPEG File
Close JPEG File
Halt Camera
 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)
#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;
NewSoftSerial mySerial(4,5);
long int a=0x0000,j=0,k=0,count=0,i=0;
uint8_t MH,ML;
boolean EndFlag=0;
FAT TestFile;
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");
}
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);
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(" ");
}
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);
}
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);
}
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);
}
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;
}

similar documents