You can get this camera from SparkFun.


The document is not so good. There are so many bugs in it. So please check the camera protocols with my library sources.


Here is the connection of the sample program.

You can change the PinName at the constructor.

  • mbed to LS-Y201
  • p13(TX) to RxD
  • p14(RX) to TxD


There are two versions of the camera.

The one of the model is RS-232C interface.

The other is TTL interface model.

Please do NOT connect RS-232C interface model directly.

You can connect TTL interface model only.


Test program

#include "mbed.h"
#include "Camera_LS_Y201.h"
#include "SDFileSystem.h"

#define DEBMSG      printf
#define NEWLINE()   printf("\r\n")

#define USE_SDCARD 0

#define FILENAME    "/sd/IMG_%04d.jpg"
SDFileSystem fs(p5, p6, p7, p8, "sd");
#define FILENAME    "/local/IMG_%04d.jpg"
LocalFileSystem fs("local");
Camera_LS_Y201 cam1(p13, p14);

typedef struct work {
    FILE *fp;
} work_t;

work_t work;

 * Callback function for readJpegFileContent.
 * @param buf A pointer to a buffer.
 * @param siz A size of the buffer.
void callback_func(int done, int total, uint8_t *buf, size_t siz) {
    fwrite(buf, siz, 1, work.fp);

    static int n = 0;
    int tmp = done * 100 / total;
    if (n != tmp) {
        n = tmp;
        DEBMSG("Writing...: %3d%%", n);

 * Capture.
 * @param cam A pointer to a camera object.
 * @param filename The file name.
 * @return Return 0 if it succeed.
int capture(Camera_LS_Y201 *cam, char *filename) {
     * Take a picture.
    if (cam->takePicture() != 0) {
        return -1;

     * Open file.
    work.fp = fopen(filename, "wb");
    if (work.fp == NULL) {
        return -2;

     * Read the content.
    DEBMSG("%s", filename);
    if (cam->readJpegFileContent(callback_func) != 0) {
        return -3;

     * Stop taking pictures.

    return 0;

 * Entry point.
int main(void) {
    DEBMSG("Camera module");

    if (cam1.reset() == 0) {
        DEBMSG("Reset OK.");
    } else {
        DEBMSG("Reset fail.");
        error("Reset fail.");

    int cnt = 0;
    while (1) {
        char fname[64];
        snprintf(fname, sizeof(fname) - 1, FILENAME, cnt);
        int r = capture(&cam1, fname);
        if (r == 0) {
            DEBMSG("[%04d]:OK.", cnt);
        } else {
            DEBMSG("[%04d]:NG. (code=%d)", cnt, r);

The output

3 related questions:


15 Dec 2010

This is pretty impressive! Well done!

19 Dec 2010

I keep getting a reset value of 4 on my terminal (which indicates that it's not receiving information from the camera). Any thoughts on this?

19 Dec 2010

Dear Mr.Wojciech-san

Thanks! :)

Dear Mr.Diego-san

Hi. Did you check the connection of the camera?

p13(TX) to RxD of the camera p14(RX) to TxD of the camera.

Please check the connection.

Regards, Shin.

02 Jan 2011


The pins are indeed hooked up properly to the camera. Tell me, this camera has two different versions (one made before November of 2010 and one made after) and the one made after doesn't need the signal modifier required for the UART interface in the old model. Which camera are you using in this code?

02 Jan 2011

Benjamin Degn wrote:


The pins are indeed hooked up properly to the camera. Tell me, this camera has two different versions (one made before November of 2010 and one made after) and the one made after doesn't need the signal modifier required for the UART interface in the old model. Which camera are you using in this code?

Alright, I neglected to read your new note about the TTL/RS232C problem. I think my model might be an RS232C, so I'll get looking for a level-shifter to accompany it and see if that solves the problem. Thanks!

02 Jan 2011

Dear Mr.Diego Tasso-san

Hi. Thank you for your post. :)

My camera does not have a TTL level converter on the board. Please see the picture below.


I hope this helps you.

Regards Shin.

18 Feb 2011

Just got a new one from Sparkfun and it now has a JST connector - photos are out of date. It does not come with the strange JST cable & connector you need to hook it up - So be sure and order one from Sparkfun if you get a camera!

and cable is

11 Apr 2011

Here is something I made with this library. Thank you thank you thank you!

15 Apr 2011


Sorry if I am asking something stupid, but I tried compiling the code that you provided, and it says that the identifier lcd is not recognized. What is the lcd variable supposed to be? Thanks!

18 May 2011

Dear Shin san, The test program does not fit to the latest release of the library.

02 May 2012

Does anyone know how fast the camera can take pictures? I want to use it as a sort of "surveilance" camera and have a constant stream of images/video. (it also must run over IP...)

28 May 2012


Where is the code for library "SDFileSystem.h".

Can someone help me please...

30 May 2012

Hello Nakamura,

I am using libraries with Mbed NXP LPC1768 and Camera_LS_Y201 .

I want to change baud rate of serial communication. Can u help me in this regard.

Best wishes and thanks for a good coding.


01 Jul 2012

The new document from linksprite can be found from

08 Nov 2012

Hi could you please explain me where i can see the it on hyperterminal. please explain the steps in the code Thank you

17 Dec 2012

Sparfkfun just starting selling one without the IR filter - so it sees IR and also has IR LEDs.

P.S. Be sure and order the JST connector needed at the same time as the camera, if it does not come with the camera! Some of mine did not include the cable on the "regular light" camera.

06 Mar 2013

I have tried to set up multiple definitions to the same serial with this camera through the multiplexers, and it refuses to work when I assign things like that:

Camera_LS_Y201 cam1(p9, p10); ID12RFID rfid(p10); SMARTWAV sWav(p9,p10,p11); (TX,RX,Reset);

Both ID12 and SMARTWAVE work well , but camera just gives fail reset right away. Does anybody know how to fix this issue , what can be modified in the library to support single serial port to multiple devices?

Thank you.

29 Mar 2014

Hello All,

I am doing project based on Y201 camera. I am interfacing the camera with smart fusion using Uart interface. I am facing problems. Could any one please help.. I have the following doubts.

As part of taking picture,

I am sending

1. Take picture command 2. Read picture file size. I am getting 49 bytes as read picture file size.. Can I know what is might be the problem.

Second problem:

First I am giving reset command. 2. When I gave take picture command next, I am not getting the expected response from the camera. Could I know when I can call reset.

I read I should call reset only after change resolution of the picture. Is it a constraint. Please give your valuable feed back.

Could you please let me know what commands i should give for taking the picture and reading the contents of the captured picture. thanks..