Pages: [1]   Go Down
Author Topic: Arduino Uno R3 and Linksprite LS-Y201 Serial Transmission Problem  (Read 2377 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been trying to get the camera to work for awhile now, and it just isn't having it.
I'll post my code and the responses I've been getting, and we'll see if anyone has any input.

I'm using the JPEGCamera library, which I've slightly modified to work with Software Serial, and added a few functions to set the baud rate and change the camera picture size. The code for the library will be posted below as well.

Currently, the camera is correctly set to take pictures that are 160x120, and the baudrate is set for 38400.

All attempts to change the baud rate have ended in miserable failure, even after multiple power cycling on the camera, and changing the code to work with a new baud rate.

My Code
http://pastebin.com/qK7JpcVJ

JPEGCamera Library, Modified
http://pastebin.com/1T5W3qbV

The Datasheet

My Data

I would have posted using the normal code format, but the post was too long.

The problem I've been having is the transmission speed, and the fact that I'm getting an incorrect response from the camera when I send the read data command.
The camera takes probably 10 minutes to transmit a 3.8k file to the arduino, which I believe is an indication that something is wrong.

I have read about Serial latency issues on Arduino, and I downloaded the changed rxtxSerial.dll, but that has changed nothing so far.

I'll post the responses I've been getting and debugging data shortly.

So, the responses for the reset, take picture, and getsize command all come in alright.
Then, as soon as I start requesting data, the 5 bytes before the colon should be 76 00 32 00 00, every single time, if I'm not mistaken.
« Last Edit: December 08, 2012, 07:14:01 pm by horotho » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been struggling with this camera myself recently!

Have you tried the sketch on the linksprite website? Using that (under windows) I can get a picture that makes sense. I can see from the data that you posted that the camera isn't giving a valid jpeg (it should start ff d8...).

Thank,

Alex
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I tried out your code but can't get any response from the camera. All I get is:
BEGUN
Camera finished initializing.
Resetting Camera

The program stops after:
Code:
count = camera.reset(response);

Any suggestions?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can try this library, and one the of examples there: one for HW serial the other for software serial:
http://code.google.com/p/linksprite-serial-cam-arduino/

I get perfect results with it and pretty fast (even for the higher res pictures of 640x480).
HTH
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried your code but no chance, the program stops at
Code:
cam.takePicture();
. There is no response from the camera.
May be I have the wrong camera: I should have the TTL-camera, the backside looks like the attached picture.

Thanks
Pascal


* ls_y201bs_02.jpg (663.21 KB, 1280x960 - viewed 58 times.)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It definitely does not look the same as mine! So I am not sure if it will work. I know someone else is working with the code on the google code site and it works. Sorry.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can get the picture as below, but there is always distoration on the picture. Any idea why?


* xiaohui.jpg (92.16 KB, 640x480 - viewed 64 times.)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used to have this "banding" effect when there were transmission errors: too high baudrate with software serial, or also when I was not transferring correctly the picture; in order to do it correctly you must read and store in RAM a chunk (size is not critical, but IIRC it must be a multiple of 8 bytes). Then you transfer the whole chunk. In brief do not read on serial one byte and write it directly, it seems to confuse the hardware.
You can have a loook at how it is done in my library.
HTH
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the responses. I am using 32 bytes for one "chunk" in reading from LS-Y201 TTL camera, and writing into an SD card, and yet still receiving the "banding" bars on every photo. I am also trying to use your code, but failed in compiling process. Could you please forward your libraries, and advise where shall I place these libraries? Thanks.

Regards,
Terry.
 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear HTH,

Problem resolved by changing transmission rate to 19200.  smiley-grin

However, may I ask how long it takes to complete a 640x480 picture transmission in your code? My program will take about 60 seconds to complete the whole transmission and the size is around 100K bytes.

Thanks again.



 
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 56
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, I think a 640x480 is more or less 40kB for me; so it takes around 9-10s to upload it to the arduino using a baudrate of 38400.
But then you also need to tranfer it (either to sd or via a serial interface to a PC or ...).
Logged

Pages: [1]   Go Up
Jump to: