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!
nope. i went with triggering my camera using the headphone jack. like the guys at triggertrap are doing it.
6 Answers 6
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.
You can also connect to an Arduino using a WiFi-serial bridge. I’ve had success with the WiFly device.
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.
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.
What would I get if I apply for Apples MFi program? Would they just tell me how some private API calls are called? Or an extra Framework that I could use?
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.
Be careful when posting copy and paste boilerplate/verbatim answers to multiple questions, these tend to be flagged as «spammy» by the community. If you’re doing this then it usually means the questions are duplicates so flag them as such instead. Also answers that rely entirely on linked content are not considered useful on our site due to the risk of link rot. Whilst this may theoretically answer the question, we would like you to include the essential parts of the linked article in your answer, and provide the link for reference.
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 😀 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.
ArduinoBlue 4+
Works well, very easy to use. Wish-List though.
1: Would be nice if texts sent to phone would show when app is not actively visible. I.E. alarm alerts are not very useful if I have to be looking at the app itself to see them. (If even possible)
2: would be nice if I could rename buttons and sliders without having to recreate the entire list.
3: would be really cool if I could create a button that was a pull down/scroll list of variables to select from/send. I.E. select from a list colors for led strip.
4: auto reconnect BLE when back in range. (If even possible)
If the above were true, it would be a great companion to many of my hardware products.
Works well and full of features
Using hm-10 module with esp-12e. Real time results. Wonderful sliders, button design, and the tilt and joystick are awesome features. Plus the follow line has potential to give pwm output. Otherwise, works great and love the features. Awesome developer. Recommend for the supported Bluetooth modules. My first review on App Store over 5 years. 10/10
Wonderful app.
I am using iPhone 7, newest version of Arduino, running Linux on a Chromebook.
This app is outstanding and works as advertised. Highly documented which is easily understood, with many example programs which compile without errors.
I highly recommend this app if you need a Bluetooth remote. GREAT JOB!
App Privacy
The developer, Mechanismic Inc. , has not provided details about its privacy practices and handling of data to Apple. For more information, see the developer’s privacy policy.
No Details Provided
Information
Compatibility iPhone Requires iOS 8.0 or later. iPad Requires iPadOS 8.0 or later. iPod touch Requires iOS 8.0 or later. Mac Requires macOS 11.0 or later and a Mac with Apple M1 chip or later.