Skip to main content

Controlling OMTLE with Slim over BlueTooth serial?

bdodds's picture
Posted in

I just received a "BlueTooth Mate" from SparkFun to use as the serial link between my laptop and Arduino Pro running the OMTLE. The problem I'm running into is this. I can connect to the BlueTooth serial port in SLIM. (Or I think I can anyway...)

[1] > port /dev/tty.FireFly-2776-SPP
[2] > connect

but when I send any commands they just time out.

[3] > set_camera exposure 500
[_openmoco_command] ERROR: Timeout Reading from engine
[4] > set_camera cycle 1
[_openmoco_command] ERROR: Timeout Reading from engine

As a test of the BT serial connection, I used some simple code on my Arduino and the serial monitor in the Arduino IDE as well as screen in terminal. It printed a steady stream of ascending numbers that would reset to 0 when I pressed the letter R as expected, so it should work with SLIM too right? What could be the reason for SILM timing out when my tests of other the serial communications worked ok? Could it be that the BlueTooth connection is running to fast? (115200 baud by default)

I'm so looking forward to untethered control if this would only work!

Thank You

UPDATE: I figured out how to put the BlueTooth Mate into command mode and slow the serial communications down to 9600 baud and I'm still getting times outs in SLIM, so I guess it's not the speed. (changing back to 115200 now)

Bdodds, I hate to ask, but

Bdodds, I hate to ask, but it is working properly w/ slim with a direct (wired) connection? That error often indicates using the wrong library/slim version with the wrong firmware version - it's saying that it didn't get a complete command, and the engine is waiting for the rest of the data. (Hence the timeout.)

!c

Sorry, I have been busy and

bdodds's picture

Sorry, I have been busy and just got back to this.

Yes, it works as expected with the same SLIM on a hardwire USB connection.

Hmm. It sounds like the

Hmm. It sounds like the bluetooth is either not sending a complete instruction, or is not receiving a complete response. Any way to debug what its sending when pushed through slim? I.e., dump the bytes out and the bytes in?

!chris

I did a test with some simple

bdodds's picture

I did a test with some simple code loaded on the Arduino that was printing a steady stream of numbers over the connection and I could see the stream in the Arduino IDE serial monitor and had the Arduino listen for serial input that reset the stream to 0 when I sent R the other way.

I'm not sure how I would dump the byes IN and OUT of the SLIM connection over USB or BlueTooth... I have never dumped byes before. I'm still very green at all of this.

In theory from all I have read, this bluetooth connection should be invisible to ether side if the serial communications. (ie. no different than a wire)

I still have not been able to

bdodds's picture

I still have not been able to figure out why SILM never gets a response when I use a BlueTooth serial interface.

Is there a way I can send commands to the time-lapse engine without using SLIM to see if the engine responds?

You can send the raw bytes to

You can send the raw bytes to it, but you would be doing exactly what slim is doing =) The perfect scenario would be to somehow use another arduino as a pass-through, between slim and the BT device, and then logging info somehow. I'm certain the BT device has something going on which is causing the issue, it may be that it requires a specific number of bytes in a transaction or such.

Here's the documentation on the serial protocol: http://openmoco.org/node/140

!chris

I solved the problem at

bdodds's picture

I solved the problem at last!!! :)

I was about to return the BlueTooth module as a failed option for untethering my laptop from my dolly, when I stumbled on the simple solution...

I'm still so new to all this stuff, I forgot that the code on the Arduino sets the serial speed of the Arduino. Since I have only ever used a USB connection and everything always just worked over the USB I forgot to look for that line of code, but ran accress it when I was digging in the OMTLE code for clues. When I saw, Serial.begin(19200); a light went on and I knew what had to be done... I had tried several different speed settings for the BlueTooth Mate Module before, but I had not tried 19200. Oops. :)

So when I set my BlueTooth Mate to 19200, all was well and I can now control my dolly untethered from my laptop. :) So simple I feel really stupid now...

Now to find a GUI to control it that runs on Mac OS...

Awesome! And now you've just

Awesome! And now you've just helped the next person that does the same *grin*

!c

YEP!!! I think one of the

bdodds's picture

YEP!!!

I think one of the other things that thru me for a loop was that SLIM running in the OS X terminal didn't care about the serial port connection settings like using a serial terminal emulation application would. Are these settings hard coded into SLIM... ???

Yup, slim is coded to use the

Yup, slim is coded to use the same baud rate as the OM TL Engine - it's in the main slim script, line # 409. Remember, that just tells the two sides the timing, the connection will work with different timings, but the data will be garbage to each other =)

!c