Go Down

Topic: remoteCamera (Read 1 time) previous topic - next topic

Dread-Eye

A camera that sends images wirelessly to your computer:

http://peace.dreadeye.com/2012/10/remotecamera.html
http://peace.dreadeye.com

sbright33

I have made something similar.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Dread-Eye

I would love to hear more.  Do you have any photos or code to share?
http://peace.dreadeye.com

sbright33

This is the simplest version I can find.  I also wrote code to detect motion, and only send the image when it changes.

Code: [Select]

#define FLUSH Serial.flush()
#define WR(s) Serial.print(s)
#define WR13 Serial.write(10);
#define WR32 Serial.write(32);
#define HALT {while(1);}
#define CMD(x,var) for(cii=0;cii<x;cii++)Serial.print(var[cii])
//#define DEBUG1 WR13 for(i=0;i<5;i++){Serial.print( int(Serial.read()),HEX);WR32} WR13
//#define DEBUG2 WR13 for(i=0;i<5;i++){Serial.print(char(Serial.read())    );WR32} WR13
char length[] ={0,0,0,0};
char cmdRST[] ={0x56,0,0x26,0}; //reset then >10ms
char cmdCAP[] ={0x56,0,0x36,1,0};
char cmdLEN[] ={0x56,0,0x34,1,0};
char cmdCON[] ={0x56,0,0x36,1,2};
char cmdGET[] ={0x56,0,0x32,0x0c,0,10,0,0,0,0,0,0,0,0,0,10}; //x=16 10*0.01ms
//x=9:
//0x36,d10-80 is 56k-8k from CommTool, here 40-255
char cmdCMP[] ={0x56,0,0x31,5,1,1,0x12,4,0x36};
char cmd640[] ={0x56,0,0x31,5,4,1,0,0x19,0};
char cmd320[] ={0x56,0,0x31,5,4,1,0,0x19,0x11};
char cmdOFF[] ={0x56,0,0x3e,3,0,1,1}; //[6]=1,0 x=7,30ma,60ma
//char cmdBAU[] ={0x56,0,0x24,3,1,0xae,0xc8}; //9600
int i,j,cii;
unsigned int picLen;

void setup(){
pinMode(13,OUTPUT);
Serial.begin(115200);
CMD(4,cmdRST);delay(500);FLUSH;  //need time to get long string
cmdCMP[8]=200;
CMD(9,cmdCMP);delay(10);
//CMD(9,cmd320);delay(10);  //remembers even with long power off how?  causes bad image corrupt?
//still in R buffer OK?
}
void loop(){
digitalWrite(13,1);
CMD(5,cmdCAP);delay(60);  //try while instead?
digitalWrite(13,0);
CMD(5,cmdLEN);
FLUSH;  //wrong order on purpose
while(Serial.available()<9) ;
for(i=0;i<5;i++)Serial.read();
for(i=0;i<4;i++)length[i]=Serial.read();
picLen=((unsigned int)length[2])*256 +int(length[3]);
getdata(picLen); 
CMD(5,cmdCON);
}
void getdata(unsigned int len){
const int BSIZE=64;
int count=len/BSIZE;
//int tail=len&(BSIZE-1);
unsigned int addr=0;
cmdGET[6]=cmdGET[7]=cmdGET[8]=cmdGET[9]=0;
cmdGET[13]=BSIZE;
for(int i=0;i<count;i++){  //last 4 corrupted anyway
  CMD(16,cmdGET);
  delay(9); //10
  //if(Serial.available()!=BSIZE+10)HALT
  addr+=BSIZE;
  cmdGET[8]=addr>>8;
  cmdGET[9]=addr;
  }
FLUSH;
}
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

sbright33

Anyone try my code above?
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Go Up