What's a good strategy for using Bluetooth with multiple NXTs? PDF Print E-mail
Tuesday, 05 October 2010 21:25

Question

Jamie,

Met you when you were down in Cincinnati with your team to teach the advanced programming workshop. I wonder if you could field a question for me. I mentioned previously that I found a bluetooth adapter that works with the NXT and Win7 (it's a Belkin). My question now is what would be a good strategy for configuring the communications with the NXT bricks--I have two. I'm guessing that I want to configure both to use the same Bluetooth sync code (usually 1234, by default)? Then I can just turn off the one I don't want to download code to. Does that sound right? Also, I know it's possible to reset those codes on the NXT (one of them is not 1234), but I'm having trouble finding the right menu to do so..if you happen to know the correct hoops to jump through for this, please let me know.

Thanks!
Mark 

Answer 

Mark,

We do a fair bit of programming with multiple bricks connecting to various bricks with bluetooth.

The 1234 is not really a "sync code".  It is more like a seed key that's just part of the pairing.  It mainly helps prevent pairing with devices by mistake.  Imagine trying to pair with "NXT" at a big workshop.  You couldn't be sure of who you were pairing with unless you touched both ends and entered the same code on both ends.  That would be the one time I would use a different code as part of the pairing process.

There is some additional unique information that gets exchanged along with the seed key during the pairing process.  So, without doing some really funky stuff with firmware, or maybe even hardware, your computer will never think the 2 bricks are just 1 brick.  Once all of your bricks are paired you can skip doing the scan, and just do "connect" to the brick you want to talk to from the computer. 

If both bricks are paired with your laptop I probably wouldn't both to re-pair them just to reset the number.  But if you want to here's how you would.  On the brick, go into the address book, and delete the entry for your laptop.  On the laptop, go into the bluetooth configuration or settings and delete the entry for the trusted device that is your nxt brick.  Now, you can again initiate a search for bluetooth devices, go through the pairing process, and as a part of that re-enter/make up a new code. We always just use 1234 but it doesn't end up helping us out other than it's faster to hit OK on the pre-entered code than to enter your own just for the length of the pairing process.

Our preferred technique for managing multiple bricks is.

1. give all the bricks a unique name.  Our bricks are named CA Blue, CA White, CA Black, CA Green, CA Red, etc..  CA stands for Clintonville Academy, the school we all started out at, so in essence it identifies the brick as being one of my team's bricks.  And then the color is to keep them separate.  We now avoid using cute names because the kids would get emotionally attached to the robots once they had more human or more personal names. (and once they're emotionally attached to a robot they don't want to take it apart)

2. we make sure the brick we want to work with is turned on.

3. in NXT-G we "connect" to the brick regardless of whether or not it is listed as available.

4. as soon as it connects we download or whatever we needed to do.

If we are switching rapidly back and forth and aren't doing incremental development with bluetooth we might use a cable for faster switching.

If we are doing bluetooth development, i.e. programming the bluetooth interface itself, like to make one brick talk to another brick with bluetooth then we always use the cable.
 
Jamie 
 
Copyright © 2018 cougarrobot.com. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.