Go Down

Topic: Linux + Arduino + Linksprite LS-Y201 + SoftwareSerial (Read 1 time) previous topic - next topic


Hi all,

I am currently trying to use the above camera (https://www.sparkfun.com/products/10061?) with an Arduino Uno in one of my projects; however, I cannot get the camera to communicate properly via the SoftwareSerial port under Linux (currently using Mint 13).  When I send a command to the camera I don't get back the expected response - for example (from the manual):

send >> 0x56 0x00 0x26 0x00 (reset)
recv << 0xF6 0x80 0x93 0x80 0xC0 0xD6 0xA1 ... (expected  0x76 0x00 0x26 0x00)

After many days / weeks puzzling at this, I turned to the dark side ]:D and uploaded my code via a windows machine - and now I get the expected response ... I can even receive the correct response from the Linux serial monitor - providing the code was uploaded from Windows ...

Can anybody provide any sort of explanation for this behaviour?  Is there any logical reason why the compiled code should be different?  And is there anything I can do about it?

Many thanks,



The 38400 could be close to the maximum of the SoftwareSerial library.

The codes you read seems like a baudrate mismatch. If you are sure that the baudrate is set properly, it might have to do with optimazations or different versions of the Arduino IDE.

If you have Arduino installed from the repositories, you have an older version.
The behaviour in Windows and Linux should be the same if the same version of the Arduino IDE was used.


The software serial library claims speeds of up to 115200 - though I have not tested this.  In simple serial communication it can do 57600 easily though.

If I change the baudrate at all, then the camera fails to transmit anything.

Bizarrely the same sketch compiles to different sizes under both Linux and Windows (using the same version of the IDE - 1.0)!

This is the code:

Code: [Select]

* latest version of the camera tester - 09-12-2012

#include <SoftwareSerial.h>

SoftwareSerial camport(10,11);

void setup()
  // set up the software serial pins properly
  // rx = input, tx = output
  pinMode(10, INPUT);
  pinMode(11, OUTPUT);

void loop()
  // send a command to the camera
  Serial.println("resetting camera");
  // try and read the camera response
  while(camport.available() > 0)
    byte inByte = camport.read();
    Serial.print(inByte, HEX);
    Serial.print(" ");   
  // stop

// send the reset command to the camera: 0x56 0x00 0x26 0x00
void resetCamera()
  byte resetCmd[4] = {0x56, 0x00, 0x26, 0x00}; 
  camport.write(resetCmd, 4);

Which weighs in at 5056 bytes under Windows and 4688 bytes in Linux.

I am about to try the very latest Linux version - will report how that goes!

Thanks for your help,



Well, the latest Arduino IDE version under Linux behaved exactly the same ...

I have noticed as well that the blink sketch compiles to different sizes under both Linux and Windows - I assume that this must be something to do with the toolchain / gcc-avr version.

It looks like my only solution to use these cameras is to program them under Windows!  However, I'm not sure I'll be using them very much as they aren't very capable.  They are OK if you need to take occasional still images (1 per minute at best), but the resolution isn't great and they are slow.

I'm still baffled by the difference though and would dearly love to figure it out!



You can try this library: https://code.google.com/p/linksprite-serial-cam-arduino/
It works up to 19200 with software serial and up to 115200 with hardware serial.

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview