Go Down

Topic: Commamding two arduino cards via bluetooth (Read 1 time) previous topic - next topic

krichenboy

Hello, I'm new arduino developer, I need to command 2 arduino cards via my mobile, I mean, commanding 2 robots simultaneously with just one mobile. Is it possible? if it is, how can I do it?
Thank you.

DuaneDegn

#1
Jan 11, 2016, 04:04 am Last Edit: Jan 11, 2016, 04:05 am by DuaneDegn
Hello, I'm new arduino developer, I need to command 2 arduino cards via my mobile, I mean, commanding 2 robots simultaneously with just one mobile. Is it possible? if it is, how can I do it?
Thank you.
Yes, this is certainly possible. You'll need a Bluetooth module for each robot. I like the HC-05 and EC04-8 modules myself. The HC-05 is probably the best choice for use with an Arduino. You can get HC-05 modules for about $3 on ebay.

The difficult part to this project will be finding/writing a program for your smartphone which interacts with your two robots. I've used MIT's App Inventor 2 to make Bluetooth apps. I'm sure it's possible to make a program which can interface with two different Bluetooth modules. I'm not aware of a ready made app which will do what you want.

PaulS

Quote
I'm sure it's possible to make a program which can interface with two different Bluetooth modules.
Are you sure about this? The phone has one bluetooth device which is able to pair with one other bluetooth device.
The art of getting good answers lies in asking good questions.

krichenboy

what about commanding one master Bluetooth, and the other one will be a slave?

PaulS

Imagine a bluetooth connection as a piece of string. It has two ends. Draw a picture, showing the devices you want to connect. Connect one device to another, using a line. How many devices can the phone connect to? Any answer other than one is wrong.
The art of getting good answers lies in asking good questions.

krichenboy

Yes, i got your point, but if I have an HC-05 as a master mode, and a HC-06 as a slave mode, can i command my robots using only the HC-05, and the HC-06 will follow? i mean sending data to the card via HC-05 and this module will send it to HC-06.

PaulS

Quote
Yes, i got your point, but if I have an HC-05 as a master mode, and a HC-06 as a slave mode, can i command my robots using only the HC-05, and the HC-06 will follow? i mean sending data to the card via HC-05 and this module will send it to HC-06.
Apparently, you didn't. One bluetooth device can talk to one other bluetooth device. If the phone is talking to the HC-xx, the HC-xx can ONLY be talking to the phone.
The art of getting good answers lies in asking good questions.

krichenboy


DuaneDegn

#8
Jan 11, 2016, 06:15 pm Last Edit: Jan 11, 2016, 06:28 pm by DuaneDegn
Are you sure about this? The phone has one bluetooth device which is able to pair with one other bluetooth device.
Do I'm not. I realize I said "simultaneously". The communication will need to take place sequentially.
Edit: I just checked. I didn't use "simultaneously". It's certainly possible to make an app to interface with two modules provide it's done sequentially.

I'm not sure how "pair" and "connect" are technically defined, but one generally only needs to pair two Bluetooth devices only once. Each time the app is ran the app needs to connect with the previously paired device. This connection can occur automatically provided both devices are on and have previously been paired.

I don't know if an Android can connect with two different Bluetooth devices at once. If not, the app would need to disconnect from one device and connect with other one after the other.

I'm not sure what sort of data the OP wants transmitted to these devices but provided a bit of latency is tolerable it shouldn't be two hard for an app to communicate with the devices one at a time.

I'll likely be working on a Bluetooth app today. I'll make a fork of the app and see what sort of limitations there are  when communicating with two devices. As I think about this, I can see two device applications for my current project. It would be cool for an app to be monitoring multiple sensors "at the same time" (aka one after the other).

DuaneDegn

#9
Jan 11, 2016, 06:23 pm Last Edit: Jan 11, 2016, 06:24 pm by DuaneDegn
Yes, i got your point, but if I have an HC-05 as a master mode, and a HC-06 as a slave mode, can i command my robots using only the HC-05, and the HC-06 will follow? i mean sending data to the card via HC-05 and this module will send it to HC-06.
What you could do is have two HC-05 modules on the "master" robot and one HC-05 on a "slave" robot. The master robot could receive data from the smartphone and pass it on to the slave robot. You'd want to have the devices take turns using their Bluetooth modules so this arrangement wouldn't offer much advantage over having the smartphone communicate directly with both robots one after the other.

If the slave robot were farther away from the smartphone than the master robot, then you could use the above configuration to pass messages from robot to the other. This would allow the slave robot to move out of range of the smartphone as long as it could still communicate with the master robot.

I think the "taking turns" approach would likely be the easiest system to implement.

Frostline

Imagine a bluetooth connection as a piece of string. It has two ends. Draw a picture, showing the devices you want to connect. Connect one device to another, using a line. How many devices can the phone connect to? Any answer other than one is wrong.
Is this a limitation of the Android(I am assuming) phone OS?

I ask because here on my Windows tablet I am currently connected to via bluetooth a pro-mini with a HC-6 and a nano with a HC-5.  I can send commands to both bluetooth devices.
One device is simply receiving commands to turn a LED on or off.
The other device is receiving RGB values for two RGB LEDs.
Once paired both the HC-5 and HC-6 are assigned two unique COM ports.  So it is basically choose the COM port and send the command to whichever BT device.
Neither device has a direct physical connection to the tablet.  
So it does not seem like a bluetooth limitation to only connect to one device. At least simple serial BT communication anyway. Since my single BT transceiver is connected and sending commands to two different BT devices.

Benji

It is paired to two devices, not connected.
The signals you are sending are not being sent simultaneously but one after another.
If you have an application that can switch between two receivers automatically that would make it seem you are connected to two devices but Bluetooth is point to point communication. There can only be one connection at the same time. OS doesn't matter, it is simply how Bluetooth works.

Go Up