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

From LinkSprite Playgound
Jump to: navigation, search
(Introduction)
(Introduction)
 
(32 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
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.
  
[[File:camerattl.jpg | 400px]]
+
[[File:CAM_JPEG_TTLUART 19.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 20.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 2.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 3.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 5.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 8.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 14.jpg|640px]]
 +
 
 +
[[File:CAM_JPEG_TTLUART 21.jpg|640px]]
 +
 
 +
== Package List ==
 +
 
 +
*1 X [CAM_JPEG_TTLUART][201201001]
 +
*1 X [IT_CAM_CAB ][AA101102]
 +
 
 +
 
 +
 
 +
Model: [CAM_JPEG_TTLUART][201201001]
 +
 
 +
[[File:CAM_JPEG_TTLUART 2.jpg|640px]]
 +
 
 +
Cable included: [IT_CAM_CAB ][AA101102]
 +
 
 +
[[File:CAM_JPEG_TTLUART 18.jpg|640px]]
 +
 
 +
== Dimension ==
 +
 
 +
[[File:JPEG camera dimension.png]]
 +
 
 +
[[File:JPEG camera Outside dimension.png]]
 +
 
  
 
== Features  ==
 
== Features  ==
Line 12: Line 48:
 
== Application Ideas  ==
 
== Application Ideas  ==
  
 
+
*Different image capture systems
 +
*Environmental monitoring
 +
*Industry monitoring
 +
*Medical equipment
 +
*Video phone
 +
*Security
 +
*Vehicle based GPS
  
 
== Cautions  ==
 
== Cautions  ==
Line 26: Line 68:
 
== Specification  ==
 
== 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  ==
 
== Pin definition and Rating  ==
Line 41: Line 89:
  
 
=== Hardware Installation  ===
 
=== 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();
  
=== Programming  ===
+
        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>
  
 
== FAQ  ==
 
== FAQ  ==
  
 +
*Q: What is the maximum size data that can be read from "Read JPEG file content" - can I read the entire JPEG file in one operation (assuming that the data size read is a multiple of 8 bytes)?
 +
 +
:A: Because of the different background, the size of the images are not the same.But you can read the data of image size.Manual inside has this command. You can read the entire JPEG file in one operation
 +
 +
*Q: The datasheet that was sent to me says that the "Maximum HS-UART Interface BPS" is 921.6kbps and I would like to understand how to reach a higher speed than 115.2kbps.
 +
 +
:A: The highest is 115200.
 +
 +
*Q: Could you please clearly explain how "Stop taking pictures" works and why it is necessary? Does it have to be executed before I can take another picture? What is it's timing information?
  
Please list your question here:
+
:A: Send take picture, the camera will have been taking pictures, and middle time interval is very short(can ignore).
  
 +
Send stop taking pictures reason:
  
 +
:Because I take one picture that the camera image data is stored in the buffer,then immediately take another picture.
 +
 +
:But before you take another picture,you must be send the stop taking pictures.Otherwise picture won't update.
  
 
== Support  ==
 
== Support  ==
  
 
+
If you have questions or other better design ideas, you can go to our [http://www.linksprite.com/forum/index.php forum] to discuss or creat a ticket for your issue at [http://www.linksprite.com/support/ linksprite support].
  
 
== Resources  ==
 
== Resources  ==
 
+
*[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]
 +
*[http://www.fezzer.com/project/220/linksprite-camera-library/ .Net micro framework source code]
 +
*[https://github.com/nosebleed/jpeg-ttl-cam Github]
 +
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LS-Y201+product+Specifications.pdf LS-201_product_specification]
 +
*[https://s3.amazonaws.com/linksprite/camera/JPEG_camera_uartinterface_TTL/LinkSprite+JPEG+Color+Camera+User+Manual++V1.2.pdf User Manual]
 +
*[http://www.cutedigi.com/blog/?p=41 A tutorial of LinkSprite JPEG camera]
  
 
== How to buy  ==
 
== How to buy  ==
  
Here to buy ATWIN Quad-band GPRS/GSM Shield for Arduino [http://www.linkspritedirect.com/product_info.php?products_id=126 Cuhead-WiFi-Shield-Mega] on LinkSprite [http://www.linkspritedirect.com/index.php Cart]
+
Here to buy on LinkSprite [http://www.linkspritedirect.com/index.php Cart]
 
 
  
 
== See Also  ==
 
== See Also  ==

Latest revision as of 09:09, 24 November 2016

Introduction

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.

CAM JPEG TTLUART 19.jpg

CAM JPEG TTLUART 20.jpg

CAM JPEG TTLUART 2.jpg

CAM JPEG TTLUART 3.jpg

CAM JPEG TTLUART 5.jpg

CAM JPEG TTLUART 8.jpg

CAM JPEG TTLUART 14.jpg

CAM JPEG TTLUART 21.jpg

Package List

  • 1 X [CAM_JPEG_TTLUART][201201001]
  • 1 X [IT_CAM_CAB ][AA101102]


Model: [CAM_JPEG_TTLUART][201201001]

CAM JPEG TTLUART 2.jpg

Cable included: [IT_CAM_CAB ][AA101102]

CAM JPEG TTLUART 18.jpg

Dimension

JPEG camera dimension.png

JPEG camera Outside dimension.png


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>

FAQ

  • Q: What is the maximum size data that can be read from "Read JPEG file content" - can I read the entire JPEG file in one operation (assuming that the data size read is a multiple of 8 bytes)?
A: Because of the different background, the size of the images are not the same.But you can read the data of image size.Manual inside has this command. You can read the entire JPEG file in one operation
  • Q: The datasheet that was sent to me says that the "Maximum HS-UART Interface BPS" is 921.6kbps and I would like to understand how to reach a higher speed than 115.2kbps.
A: The highest is 115200.
  • Q: Could you please clearly explain how "Stop taking pictures" works and why it is necessary? Does it have to be executed before I can take another picture? What is it's timing information?
A: Send take picture, the camera will have been taking pictures, and middle time interval is very short(can ignore).

Send stop taking pictures reason:

Because I take one picture that the camera image data is stored in the buffer,then immediately take another picture.
But before you take another picture,you must be send the stop taking pictures.Otherwise picture won't update.

Support

If you have questions or other better design ideas, you can go to our forum to discuss or creat a ticket for your issue at linksprite support.

Resources

How to buy

Here to buy on LinkSprite Cart

See Also

Other related products and resources.


Licensing

This documentation is licensed under the Creative Commons Attribution-ShareAlike License 3.0 Source code and libraries are licensed under GPL/LGPL, see source code files for details.