Difference between revisions of "JPEG Color Camera Serial Interface (RS232 level)"

From LinkSprite Playgound
Jump to: navigation, search
(Package List)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
== Description ==
 +
 
LS-Y201 is LinkSprite’s new generation serial port camera module. It can captures high resolution pictures using the serial port. LS-Y201 is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.
 
LS-Y201 is LinkSprite’s new generation serial port camera module. It can captures high resolution pictures using the serial port. LS-Y201 is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.
  
Model:CAM_JPEG_RS232
+
== Package List ==
 +
*1 X [CAM_JPEG_RS232][201201002]
 +
*1 X [IT_CAM_CAB ][AA101102]
 +
 
 +
 
 +
 
 +
Model: [CAM_JPEG_RS232][201201002]
  
 
[[File:camerattl.jpg | 400px]]
 
[[File:camerattl.jpg | 400px]]
 +
 +
Cable included: [IT_CAM_CAB ][AA101102]
 +
 +
[[File:IT_CAM_IR_CAB-1.jpg]]
  
 
== Features  ==
 
== Features  ==
 
  
  
Line 49: Line 60:
  
 
== Usage  ==
 
== Usage  ==
 +
=== Hardware Installation  ===
 +
'''Evaluation Setup'''
 +
 +
[[File:evasetup.jpg]]
 +
 +
=== Programming  ===
 +
[[File:evascreenshot.jpg]]
 +
 +
*Step 1: Click Open COM
 +
*Step 2: Click Single Shot.
 +
 +
'''''Arduino sample code provided'''''
 +
 +
<syntaxhighlight lang="c">
 +
 +
/* Linksprite */
 +
 +
#include <NewSoftSerial.h>
 +
 +
byte incomingbyte;
 +
NewSoftSerial mySerial(4,5);                    //Configure pin 4 and 5 as soft serial port
 +
int a=0x0000,j=0,k=0,count=0;                    //Read Starting address     
 +
uint8_t MH,ML;
 +
boolean EndFlag=0;
 +
                             
 +
void SendResetCmd();
 +
void SendTakePhotoCmd();
 +
void SendReadDataCmd();
 +
void StopTakePhotoCmd();
 +
 +
void setup()
 +
{
 +
  Serial.begin(19200);
 +
  mySerial.begin(38400);
 +
}
 +
 +
void loop()
 +
{
 +
    SendResetCmd();
 +
    delay(4000);                              //After reset, wait 2-3 second to send take picture command
 +
     
 +
      SendTakePhotoCmd();
 +
 +
    while(mySerial.available()>0)
 +
      {
 +
        incomingbyte=mySerial.read();
 +
 +
      } 
 +
      byte a[32];
 +
     
 +
      while(!EndFlag)
 +
      { 
 +
        j=0;
 +
        k=0;
 +
        count=0;
 +
        SendReadDataCmd();
 +
 +
        delay(25);
 +
          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))      //Check if the picture is over
 +
              EndFlag=1;                         
 +
              j++;
 +
      count++;
 +
              }
 +
          }
 +
       
 +
          for(j=0;j<count;j++)
 +
          {  if(a[j]<0x10)
 +
              Serial.print("0");
 +
              Serial.print(a[j],HEX);
 +
              Serial.print(" ");
 +
          }                                      //Send jpeg picture over the serial port
 +
          Serial.println();
 +
      }     
 +
    while(1);
 +
}
 +
 +
//Send Reset command
 +
void SendResetCmd()
 +
{
 +
      mySerial.print(0x56, BYTE);
 +
      mySerial.print(0x00, BYTE);
 +
      mySerial.print(0x26, BYTE);
 +
      mySerial.print(0x00, BYTE);
 +
}
 +
 +
//Send take picture command
 +
void SendTakePhotoCmd()
 +
{
 +
      mySerial.print(0x56, BYTE);
 +
      mySerial.print(0x00, BYTE);
 +
      mySerial.print(0x36, BYTE);
 +
      mySerial.print(0x01, BYTE);
 +
      mySerial.print(0x00, BYTE); 
 +
}
 +
 +
//Read data
 +
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;                            //address increases 32,set according to buffer size
 +
}
 +
 +
