Should the micro controller be the peripheral or the central? - ios

I recently purchased a Bluetooth 4.0 LE micro controller known as the Bluno. It's an Arduino compatible micro controller that has BT4.0LE built-in with no need for additional hardware. Anyways, I can program the micro controller to act as a central or a peripheral and same goes for the iPod Touch 5G that I plan on using to communicate with the device.
I initially thought that I should make the Bluno act the central and have the iPod Touch act the peripheral because the app I have written in Obj-c sends messages to a micro controller, and previously the micro controller we exhibit a behavior based on the message it would receive.
However when I look at the sample app written by the people who sell the Bluno they have the iDevice configured as the central, which makes me wonder because their app has the micro controller responding to what the user inputs into the app and then have the micro controller perform an action.
Needless to say I'm a little confused, any constructive thoughts would be appreciated.

The roles of the phone and the microcontroller really depend on what you're creating.
In the majority of cases though, the microcontroller has some sensors attached to it and that data is made available over bluetooth, and that is your "peripheral". Your phone app in the "central" role will read that data and likely have some user interaction based on that data.
This Apple doc explains it well: https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/AboutCoreBluetooth/Introduction.html
In Bluetooth low energy communication, there are two key players: the
central and the peripheral. Each player has a different role to play
in Bluetooth low energy communication. A peripheral typically has data
that is needed by other devices. A central typically uses the
information served up by a peripheral to accomplish some task. For
example, a digital thermostat equipped with Bluetooth low energy
technology might provide the temperature of a room to an iOS app that
then displays the temperature in a user-friendly way.

Related

Does BLE Data Transfer require pairing (pairless bt data transfer)

For a project of mine I need a pairless bluetooth data transfer. I have first thought about doing it with BLE IBeacons but they can only advertise a very limited amount of data. I looked further through the Apple documentation and found this tutorial about Central/ Peripheral
BLE data transfer. I've implemented the code in my project but even though the devices were very close together they could not "see" each other. I have since looked up on the Internet and could not find a hint about whether the devices need pairing or not and what the problem of mine could be(the code is not throwing any errors nor warnings).
If it does require pairing, is there some way to do that in the background without requiring the user to perform an action, so that I could theoretically advertise some kind of pair request via. IBeacons to then transfer the data? If that's not the case, is there even a way to transfer data (mono directional, round about 512 bytes) between nearby bluetooth devices without user actions?
greets from germany!
To get started with Bluetooth Low Energy or any other protocol, it's best to learn how it works. At least basics.
Simplifying. BLE allows you to send data:
"Passive" (without conncetion) - over Advertisement Data. The size of the packages depends on the BLE version.
"Active" (requires connection with the device) - bidrirectional comunication. In this case size of the data package also depends on the BLE version.
Bonding and pairing is a separate issues.
I suggested you look at the following book:
https://www.oreilly.com/library/view/getting-started-with/9781491900550/
The websites of BLE module manufacturers also offer a lot of information about this technology. For example Nordic or TI. Very often with sample programs for various platforms.
For iOS:
https://developer.apple.com/videos/play/wwdc2017/712/
https://developer.apple.com/bluetooth/
You may also be interested in sending more data without connection using version BLE 5.0
https://www.bluetooth.com/blog/exploring-bluetooth5-whats-new-in-advertising/

Automatic iBeacon support in Cars

Do all Cars that support Bluetooth also automiatically support iBeacon without any additional work?
I want to test if the user is currently I his/her car. According to this question, this is generally not possible but iBeacon may be a solution. Thus, my question is if iBeacon is always supported by a Car if it has Bluetooth or if special hardware is required.
No, not all Bluetooth enabled cars emit iBeacon transmissions. I can say this with certainty as my 2017 Mini Cooper pairs over Bluetooth yet does not emit an iBeacon transmission.
I also rent late model cars relatively frequently and am the developer of a number of beacon detector apps. While I have not explicitly tested all vehicles I have rented, I have never once noticed one triggering a detector app. My conclusion is that few if any vehicles emit iBeacon transmissions in general use.
I have worked with an insurance provider that provides beacons to be installed in customer cars (typically plugged in to a USB adapter) allowing vehicle usage tracking with the company app in exchange for a discount. An extra hardware solution like this would be required to accomplish your goal with iBeacon.
Not sure this is an alternative for you, but you could place a beacon in the car and have an app on your phone detect it and perform an action on that fact. Of course the app then would have to run also when the phone and the app are not actively used.
NFC could also be used this way, provided the phone is always placed in a holder.

