BlueSmirf

hello,

I am having some problems using the bluesmirf with processing. I keep getting a Serial. error in a quite random manner - about 60% of the times. Another 35% i get a serial port is busy message and on a 5% basis i get a functioning connection. I’m starting to think it just doesn’t like me. Can you please point me in the right direction? this is kind of driving me crazy. btw in zterm and arduino serial monitor i get a “busy” error in a pretty random fashion too. I did try creating and setting permissions on /var/lock, but it did not help.

Thank you,

Davide

Ok,

I am beginning to have a normal relationship with my bluesmirf. I found some difficulties getting around some problems, I just thought i would post all the answers I found scattered on the web here in one place. Just so you know, i am doing this on Mac OS Lion.

BlueSMiRF stops sending data after ~15 seconds:

when the baud rate is high (e.g. 115200,57600) you should enter command mode immediately and type “F,1”

Arduino serial monitor and processing sketches can enter command mode, but not actually do any configuration:

in arduino sm you should select the “both NL and CR” option from the drop down menu, in processing you should send the command as in “\n\r”

Randomly working connection:

setting an infinite configuration timer (“ST,255”) seems to do the trick. Don’t have the slightest idea why.

How to check if the BlueSMiRF is connected without opening a port in processing:

since the serial port created for the BS is permanent unlike the regular ftdi one, i found this method for checking if the connection is actually available. In processing, use the following code (http://forum.processing.org/topic/runni … processing):

void setup() {
   String[] s;
   String commandToRun = "stty -f "+Serial.list()[l];
   a=RunCommand(commandToRun);
   s=match(a, "speed");
   if (s!=null) println("ok to connect")
}


String RunCommand(String commandToRun) {
    File workingDir = new File("/dev");   // where to do it - should be full path
    String returnedValues="";                                                                     // value to return any results
    try {
        Process p = Runtime.getRuntime().exec(commandToRun, null, workingDir);
        int i = p.waitFor();
        if (i == 0) {
            BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
            while ( (returnedValues = stdInput.readLine ()) != null) {
                return returnedValues;
            }
        }
        else {
            BufferedReader stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
            while ( (returnedValues = stdErr.readLine ()) != null) {
                return returnedValues;
            }
        }
    }  
    
    catch (Exception e) {
        println("Error running command!");  
        println(e);
    }
    return "error";
}

with “l” being the BS’s array position.

What does SMiRF not mean?

surely it can’t be http://en.wikipedia.org/wiki/SMIRF

I still have some problems, if I can figure them out i shall post here.

Davide