I am trying to automate my dorm room for the upcoming semester. I have a bunch of arduino uno's lying around and I want to use them to control different appliances in the room, which I want to do via an IPhone app. I found a few tutorials online about using an HC-05 but none explicitly say if I need more than one if I want to control different devices from the same app or really anything about controlling multiple devices with one app.
TL;DR I want to control a bunch of devices from my phone, before I go out and buy the wrong parts what do I need and how do I connect multiple devices to one bluetooth device?
You can not use the HC05 module with an iPhone. Apple pushes BLE (Bluetooth Low Energy). If you were using an android app, it would work perfectly. My best advice would be to get one of these. They work well with arduino. That one would connect to one arduino, and that arduino could be connected to multiple relays to control lights, fans, etc.
Related
Is it possible that one device can connect to two different bluetooth topologies and thus process two different connections at the same time?
I have a mesh network to which several devices are connected.
One of the devices should also maintain a connection with an external bluetooth device at the same time.
Would such a thing be theoretically possible or not.
if not, are there any alternative or other ideas?
Yes, this should be doable. This is because at its core, mesh is an advert-based topology. In your above diagram, think of your green nodes as just devices sending BLE adverts to each other. This means that theoretically it should be possible for one of those devices (or even multiple of them) to be in a connection with other devices (inside or outside the mesh network). The image below shows that this capability is used to extend the range and technologies of a mesh network:-
I highly recommend going through the links below as they give a good overview of Bluetooth mesh and its evolution from Bluetooth Low Energy:-
From BLE to Mesh
Developing BLE Applications with Mesh
Bluetooth Mesh for Android Developers
I hope this helps.
I was wondering, I want to develop an app that communicates with two different Bluetooth devices serving different functions, and I would like to use them at the same time to display data from both devices simultaneously.
I was wondering, is this possible? If so, does anyone have any examples of such a use case? I couldn't find any such examples anywhere.
I would like to create an application where near phones/devices can send data between each other.
it should look like that all devices except one turn on some listening function. One device create game and add each of devices from list to game.
I know how to accomplish this task with use of intermediary server. But I would like to achieve this in a different way without server. For example I can create app which find near ibeacons and displays them in a list, and get data from them. Is it possible to make to way communication by bluetooth between phones with bluetooth?
Maybe other technologies? I do not want to use NFC, because range is to short.
Another limitation is that, this solution should be an cordova/phonegap plugin?
Edit:
I need to communicate between users devices. For example I want to make app where two users standing near each other chat together. Messages should be send between phones, without server.
It sounds like iBeacons is the perfect solution for what you're attempting to achieve. It doesn't require NFC or a server–only devices that have Bluetooth 4.0 LE (Low Energy).
If you're unhappy with iBeacons, I recommend the Multipeer Connectivity framework that also became available in iOS7:
https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/
Here's a good tutorial on AppCoda:
http://www.appcoda.com/intro-multipeer-connectivity-framework-ios-programming/
Another benefit to using the Multipeer Connectivity framework as opposed to iBeacons, is that it doesn't require Bluetooth 4.0 LE, which isn't available on iPad 2 and iPhone 4 devices.
I've been reading up on how to transfer data between iOS devices over Bluetooth using GameKit. I'm not writing a game, per se, but do have a need to transfer a small amount of binary data between two devices. Between two iOS devices, this is easy enough. However, I was wondering if it is possible to transfer data between an iOS device and an Android device via the same mechanism.
Has anyone come across documentation/tutorial that would explain how to do this? Is it even technically possible? Or has Apple put in some sort of restriction that would prevent this?
The other option I discovered was Bonjour over Bluetooth. Would this be a more suitable option for this type of operation?
This question has been asked many times on this site and the definitive answer is: NO, you can't connect an Android phone to an iPhone over Bluetooth, and YES Apple has restrictions that prevent this.
Some possible alternatives:
Bonjour over WiFi, as you mentioned. However, I couldn't find a comprehensive tutorial for it.
Some internet based sync service, like Dropbox, Google Drive, Amazon S3. These usually have libraries for several platforms.
Direct TCP/IP communication over sockets. (How to write a small (socket) server in iOS)
Bluetooth Low Energy will be possible once the issues on the Android side are solved (Communicating between iOS and Android with Bluetooth LE)
Coolest alternative: use the Bump API. It has iOS and Android support and really easy to integrate. For small payloads this can be the most convenient solution.
Details on why you can't connect an arbitrary device to the iPhone. iOS allows only some bluetooth profiles to be used without the Made For iPhone (MFi) certification (HPF, A2DP, MAP...). The Serial Port Profile that you would require to implement the communication is bound to MFi membership. Membership to this program provides you to the MFi authentication module that has to be added to your hardware and takes care of authenticating the device towards the iPhone. Android phones don't have this module, so even though the physical connection may be possible to build up, the authentication step will fail. iPhone to iPhone communication is possible as both ends are able to authenticate themselves.
Maybe a bit delayed, but technologies have evolved since so there is certainly new info around which draws fresh light on the matter...
As iOS has yet to open up an API for WiFi Direct and Multipeer Connectivity is iOS only, I believe the best way to approach this is to use BLE, which is supported by both platforms (some better than others).
On iOS a device can act both as a BLE Central and BLE Peripheral at the same time, on Android the situation is more complex as not all devices support the BLE Peripheral state. Also the Android BLE stack is very unstable (to date).
If your use case is feature driven, I would suggest to look at Frameworks and Libraries that can achieve cross platform communication for you, without you needing to build it up from scratch.
For example: http://p2pkit.io or google nearby
Disclaimer: I work for Uepaa, developing p2pkit.io for Android and iOS.
You could use p2pkit, or the free solution it was based on: https://github.com/GitGarage. Doesn't work very well, and its a fixer-upper for sure, but its, well, free. Works for small amounts of data transfer right now.
I'm trying to make an app on an Android device that will control an application on an iPad or Android tablet. (I'm testing with an Samsung Galaxy S2 and an iPad 2).
The application is pretty simple for now. When one selects a colour on the Android mobile, that colour displays on the tablet device.
The question is, how to connect the two devices. Just now I've verified that I can pair the two devices using Bluetooth. Also, the Samsung has a "Kies" Wifi Direct feature (which I don't understand fully), that allows the iPad to connect to the Galaxy as a wifi hotspot.
The connections are there, but I don't know if either protocol can be used to actually get the apps to talk to each other to get the control I'm looking for.
Should I be using Bluetooth, Wifi, or something else?
And in whichever case, how?
My opinion is that you should not stick so much around the physical medium used for connectivity either is WiFi or Bluetooth. You should abstract this aspect, in both cases you will be using sockets (I'm speaking about Android), if it's Bluetooth you will be using Bluetooth Sockets, if it's WiFi: TCP sockets. You could have a intermediate layer that abstracts the type of connection and through a factory to use either Bluetooth or TCP.
Bluetooth - http://developer.android.com/guide/topics/wireless/bluetooth.html
For WiFi you should study if P2P would help.
You will need two applications:
- one on the tablet - the server which listens for commands from the client (change color, do this or this)
- second on the smartphone - the client which sends commands.
I've built a few apps that do exactly that between iPhone and iPad. But the principle is the same. I used Bonjour networking. It's just a fancy name for ZeroConfig networking between devices. It's written originally by Apple but it's open source so there should be Android support out there for it too. Really simple and easy to work with.
If you already have a working connection then you already have the first half of your answer, that said you should really consider implementing a solution that uses a variety of connection types, WIFI, Bluetooth, etc.. The question I think you are really asking is how to pass data and messages between the apps once you have the connection.
There are a lot of ways to accomplish this. You could implement your own lightweight message passing system. If you haven't done this before it is more complicated than it originally seems, especially as you would be required to implement the system for each OS you end up using.
Should I be using Bluetooth, Wifi, or something else?
It depends on what situations you want your program to work in.
Bluetooth can provide a direct connection between your devices. A potential issue with bluetooth is that it has a limited range. If you're devices need to be far away from each other, you may want to go with wifi. Otherwise, bluetooth could work great.
If both devices are connected to the internet, you can make them talk to each other through there. The advantage of this approach is that it doesn't matter how far apart your devices are as long as they're both online. A disadvantage is that you'll have to figure out how to find the tablet's ip address before you can talk to it. This is actually a HUGE disadvantage because it can be quite problematic if both of your devices are not on the same wifi. You could have the user type in the destination ip address, but you'll have problems getting it to work if the user is behind a router (which will almost always be the case). The point is, it gets hairy.
If both of your devices are on the same wifi, you can use ZeroConf AKA bonjour (like Dancreek said) to figure out what ip address you need to send info to. I've previously used a library called jmdns (easy to find with google) to implement zero configuration networking. It's good because the user doesn't have to worry about ip addresses... it's intuitive for the user.
And in whichever case, how?
Networking is a pretty big topic, so I can't expand on this question to much. Short answer is, it depends on what method you choose. Search for some tutorials and start by getting one of your devices to send something as simple as an int to the other.