void StopTakePhotoCmd()
 +
{
 +
      mySerial.print(0x56, BYTE);
 +
      mySerial.print(0x00, BYTE);
 +
      mySerial.print(0x36, BYTE);
 +
      mySerial.print(0x01, BYTE);
 +
      mySerial.print(0x03, BYTE);       
 +
}
 +
 +
</syntaxhighlight>
 +
 +
 +
== Resource ==
 +
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201evaluationsoftware.exe Evaluation Software]
 +
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LSY201.rar Linksprite Open Source Code for X86]
 +
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/JPEG_UART_camera_tutorial.pdf Tutorial at LinkSprite]
 +
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LS-Y201+product+Specifications.pdf LS-201_product_specification]

Latest revision as of 09:51, 13 August 2014

Description

LS-Y201 is LinkSprite’s new generation serial port camera module. It can captures high resolution pictures using the serial port. LS-Y201 is a modular design that outputs JPEG images through UART, and can be easily integrated into existing design.

Package List

  • 1 X [CAM_JPEG_RS232][201201002]
  • 1 X [IT_CAM_CAB ][AA101102]


Model: [CAM_JPEG_RS232][201201002]

Camerattl.jpg

Cable included: [IT_CAM_CAB ][AA101102]

IT CAM IR CAB-1.jpg

Features

Application Ideas

  • Different image capture systems
  • Environmental monitoring
  • Industry monitoring
  • Medical equipment
  • Video phone
  • Security
  • Vehicle based GPS

Cautions

The warnings and wrong operations possible cause dangerous.


Schematic

Specification

  • VGA/QVGA/160*120 resolution
  • Support capture JPEG from serial port
  • Default baud rate of serial port is 38400
  • DC 3.3V or 5V power supply
  • Size 32mm X 32mm
  • Current consumption: 80-100mA
  • The pin near C03 is AV output pin, which is an analog output pin.

Pin definition and Rating

Mechanic Dimensions

Usage

Hardware Installation

Evaluation Setup

Evasetup.jpg

Programming

Evascreenshot.jpg

  • Step 1: Click Open COM
  • Step 2: Click Single Shot.

Arduino sample code provided

<syntaxhighlight lang="c">

/* Linksprite */

  1. include <NewSoftSerial.h>

byte incomingbyte; NewSoftSerial mySerial(4,5); //Configure pin 4 and 5 as soft serial port int a=0x0000,j=0,k=0,count=0; //Read Starting address uint8_t MH,ML; boolean EndFlag=0;

void SendResetCmd(); void SendTakePhotoCmd(); void SendReadDataCmd(); void StopTakePhotoCmd();

void setup() {

 Serial.begin(19200);
 mySerial.begin(38400);

}

void loop() {

    SendResetCmd();
    delay(4000);                               //After reset, wait 2-3 second to send take picture command
     
     SendTakePhotoCmd();
    while(mySerial.available()>0)
     {
       incomingbyte=mySerial.read();
     }   
     byte a[32];
     
     while(!EndFlag)
     {  
        j=0;
        k=0;
        count=0;
        SendReadDataCmd();
        delay(25);
         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))      //Check if the picture is over
              EndFlag=1;                           
              j++;

count++;

              }
         }
        
         for(j=0;j<count;j++)
         {   if(a[j]<0x10)
             Serial.print("0");
             Serial.print(a[j],HEX);
             Serial.print(" ");
         }                                       //Send jpeg picture over the serial port
         Serial.println();
     }      
    while(1);

}

//Send Reset command void SendResetCmd() {

     mySerial.print(0x56, BYTE);
     mySerial.print(0x00, BYTE);
     mySerial.print(0x26, BYTE);
     mySerial.print(0x00, BYTE);

}

//Send take picture command void SendTakePhotoCmd() {

     mySerial.print(0x56, BYTE);
     mySerial.print(0x00, BYTE);
     mySerial.print(0x36, BYTE);
     mySerial.print(0x01, BYTE);
     mySerial.print(0x00, BYTE);  

}

//Read data 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;                            //address increases 32,set according to buffer size

}

void StopTakePhotoCmd() {

     mySerial.print(0x56, BYTE);
     mySerial.print(0x00, BYTE);
     mySerial.print(0x36, BYTE);
     mySerial.print(0x01, BYTE);
     mySerial.print(0x03, BYTE);        

}

</syntaxhighlight>


Resource