iBeacon: Understanding beacon battery tuning using parameters

If beacons are only broadcasters and they can not communicate with iPhone or other devices, How come companies like Estimote, Bluecats provide configurable parameters like Advertising Interval,Broadcasting power etc reflects the change on its battery life.
In recent update they are also providing parameters like smart battery saving and basic battery saving ?
General answer followed by technical terms will be appreciated.
Bluetooth beacons typically implement broadcast-only standards like iBeacon, AltBeacon or Eddystone which use Bluetooth LE advertising with no two-way communication as you suggest.
However, there is nothing in these standards that says that a hardware device that acs as a beacon can't implement two-way communication for other purposes. And that's exactly what most manufacturers do. They implement a custom GATT service that allows read-write access to configuration parameters inside the beacon. This allows an iPhone, Android device, Mac or Windows PC to make a read-write connection to the beacon device and set parameters like advertising interval as well as the beacon identifiers.
You can see an example of such a GATT service in Google's Eddystone Configuration Service.. This is an attempt to standardize the way you configure Eddystone beacons across manufacturers. Similar non-standard GATT configuration services are used by manufacturers supporting the iBeacon format. Some manufacturers publish these GATT service APIs and some do not, keeping the APIs private only for use inside their configuration apps.

Controlling a device with CoreBluetooth

I was looking at a couple CoreBluetooth tutorials for iOS. Based on the tutorials, it looks like one device is transmitting data and the other device is receiving. Like in this example: http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor the heart rate monitor is transmitting and the iphone is receiving. Is there a way to just connect to device to control it?
For example, I have a soundbar that is Bluetooth and can I write an app to do the same thing the remote it comes with does (volume up, volume down, input source change, power off)?
Adafruit proposes a lot of tutorials / material to learn how to use BLE (Bluetooth low energy)
tutorial about their BLE module (that could run with an Arduino): https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout
tutorial about their iOS app (to connect to the previous module): https://learn.adafruit.com/bluefruit-le-connect-for-ios
iOS app source code to connect to BLE devices or play with previous module: https://github.com/adafruit/Bluefruit_LE_Connect
If you need one way transmission with the maximun data rate you need to read this article:
http://www.tbideas.com/blog/2013/04/Optimizing-Bluetooth-Low-Energy-Performance/
it talks about CBCharacteristicWriteWithoutResponse
Stackoverflow thread about the same one way communication subject:
iOS. BLE. CBCharacteristicWriteWithoutResponse - How to make it work?
Hope this helps!

HM-10 and iOS/iBeacon. Communicating between the two

I am trying to wrap my head around the possibilities of the HM-10 but am very new to a lot of how it works. I am only familiar with higher level things.
I originally thought I was going to use the hm-10 as an iBeacon but quickly found out it's limitations. Here was the original plan prior:
iBeacon(HM-10) broadcast in a particular room, when I walk in with my iPhone, it detects my iPhone and then does something, i.e Sets one of its Pins to High.
But based on my research now, this is not possible with iBeacon? I need to use iBeacon broadcasting in hand with regular bluetooth?
As in, upon my App/Phone detecting the iBeacon it then pairs with the HM-10 and sends an AT- command to set one of the pins HIGH.
Does all of this make sense? Could anyone provide some more input?
I am in the process of putting together an iPhone App but just wanted to know if I am on the right track.
Since the HM-10 is based on the CC2540, it should be possible to turn it into a Bluetooth LE beacon, including one that supports an iBeacon format.
A few thoughts to help your understanding:
Standard Bluetooth LE beacons (AltBeacon, iBeacon, URL beacon) are transmit only devices that don't detect phones -- phones detect them using a custom app. So when you say "it detects my iPhone and then does something" this is diverging from a standard Bluetooth LE beacon.
The concept of "pairing" with a Bluetooth device is typically related to Bluetooth classic (e.g. pre-4.0) technology. Bluetooth LE devices like the beacons mentioned above have the concept of connecting to read and write GATT characteristics.
If you do build a custom BLE device that out of a HM-10/CC2540, it would be possible to make it "detect" mobile phones, perhaps by advertising a GATT service, and then doing something upon connecting and/or writing to a characteristic. Since the CC2540 contains GPIO pins, it would be possible to make it "do something" by making a pin go high.
There are two big chunks of work to doing what you describe: (1) writing custom firmware for the CC2540 and (2) writing an iPhone app using CoreBluetooth and/or CoreLocation iBeacon APIs. Before starting on the iOS side, you need to figure out how the Bluetooth device is going to work.

Resources