Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect an iPhone to Arduino over Bluetooth

I would love to be able to let my iPhone-App communicate to my Arduino over Bluetooth. I found some Bluetooth shields that support the following protocols: BCSP, DUN, LAN, GAP SDP, RFCOMM, and L2CAP. From what i found while googling a bit, is that the iPhone is hiding it's bluetooth stack away?!? Is this correct? Is there really no chance to let my iPhone communicate with an other bluetooth enabled device without jailbreaking (which as far as I know would be required if i'd use btstack: http://code.google.com/p/btstack/)?

If bluetooth is really not possible, what other ways (expect WLAN) would you suggest to realize a communication? What I would love to realize is something like here: http://theiopage.blogspot.com/2011/08/yanis-android-wireless-eos-controller.html

Thanks for any tips!

like image 697
Georg Avatar asked Oct 14 '11 16:10

Georg


People also ask

Can iPhone connect to Arduino Bluetooth?

An app called BLExAR allows Arduino users to communicate to an iOS device (iPhone or iPad) using a Bluetooth CC2541 module (different versions are called: HM-10, SH-M08, AT-09, or JDY-08). The app permits control of an Arduino board, wireless serial communication, and data acquisition.

Can you connect Arduino to iPhone?

An app called BLExAR allows Arduino users to communicate to either an iPhone or an iPad via Bluetooth. The app permits control of an Arduino board, and communication via the serial port, as well as data transfer from the Arduino to the iOS device.

Can you connect Arduino with Bluetooth?

Arduino Pins | Bluetooth Pins You can connect the Bluetooth module to the Arduino using a set of jumper wires and a connector. Note: Don't connect RX to RX and TX to TX on the Bluetooth and Arduino. You will receive no data.

What Bluetooth module works with iOS?

DSD TECH HM-11 Bluetooth 4.0 BLE Module Compatible with iPhone and iPad and Android 4.3 or Later.


5 Answers

There are several connection technologies available.

As others have mentioned, standard Bluetooth (3.0) is controlled by the MFi program. The only way to connect to a non-jailbroke iPhone is to join the MFi program.

Serial access is interesting. You have to join MFi to distribute a serial device, but you can use the Redpark Serial Cable to connect your own iPhone to a serial device.

There are several ways to connect Bluetooth LE devices to the Arduino. One I've used is the RedBearLabs BLE Shield. It works pretty darn well.

iPhone to RedBearLab BLE Shield to Arduino, powering a hacked truck using techBASIC

You can also connect to an Arduino using a WiFi-serial bridge. I've had success with the WiFly device.

iPhone to WiFly to Arduino

One of the neat things about the BLE Shield and WiFly is you don't have to use Objective C or a Macintosh--although that's an option, of course. You can access both through techBASIC, running right on the iPad or iPhone.

You can probably figure these out on your own with some research and effort, but these connection technologies (plus a few more that don't apply directly to Arduino) are also covered in Building iPhone and iPad Electronics Devices, a new book from O'Reilly.

New Book from O'Reilly

like image 55
Mike Avatar answered Oct 03 '22 22:10

Mike


Information about connecting to Bluetooth 3.0 or lower devices from stock OS iOS devices is only available after being accepted into Apple's MFi program.

Bluetooth 4.0 (BLE) is accessible both in development and commercially to iOS developers (without needing access to the MFi program), using the public Core Bluetooth framework available in iOS 5 or later on iPhone 4S, iPad 3 and later devices carrying BT4.0 on-board.

Added a few years later: There are now several BLE shields and Arduino compatible or Arduino-like products with built-in BLE (LightBlue Bean, RFduino, etc.) available in the market.

like image 41
hotpaw2 Avatar answered Oct 03 '22 22:10

hotpaw2


Actually you can make it happen now without Jailbreaking or MFi enrollment.

Take a look ate Bluetooth 4.0 in newer iOS devices and Arduino BT 4.0 shield.

This might help: http://blog.makezine.com/2012/03/19/bluetooth-4-0-from-arduino-to-iphone-no-jailbreaking-no-mfi/

like image 44
ygbr Avatar answered Oct 03 '22 22:10

ygbr


Improving this answer and cover all details probably needs some article or similar. I will try to keep things short and make focus on iOS side, since Arduino basically doesn't have limitations on Bluetooth peripherals which are widely available via Arduino BLE shields, such is RedBearLab BLE Shild

Bluetooth v2.0 + EDR, v2.1 + EDR, v3.0 + HS....

Bluetooth stack specification prior to v4.0 doesn't contain Low Energy part. Although it is easy to use protocol, especially if simplified around SPP (Serial Port Profile) it is not available on Apple iOS devices without MFi program. There are few Bluetooth modules on the market such is Pan1321 from Panasonic which includes Apple authentication coprocessor and which could be used with iOS. Sad part of the story is that if you take look on this official page iOS: Supported Bluetooth profiles SPP is not there so you can choose between listed profiles (what you probably will if you are making audio or HID device).

Bluetooth Low Energy (BLE)

Migration from Bluetooth v3.0 specification to v4.0 introduced BLE. New part of specification has very little in common with previous. Basically you could look on it as Bluetooth v3.0 + BLE = v4.0 or Bluetooth Smart. BLE part of v4.0 specification is what we are interested for.

CoreBluetooth

Beside all the advantages of BLE such are low power consumption, small size, low cost, the most important was adoption by mobile manufacturers, including Apple (no MFi needed). BLE is fully supported by CoreBluetooth and implementation on iOS side is straightforward. One thing that you have to keep in mind is that BLE is low energy but also low speed. Although standard specifies minimal connection interval of 7.5ms Apple documentation says recommendation is 30ms :-D What I have experienced using bunch of different chips and iOS devices is that you will be capable to transmit 20bytes every 20-30ms. If acknowledgment is needed, than make it double, like 40-60ms.

Custom Profiles

The list of standard BLE profiles is available by Bluetooth Special Interest Group (SIG). Take a look on GATT Based. Unfortunately, if you don't make an heart rate monitor or device from list you will probably use battery service or similar from a profiles list. Fortunately it is not complicated to create custom profile, which will be "placeholder" for application specific data you have to transmit. Understanding of Roles, GATT (Services and Characteristics), UUIDs and other is mandatory, but learning curve or BLE stack is not difficult in my opinion.

Once when BLE profile, running on embedded device is known, connection and communication over BLE is very simple using CoreBluetooth library.

iBeacon

Apple made little hack using BLE standard as "carrier" for iBeacon. They are using manufacturer specific data in BLE advertising packet to "claim" that some device is iBeacon. Which is perfectly OK, I would say. What you should keep in mind is that BLE is not iBeacon, but all iBeacons are BLE (device with hardcoded manufacturer specific data, exposing RSSI, UUID, major and minor in broadcast BLE mode). Additionally, iBeacon is handled by CoreLocation not CoreBluetooth. This makes clear what was Apple intension with iBeacon.

Conclusion

If you want to integrate iOS device with Arduino or some other embedded device BLE is definitely something that you want to consider. There are additional reasons why you want to learn more about BLE if you take a look on IoT hype and available RF options. BLE is here to stay with v4.1 and upcoming v4.2 specifications which will improve bandwidth, bring support for IPv6, better security, etc.

At the end, not so short, but I hope it helps.

like image 23
Darko Djuric Avatar answered Oct 03 '22 21:10

Darko Djuric


So I don't know how to implement, but I think your Arduino should simulate an Bluetooth Headset and let the App parse the data. Because iPhones only support Bluetooth Headsets this would be one of the only methods. And it would be very hard.

I recommend you to do things like this over Wifi with an Wifi-Shield. Than you could use Apples genial bonjour systeme, to automatically detect your hardware.

Hope that gives you some idea, how to solve the problem,

Leo

like image 24
evotopid Avatar answered Oct 03 '22 21:10

evotopid