Connecting Arduino to two devices over Bluetooth

Hello,

I am planning to receive to remote sensor over Bluetooth from Arduino. At the same time I want to transmit data from Arduino to Android phone over Bluetooth.

Is it feasible to do this? Or Should I use Wi-Fi direct for communication between Android and Arduino?

Please help.
Thanks.

What you want to do is not very clear but I think it might be possible and entirely depends how you connect with the non-Android.

There might be some smart way of doing this with a master bluetooth on Arduino but it should be painless enough to do it with two blueteeth on the Arduino, one to talk to Android, and one to talk to the other. The latter may need to be configured as a mster and may involve a bit of programming.

The Android bit is dead easy. Here is some basic stuff for that.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

Hello Nick,

Thank you for shedding light on making Arduino as a master. I read several places that you can make Arduino as a master and can connect several Bluetooth devices (phone, sensors) etc. However I am struggling to know how to do it actually.

Are there any examples ? I came across another question on forum, but still looking for answer.

http://forum.arduino.cc/index.php/topic,171650.0.html

Thanks.

You still haven't elaborated on what you want to do or why. There may be good reasons for doing what (I think) you want to do but, as it stands, why don't you just send the data direct to the phone, and leave Arduino out of the game?

I'm not surprised you are struggling to know how to do it. There is very little information on it and most of the discussion goes nowhere. - rather like that in the link you posted, which I think was just nonsense and hence the short thread. I have never known of a practical application of a master on an Arduino and I suspect this is because it usually isn't a very good idea. The only practical instance I can think of is use with a game controller, so you might have a look in that arena.

The only sensible description I have seen of Arduino <> Arduino comms via Bluetooth is here

This requires one to be a master but it might not help you much. I have never pursued it because it doesn't use the bluetooth modules that I use.

Hello Nick,
Thanks for your reply. My project discription is like this.

I have two big adjacent garden plots. I want to measure the moisture in each of them separately and report it to my Android phone whenever it is in range. I am planning to use two Arduino devices in each field with Bluetooth communication. One of the Arduino will be a Bluetooth master and collects the moisture information from the slave in other field.

Whenever phone is near the field, master Arduino should automatically connect with phone via Bluetooth and update the app with popup message about the status of the garden. Advantage of keeping the master in the field, is that master can initiate necessary steps to start water pump etc on its own (self acting). There could be other ways to do this which I am not aware of.

Today I found the very nice Bluetooth AT command reference to make one of the master.

I will look into direction you suggested as well as Bluetooth references.
Thanks.

If anything in that works for you, fine, but I don't think it will. The most notable line in it says "In both cases, the default settings for the HC-05 were fine. " which, since the default setting for the HC-05 is slave-mode, is probably not what you want to hear. I believe the matter is made even more deceptive by being specifically about the HC-05.

I now understand that you want Arduino<>bluetooth<>Arduino comms since, essentially to want one to act as a base station for the other, thereby allowing you to collect all the data from one point with the phone. This requires one Arduino to be on a master and, yes, the HC-05 may be configured as a master.

It looks like it can all be done, you even occasionally hear people say they've done it but, I submit that, if you ever want to see a discussion on this forum evaporate at blinding speed, all you need do is ask them to lay the cards on the table and describe exactly how they did it. Indeed, I'm sure there was a thread here where somebody said he had done this and then removed it. I have even wondered if somebody (not me!) called his bluff.

There is even a vague implication of the necessary commands in the HC-05 data sheet but I believe this is open to interpretation, and maintaining that belief until there is clear evidence of somebody else's success is probably a good idea.

Note that Cantin does not use the HC-05. He uses Bluesmirf for both master and slave, but I can't see why the HC-0x would not be OK for the latter.

I'm not saying it can't be done with HC-0x, I'm only saying I have not seen clear description of how to do it, and there is quite a lot of confusion. I believe this could be because there are varying degrees of master, and the HC-05 does not have the master commands to do this job, but I have never had need to configure an HC-05 and I have no proper explanation.

What we are talking about here is walking the 10m to the other bluetooth. If you can to that, you do it via Easy Street. If you can't, you may find it better to talk bluetooth by phone, which is easy, but use NRF24 for the Arduino<>Arduino relay, which is only slightly less easy but very well documented.