Page 1 of 1

Problems understanding Bluetooth

Posted: 12 Feb 2012, 22:07
by nxt1engineer
Hello
For the winter project I have to connect 4 brick and communicate sever messages
I have some problems connecting the bricks and receiving messages.

Example
Brick 2 is master and connected to slave brick 1 connection line 2
Brick 1 is sending a message but brick 2 is not receiving the message.

Now I do it reverse
Brick 1 is master and connected to slave brick2 connection line 2
Brick 1 is sending a message now brick 2 is receiving the message OK

Question
Can the slave brick send a message or can only the master sends messages ?
Please some help to connect the 4 bricks, see picture, and sending messages
Brick_connect.pdf
Her the picture connection
(176.54 KiB) Downloaded 226 times
Thanks Jan
Alway problems to attacg a picture PFFFFFF

Re: Problems understanding Bluetooth

Posted: 12 Feb 2012, 22:45
by afanofosc
The NXT is not really designed for the sort of network you have drawn. One NXT is intended to be the master with up to 3 NXTs attached. The master NXT does all the bluetooth communication. The other NXT's simply respond to communication initiated by the master NXT. That is, at least, how the NXT firmware is designed to work. An NXT that is a slave cannot send any messages directly to any of the other slave NXTs.

Now, having said that, it is possible to do things somewhat differently than the NXT firmware designers intended for us to do things but it is not easy. I don't think you will ever succeed, though, in getting a slave NXT to connect to and send messages directly to another slave NXT.

It might also help us to know what sort of programming language you are using and what your existing code looks like.

John Hansen

Re: Problems understanding Bluetooth

Posted: 13 Feb 2012, 20:20
by nxt1engineer
Hello John
Thank for the replay

I have work out 2 other ideas
Can you have a look of it can work?
We programmed with standard nxt 2.0

Idea 2
Brick 1 (master) connect to brick 2 (slave)
Sending a message, and shutdown the connection after sending
Brick 2 doing his job
After the job Brick 2 (new master) connect to brick 3 (slave)
Sending a message, and shutdown the connection after sending
And so on, and so on.

Idea 3
We making brick 2 master and connecting 1-3-4 as slave.
The master is polling al the slaves and the response of the slaves can activate a job.
The question by this idea
Can the master get a message from the slave that the message is received?
nxt-bleutooth.pdf
new ideas
(23.32 KiB) Downloaded 241 times

Re: Problems understanding Bluetooth

Posted: 13 Feb 2012, 20:22
by HaWe
CMIIW, but you may only have 1 dedicated master ever in your program.
Once master - always master.
Once a slave - ever a slave.

But a slave can put a message into his outbox and the master can pick up the message by reading his related inbox.
So your idea 3 should work.

Re: Problems understanding Bluetooth

Posted: 14 Feb 2012, 14:05
by hassenplug
It should be possible to make idea #2 work. However, it can take 3 or 4 seconds to connect, so it could take 10 seconds to send a message from 1 to 4.

Idea #3 would be the best of those.

Another option would be to connect them all directly together using the RS485 in port 4. Or even connect a couple via 485, and the others via bluetooth.

Steve