I've recently buy Arduino for a school project. Basically, i have three arduino (2uno, 1micro) with three bluetooth module. The first one (arduino micro) need to send serial sensor data to the 2nd arduino (The first module is the master of the 2nd) the 2nd arduino modify value received and send them to the 3rd arduino (the 2nd arduino is the slave of the 1st and the master of the 3rd, the 3rd is the slave of the 2nd). I'm not speaking English very well so here's the diagram:
[1rst Module (Sensor): Receive from: Nobody, Send to 2nd Module] > [2nd Module (Data management and touch screen): Receive from: 1rst Module, Send to 3rd Module] > [3rd Module (Motor and battery stuff): Receive from: 2nd Module, Send to: Nobody]
Module = Arduino
I want to know if i need two bluetooth HC-05 for the 2nd module or i can use it as a Slave and Master at the same time (RX) receives from 1st and (TX) send to 3rd.
I know it's a bit complicated to understand but i don't want to use the french forum.
I want to know if i need two bluetooth HC-05 for the 2nd module or i can use it as a Slave and Master at the same time (RX) receives from 1st and (TX) send to 3rd.
Do you understand what pair means? How many things make up a pair?
I want to pair up the 1st Bluetooth module to the 2nd. The TX of the 1st Bluetooth bluetooth will send the data to the RX of the 2nd. The TX of the 2nd Module will send the data the the RX of the 3rd. Does the 2nd module can recieve from a module and send data to an other module?
If you have a bluetooth device named Fred that is paired with a bluetooth device named Wilma, Fred can talk to Wilma, and Wilma can talk to Fred.
If you have a bluetooth device named Barney that is paired with a bluetooth device named Betty, Barney can talk to Betty and Betty can talk to Barney.
Wilma can NOT talk to Barney.
Wilma can NOT talk to Betty.
Fred can NOT talk to Barney.
Fred can NOT talk to Betty.
Barney can NOT talk to Fred.
Barney can NOT talk to Wilma.
Betty can NOT talk to Fred.
Betty can NOT talk to Wilma.
Is there something about the concept of pair that escapes you?
PaulS:
If you have a bluetooth device named Fred that is paired with a bluetooth device named Wilma, Fred can talk to Wilma, and Wilma can talk to Fred.
If you have a bluetooth device named Barney that is paired with a bluetooth device named Betty, Barney can talk to Betty and Betty can talk to Barney.
Wilma can NOT talk to Barney.
Wilma can NOT talk to Betty.
Fred can NOT talk to Barney.
Fred can NOT talk to Betty.
Barney can NOT talk to Fred.
Barney can NOT talk to Wilma.
Betty can NOT talk to Fred.
Betty can NOT talk to Wilma.
Is there something about the concept of pair that escapes you?
nothing more can be explained
OP, do you think, it will be better to use an NRF24L01 module. I dont want to deviate from the topic, but seems like a radio module suits better which doesnt need any pairing.
STUDIOCRAFTapps:
Ok... I don't want to use a radio module, i will buy a fourth bluetooth module. (There's a way to plug two bluetooth module to one arduino...)
This is an old thread, it is quite possible he didn't, and all the smartarse rabbiting on about Fred, Barney and Wilma would not have helped. Indeed replies #1 and #3 are just misleading claptrap, actually not only caused by a misunderstanding of the meaning of the word "paired", but also a misunderstanding of how pairing applies in this instance. It is something of a red herring anyway, but Bluetooth master CAN be paired with a swag of other devices, you only have to look at your phone to see that. There you can see a list of paired devices - even if it is actually empty. The problem is that HC-05 can only communicate with one other HC-05 at a time.
I think OP's word map may be simplified
Arduino one > Arduino two > Arduino three
send...........> receive/send > receive
Implying Arduinos one and three are bog-ordinary, and all the issues are with Arduino two. This may be solved by two means.
Buy an extra HC-05 for Arduino two, so that one talks to Arduino one and the other to Arduino three. Simple. This may mean that one Bluetooth may have to run on software serial, which is not such a great idea, but rarely a real problem.
Configure Bluetooth on the fly, it can only talk to one other at a time, but it can talk to two in sequence. This means that a single Bluetooth has to be put into AT mode and configured twice in each loop cycle. This is accomplished by having the power to Bluetooth, along with a connection to the EN pin, under software control. You may then include AT commands in the loop to configure Bluetooth to power-on auto connect to several slaves in turn. In this case, configure, connect and collect from Arduino one, reconfigure, and then connect and pass on to Arduino three.
Power-on auto connect is covered in the Martyn Currey website q.v.
Thanks so much for the brilliant response. Is it possible to further elaborate on the second scenario and how to accomplish it. I tried something similar to what you said in scenario 2 and I couldn't know when to send or if the data was sent from any device. Thanks again for your response it was very helpful.
I have to tell you that I have not done this myself but, on my instruction, it has been done by others at least twice. I might also point out that using an NRF24 network is really more appropriate for this sort of thing. It is what they are made for. I only raise the possibility of using Bluetooth because I assume you already have them in your hand and the smartarse remarks above are misleading. I'm not entirely sure if this will suit your purpose, particularly as all you say is that it is similar to the OP. Further, I don't know how familiar you are with Bluetooth. Having said that, I don't see why it will not suit.
If you are not familiar with Bluetooth, you might find the following background notes useful.
While comprehensive, they are very basic and do not actually cover the problem in hand.
Check Martyn Currey for Bluetooth<>Bluetooth connection. Phillipe Cantin is another source.
The secret of the trick is in controlling the power, and the link to the EN pin, in software, i.e. the lines go through a switching transistor or the like which is controlled by a digital pin, thereby switching between AT mode and communications mode. The AT commands are part of the loop.
Thanks again. Is there any chance I could get code on how to implement the second scenario or if it is possible for you to review my code and guide me to achieving that task.
I can really only espouse the principle but I guess I could look at your code. But first, you need follow Martyn and get a power-on auto-connect between two Blueteeth. Once you have done that, you probably don't need me.
If you are unfamiliar with Bluetooth, you might find the following background notes useful.
this really only addresses basic data to phone stuff, but there is a bit on AT commands under software.