我希望能够让我的 iPhone 应用程序通过蓝牙与我的 Arduino 进行通信。
我发现一些蓝牙扩展板支持以下协议:BCSP、DUN、LAN、GAP SDP、RFCOMM 和 L2CAP。从我在谷歌搜索时发现的情况来看,iPhone 是否隐藏了它的蓝牙堆栈?!?这是正确的吗?是否真的没有机会让我的 iPhone 在不越狱的情况下与其他支持蓝牙的设备进行通信(据我所知,如果我使用 btstack,则需要越狱: http://code.google.com/p/btstack/)?
如果蓝牙确实不可能,您建议使用什么其他方式(除了WLAN)来实现通信?
我希望意识到的是这样的: http: //theiopage.blogspot.com/2011/08/yanis-android-wireless-eos-controller.html
感谢您的任何提示!
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!
发布评论
评论(6)
有多种连接技术可用。
正如其他人提到的,标准蓝牙 (3.0) 由 MFi 程序控制。连接未越狱 iPhone 的唯一方法是加入 MFi 计划。
串行访问很有趣。您必须加入 MFi 才能分发串行设备,但您可以使用 Redpark Serial用于将您自己的 iPhone 连接到串行设备的电缆。
有多种方法可以将蓝牙 LE 设备连接到 Arduino。我使用过的一个是 RedBearLabs BLE Shield。它运作得非常好。
您还可以使用 WiFi 串行连接到 Arduino桥。我已经成功使用 WiFly 设备。
BLE Shield 和 WiFly 的优点之一是您不必使用 Objective C或Macintosh——当然,这是一种选择。您可以通过直接在 iPad 或 iPhone 上运行的 techBASIC 访问两者。
您可能可以通过一些研究和努力自行解决这些问题,但这些连接技术(以及其他一些不直接应用于 Arduino 的技术)也包含在 构建 iPhone 和 iPad 电子设备,O'Reilly 的新书。
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.
有关从原生操作系统 iOS 设备连接到蓝牙 3.0 或更低版本设备的信息仅在被接受到 Apple 的 MFi 后才可用程序。
蓝牙 4.0 (BLE) 可供 iOS 开发人员在开发和商业中使用(无需访问 MFi 程序),使用 iOS 5 或更高版本的 iPhone 4S、iPad 3 及搭载 BT4.0 的更高版本设备上提供的公共核心蓝牙框架机上。
几年后添加:
现在市场上有多种内置 BLE(LightBlue Bean、RFduino 等)的 BLE 扩展板和 Arduino 兼容或类似 Arduino 的产品。
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.
实际上,您现在就可以实现这一目标,无需越狱或 MFi 注册。
查看较新 iOS 设备中的蓝牙 4.0 和 Arduino BT 4.0 扩展板。
这可能会有所帮助: http ://blog.makezine.com/2012/03/19/bluetooth-4-0-from-arduino-to-iphone-no-jailwriting-no-mfi/
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/
改进这个答案并涵盖所有细节可能需要一些文章或类似的文章。我会尽量简明扼要,重点关注 iOS 端,因为 Arduino 基本上对蓝牙外设没有限制,这些外设可通过 Arduino BLE 扩展板广泛使用,例如 RedBearLab BLE Shild
蓝牙 v2.0 + EDR、v2.1 + EDR、v3.0 + HS...
v4.0 之前的蓝牙堆栈规范不含低能量部分。虽然它很容易使用协议,特别是如果围绕 SPP(串行端口配置文件)进行简化,但它在没有 MFi 程序。市场上很少有蓝牙模块,例如松下的 Pan1321,它包含 Apple 认证协处理器,并且可以在 iOS 上使用。故事的悲伤部分是,如果您查看此官方页面 iOS:支持的蓝牙配置文件 SPP 不存在,因此您可以在列出的配置文件之间进行选择(如果您正在制作音频或 HID 设备,您可能会这样做)。
蓝牙低功耗 (BLE)
从蓝牙 v3.0 规范迁移到 v4.0 引入了 BLE。规范的新部分与以前的部分几乎没有共同之处。基本上您可以将其视为蓝牙 v3.0 + BLE = v4.0 或蓝牙智能。我们感兴趣的是 v4.0 规范的 BLE 部分。
CoreBluetooth
除了 BLE 的所有优点(例如低功耗、小尺寸、低成本)之外,最重要的是移动制造商的采用,包括 Apple(不需要 MFi)。 CoreBluetooth 完全支持 BLE iOS 端的实现也很简单。您必须记住的一件事是 BLE 能耗低,但速度也低。尽管标准指定最小连接间隔为 7.5 毫秒,但 Apple 文档 表示建议为 30 毫秒 :-D我使用大量不同芯片和 iOS 设备的经验是,您将能够每 20-30 毫秒传输 20 个字节。如果需要确认,请将其加倍,例如 40-60 毫秒。
自定义配置文件
标准 BLE 配置文件列表可通过蓝牙特别兴趣小组 (Bluetooth Special Interest Group) 获取SIG)。看看基于 GATT 的。不幸的是,如果您不从列表中制作心率监测器或设备,您可能会使用电池服务或配置文件列表中的类似服务。幸运的是,创建自定义配置文件并不复杂,它将成为您必须传输的应用程序特定数据的“占位符”。了解角色、GATT(服务和特性)、UUID 等是强制性的,但我认为学习曲线或 BLE 堆栈并不困难。
一旦了解在嵌入式设备上运行的 BLE 配置文件,使用 CoreBluetooth 库通过 BLE 连接和通信就变得非常简单。
iBeacon
Apple 使用 BLE 标准作为 iBeacon 的“载体”进行了一些小改动。他们使用 BLE 广告数据包中的制造商特定数据来“声称”某些设备是 iBeacon。我想说,这完全没问题。您应该记住的是,BLE 不是 iBeacon,但所有 iBeacon 都是 BLE(具有硬编码制造商特定数据的设备,在广播 BLE 模式下公开 RSSI、UUID、主要和次要)。此外,iBeacon 由 CoreLocation 处理,而不是 CoreBluetooth。这清楚地表明了苹果对 iBeacon 的意图。
结论
如果您想将 iOS 设备与 Arduino 或其他嵌入式设备集成,那么 BLE 绝对是您需要考虑的。如果您了解物联网炒作和可用的 RF 选项,那么您想要了解有关 BLE 的更多信息还有其他原因。 BLE 将保留 v4.1 和即将推出的 v4.2 规范,这将提高带宽、带来对 IPv6 的支持、更好的安全性等。
最后,不是那么短,但我希望它有所帮助。
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.
所以我不知道如何实现,但我认为你的Arduino应该模拟一个蓝牙耳机并让App解析数据。由于 iPhone 仅支持蓝牙耳机,这将是唯一的方法之一。这将是非常困难的。
我建议您使用 Wifi-Shield 通过 Wifi 执行此类操作。您可以使用苹果的 bonjour 系统来自动检测您的硬件。
希望这能给你一些如何解决问题的想法,
狮子座
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
一些 BLE 模块可以在 iBeacon 模式下使用,并且可连接到 IO。我使用基于 CC2540/CC2541 的模块 HM10 和 HM11。他们有几个用于 iBeacon 设置的 AT 命令。可更改的寄存器有UUID、Major、Minor和测量功率。更多详细信息,请参阅本文 “将您的基于 CC2541 的 HM-10 蓝牙智能模块进入 iBeacon”
Some BLE modules can be used in iBeacon mode and are connectable to IOs. I worked with modules HM10 and HM11, based on CC2540/CC2541. They have several AT commands for iBeacon setup. Changable registers are UUID, Major, Minor and Measured Power. More detailes in this article "Turn your CC2541 based HM-10 Bluetooth Smart Module into an iBeacon"