Mindstorms NXT Bluetooth on OSX 7
Lego released the Mindstorms NXT Developer Kit today! I was bummed when I found out that the software that comes with it for OSX is PPC. Apps running under Rosetta are unable to access bluetooth so I couldn't play with in on my Macbook Pro. Now that the dev kit is available I plan on writing a ruby module to communicate with the NXT via bluetooth. First I had to figure out how to access it via a bluetooth serial port.
When I first got my NXT and found bluetooth no worky in NXT-G, I tried creating a serial port and connecting to it. It would connect, and show up as being on connection 0 on the NXT and no matter what I did, I couldn't get a message to show up in OSX. Connection 0 means the NXT thought it was a slave. It should still be able to send messages to it's master, yet I get nothing. Connections initiated on the NXT to the computer always came up Line is Busy.
I finally made a breakthrough today. I was doing some research and found that you can create an incoming bluetooth serial port and then connect to my computer from the NXT. Here's the steps:
Pair the NXT with OSX.
Go into the Bluetooth Preferences, Sharing tab and Add Serial Port Service. Give it a name (I made it NXT-Master). Set Type to RS-232. This will create a /dev/tty.NXT-Master device.
Open the device in OSX (this is important, otherwise you'll get a Line Is Busy message on the NXT) Just doing a cat /dev/tty.NXT-Master in a terminal will do it.
On the NXT, goto Bluetooth, My Contacts, Select your computer, Connect to whatever connection number you want.
Run a program on the NXT that sends a message to whatever connection number you chose.
Woot! The message should show up in terminal.
Trackbacks
Use the following link to trackback from your own site:
http://juju.org/articles/trackback/391
Juju
Hi Tony,
In your link to this article on lugnet, you didn't specify the "www" part of www.juju.org which renders the link unusable (gets redirected to some "in construction" thingy - at least on this PC).
That said - great info. I'm considering switching at last to Mac, and useability of the NXT kit on it is important to me.
You also might be interested to learn that, even the NXT app is PPC only at the moment, LEGO is said to release it as universal binary quite soon - although I don't know when or even if it is true. (I don't doubt that it is, but I never saw any official info about it)
http://juju.org doesn't work for you? That is strange. It should go to the same place. Does anyone else have this problem?
Yeah I was at a Big Robot on Campus event in Second Life and asked LEGO if they were going to release a Universal binary for intel macs. They said they were working on it and hope to release it sometime later this year. (or was it next year, I can't remember) I was looking into info on Labview (the software it's based on) and they are apparently close to releasing it.
Well it does work now - so I don't know; maybe it was temporary or I hadn't slept enough. Sorry for the trouble.
(Or maybe it has to do with the domain named, I see someone replied on lugnet that it had expired)
Damn Network Solutions... should be fixed now.
Tony, I dont get it working :( I have a Macbook and followed your instructions, but already at step #1 "Pair the NXT with OSX" it fails.
How do I pair them exactly? The steps I took was too delete all BT devices out of BT device list in the system preferences. Then I turned on BT (in OSX) turned on the NXT and made both visible. I tried pairing from OSX with passkey. All went well and the NXT brick asked me for the pass I gave in the OSX BT connection wizard. But then the wizard told me that the remote device has no services. I also tried pairing by searching from NXT side for BT devices. Same situation. It found the host computer and asked me to enter a passkey, it goes further and at last OSX asked me to provide the passkey. But then when I have to select the connection number on the NXT (I tried all) it gets "Line busy" and aborts. I think, this is not what a successful pairing should look like? I tried the serial port method you mentioned and all I get is line busy. And yes I did 'cat' the /dev/tty.NXT thing and all.
clueless! :-/ Can you help me find a way?
Initiate the pairing from OSX. You had it when you got the message saying the device has no services. This is because OSX doesn't understand the services it provides, just accept it. Once you do that, follow the rest of the steps to add a serial port service.
thanks so far.
i retried :-) but it's all the same :(
I do a "cat" and then I initiate a "searching" on the NXT. It connects, asks me for a connection number. Then on OSX the BT status icon at the top changes from, uhmm highlighted BT to a connected highlighted BT. And it still shows connecting... on the NXT. After 10secs the NXT aborts with "Line busy" and 4secs later the OSX BT icons goes to highlighted but unconnected again.
Strange....