BLE 101 
Jacob Rosenthal 
pretty deep dive. Expect you'll want a copy of the slides to refresh 
i hear DCC likes code talks, so this is a bit of a bait and switch 
So really more of a state of BLE 
only a SMALL amount of code at the end
About Me 
Consulting hardware and firmware engineer 
#hackPHX 
citizengadget.com 
@jacobrosenthal 
HeatSync and HackPHX 
Consulting hardware engineer - Hardware, firmware 
Done work for Octoblu several talks here today 
Consumer products, a lot of IOT right now 
Wearables my passion - did research at ASU and still consult for them on haptics 
citizengadget.com 
@jacobrosenthal 
fine places to get ahold of me if you need some work done
Agenda 
• Overview of BLE 
• Choosing your BLE solution 
• Platform support 
• Code (javascript) 
• Conclusion 
Seems simple enough… But lets see
Agenda 
• Overview of BLE 
• Choosing your BLE solution 
• Platform support 
• Code (javascript) 
• Conclusion 
Seems simple enough… But lets see
Overview of BLE 
Bluetooth Smart (Bluetooth 4.0) 
• Bluetooth Classic 
• Bluetooth High Speed 
• Bluetooth Low Energy - nee Wibree/ULP 
Bluetooth 4.0 vs BLE 
Bluetooth 4 (also called Bluetooth Smart) is really three things, Bluetooth Low Energy, Bluetooth High Speed, and Bluetooth Classic. 
Bluetooth Classic (ie all of BT2.1, or BT3.0 is still there!) 
Bluetooth High Speed most people have never heard of yet. It lets Bluetooth Classic up negotiate a Wifi connection for high speed transfers. 
Finally Bluetooth Low Energy, BLE, is what we all talk about when we say BT4.0 - entirely new protocol stack
Overview of BLE 
http://en.wikipedia.org/wiki/Bluetooth_low_energy 
So why did we a need BLE? as much as 2 magnitudes decrease in power consumption 
but you can push it, if you use the shit out of it its not low power anymore 
how: 
by reducing throughput from 0.7–2.1 Mbit/s to 0.27 Mbit/s 
reducing range from ~300ft to what Ive seen and experienced ~30ft 
reducing advertising rate to as low as every other second, and only on 3 of 40 channels so less to search through too means device doesn't have to stay awake as much 
All this means generally poorly supports high throughput or high current like streaming audio, leds/motors. Again BLE doesn't replace BT Classic. 
Also BT is a pain in the dick - sets out to fix that in some ways
Overview of BLE - Terms 
GAP - Master/Slave or rather Central/Peripheral 
• Pairing - actually separated into Connection and 
Authentication 
BLE is a master/slave system, or rather Central/Peripheral. One connection at a time. No advertising while connected. 
.
Overview of BLE - Terms 
Broadcasting - Sneak some data in Advertising. 
• In practice lets one device talk to many 
• Simple! - Uses nothing else well talk about today. 
• iBeacon is just Apples trademark for this concept 
• Almost nobody is doing anything interesting yet 
Advertising - big new thing here is broadcasting, we can sneak some data in 
Slaves ping out their advertising data rlatively rarely- including its tx power, ssid name and another up to 20 bytes of data. This data could be dynamic -, but no 
implementations I've come across let you change it outside of initial setup of the chip. This is what iBeacons and other proximity are using. Beware though, In my 
experience you really can only tell three distinct magnitudes <1 foot, <10ft, <100ft. 
This data could be dynamic, (stuff sensor data in there) though no implementations I've come across utilize that fact. Ive asked punch through why it hasn't been done 
yet and they think its because the apple implementation wouldn't support it easily and they’re the biggest dog right now.
BLE Defined - Profiles, Services, Characteristics 
https://learn.adafruit.com/introduction-to-bluetooth-low-energy/introduction 
profiles hath services have characteristics
BLE Defined - Profiles, Services, Characteristics 
https://developer.bluetooth.org/TechnologyOverview/Pages/HRP.aspx 
heartrate profile has heart rate service and device information service 
https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx 
Spec defines tons of profiles like blood pressure, alerts, thermometer, heart rate, HID, Proximity, Time, Or make your own!
BLE Defined - Profiles, Services, Characteristics 
https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx 
Theres a location, the measurement itself, and a control (settings) characteristic
BLE Defined - Profiles, Services, Characteristics 
https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx 
we can read the sensor location characteristic, and set a notification (subscribe) to the heart rate measurement characteristic, and we can write to the configurator 
descriptor (device setup, in this case to tell device to start or stop sending data)
Overview of BLE - Terms 
UUIDs 
• Devices 
• Services 
• Characteristics 
Bean - A495FF10-C5B1-4B44-B512-1370F02D74DE 
Heart Rate -180D 
uuids 
official services and characteristics have a shortened 16 bit uuid, devices and custom services/characteristics have 128 bit uuids
Agenda 
• Overview of BLE 
• Choosing your BLE solution 
• Platform support 
• Code (javascript) 
• Conclusion
Choosing BLE Solution - How to pick? 
Metawear, Bleduino, Zwear, Rfduino, RedBear 
Punchthrough
Choosing BLE Solution - How to pick? 
MacGuffins: • Led 
• Accelerometer! 
• Temperature 
• Size 
• The word Arduino 
• Does it have the profile you want? 
• Does it let you make profiles? 
• Actually Low power? 
• Does it force you to use an IDE? 
• Can you program it on mac/linux? 
• Is it actually Arduino? 
Better criteria:
Choosing BLE Solution - How to pick? 
Bean 
2 microcontrollers, their module + actual Arduino 
Program wirelessly 
Immature SDK - Not a lot of services / profiles 
Cant make your own (though they have ‘scratch’ 
characteristics) 
I wont bury the lead. Ill start with the best and it'll get worse.
Choosing BLE Solution - How to pick? 
Metawear 
You don't write ‘arduino’ code at all 
You’re stuck with what sensors it has
Choosing BLE Solution - How to pick? 
Redbear 
Actually Arduino 
Really complex arduino SDK and uses up lots of 
your arduino 
Terrible Open Source track record 
Lets look at our list again 
redbear 
arduino has to communicate with nrf8001 transceiver which means its really complicated and theres not a lot of room for your stuff on the micro. Also very disappointed 
with their 'open source' label. have years long tickets asking for schematics and theyve finally released their ios stuff but it doesnt have firmata or other features their 
apps use. Continue to promise they'll release new stuff, well see. 
New stuff coming out very soon, but their track record is so bad.
Choosing BLE Solution - How to pick? 
ZWear 
Its open source, but you have to use a Windows 
only IDE called IAR 
zwear is ‘open source’ (havent checked) some windows only IDE called IAR!
Choosing BLE Solution - How to pick? 
Chinese 
tranceivers 
SPP devices, only Serial data out over BLE. 
No access to characteristics or services 
Terrible battery life, no real way to put them to sleep. They’re always listening for serial data to send!
Choosing BLE Solution - How to pick? 
RFDuino 
Actually not Arduino. Rewriting arduino from 
scratch for arm processor! 
Terrible Open Source track record 
Lets look at our list again 
RFDuino was supposed to be open source + arduino but got into a lot of trouble and turned their back on open source. Not actually arduino! like Spark (but closed 
source) are rewriting arduino for arm AND rewriting nordics code so its a heroic effort and slow going
How did this get so 
hard so quick?
Choosing BLE Solution 
Solution 
Module 
Chip 
Metawear, Bleduino, Zwear, 
Rfduino, RedBear 
Punchthrough 
Adafruit, RedBear, Panasonic, 
Bluegiga, Laird, ConnectBlue, 
Fujitsu, Stollman, Blue Radios, 
RfDuino, PunchThrough 
TI, CSR, ST blueNRG, Nordic, 
Broadcom 
~$30 
$15-30 
$2-5 
So lets separate our vendors into 3 categories, theres tons more vendors but this is a start
Choosing BLE Solution 
Chip TI, CSR, ST blueNRG, Nordic 
mbientlab.com/blog/how-much-does-ble-really-cost-a-tip-from-renaissance-io/ 
Probably none of you will ever dwell here, and I hope to talk you out of it, but to explain that we need to talk at the chip level. 
ibeacons can be had under 5 each!? 
why pay 30?! 
http://mbientlab.com/blog/how-much-does-ble-really-cost-a-tip-from-renaissance-io/ 
First as a prototyper and consumer products engineer, not really. Basically nothing can be made and shipped for under $30. Arduino, $30, Arduino Shields $30, the list 
goes on and on 
True at scale and its not your main business model you can get Chinese clones and cheap shit for $15 but that doesn't support code development, support or anything 
else.
Choosing BLE Solution 
Chip TI, CSR, ST blueNRG, Nordic 
Caution: 
• Difficult footprints to solder 
• NDA (forget open source) 
• Quantity Buys, only dealing with Corps 
• Windows only tools (No GCC) 
• Per Seat Licensing 
• $100s in development tools 
• Antenna engineering 
• FCC Certification ($5k per region) 
• Arm complexity (this aint Arduino) 
Probably none of you will ever dwell here, and I hope to talk you out of it, but to explain that we need to talk at the chip level. 
solder footprints, ndas, quantity buys and corporate domains, windows only, per seat licensing mean tools and compilers can cost thousands!, antenna engineering, arm 
isn't arduino—all arm code is an island, not like what arduino has accomplished over the past few years 
For nerds, closest right now is Nordic specifically their nrf51 parts and the MBED stack (arduino for arm) which is where Im currently focusing 
Knowing that NRF is the closest starts to tell you which solution you might want to look at
Choosing BLE Solution 
Metawear, Bleduino, Zwear, Rfduino, RedBear 
Punchthrough 
So these guys absorbing all that pain for you, and charging you for it 
But no NDA means they can’t break their NDA, so they’re Rewriting the entire god damn stack 
Bluegiga uses cc2540 and sells bgscript to get you out of that nightmare. 
RFduino, laird, uses nordic 
Punchthrough uses TI, RedBear used to use TI, now uses Nordic? 
Cheap Chinese modules use CSR and ISSC - just serial port passthrough
Choosing BLE Solution - PunchThrough Bean 
Bean 
Prefer nordic so we can eventually drop down to their base chip if we go to production 
so after all that, even though its based on TI, Punchthrough wins anyway runner up to bleeding 
its a silicon valley startup spin on it 
doing a great job making it friendly 
Bean actually has an arduino, don't have to reengineer that piece 
but doesn't fuss up your sketch with nonsense or use up all of your cycles 
power is good 
code is.. coming 
Im picking NRF51 based solutions for developers who are going to drop down and want more power
Agenda 
• Overview of BLE 
• Choosing your BLE solution 
• Platform support 
• Code (javascript) 
• Conclusion
Platform Support - Windows 
Software Hardware 
• May be built 
in, or buy 
dongle 
• Windows 8+ 
BLE is already here 
Start with the bad though 
Windows8 brought BLE support, but I don’t know how much hardware has it built in. In the Windows ecosystem though, its a cheap purchase to grab a BLE dongle from 
amazon. 
However early reports are not good. Punchthrough is months behind on their windows support 
recent progress means they might get it, but indicating that workflow significantly poorer than other platforms 
https://punchthrough.com/bean/development-schedule/ 
Sorry windows people, but by now you should understand Windows is a platform saddled with huge legacy.
Platform Support - Android 
Software Hardware 
• Samsung S3 
and Note 2+ 
• HTC One+ 
• LG Optimus 
4x, Nexus 4, 
Optimus G+ 
• Jellybean+ 
Android bet aggressively on NFC, and kind of lost on that. Their NFC is apparently good, not that it matters, but BLE has been bad. In frustration vendors like Samsung 
started rolling their own stacks. Official support came in 4.3 Jellybean. With hardware support Samsung s3 and note 2 and up, Htc One and up , LG Optimus 4x, Nexus 
4, Optimus G and up. Your results may vary though. Grabbing a new phone is probably your best bet. 
Apple has aggressively implemented BLE as far back as 2011 in the iPhone 4s and 2012 for most of the rest of their products. The API is basically the same for both 
(corebluetooth). The experience is really nice. Further the Noble abstraction layer is available for BLE on macs via JS.
Platform Support - Apple 
Software Hardware 
• Mac/IOS- 
2011 Mac Air 
and Mac Mini+ 
• Ipad 3rd gen+ 
• 2012 Macbook 
Pros+ 
• IOS5+ 
• OSX 10.7.2 Lion+ 
Apple has aggressively implemented BLE as far back as 2011 in the iPhone 4s and 2012 for most of the rest of their products. The API is basically the same for both 
(corebluetooth). The experience is really nice. Further the Noble abstraction layer is available for BLE on macs via JS.
Platform Support - Linux 
Software Hardware 
• Linux CSR 
• Broadcom 
• bluez or bluepy 
Linux -
Agenda 
• Overview of BLE 
• Choosing your BLE solution 
• Platform support 
• Code (javascript) 
• Conclusion
Code! 
Noble - unified cross platform abstraction 
Mac / Linux 
Mobile soon thanks to @monteslu 
Lifecycle 
• Discover peripherals 
• Connect 
• Discover Services 
• Discover Characteristics 
• Use Characteristics 
That being said, Noble, on Mac and Linux, is becoming a unified 
https://www.npmjs.org/package/noble 
So based on that platform support 
mac linux have something called noble in JS that ties everything together cross platform 
more abstractions possible, our very own Luis Montes trying to help with some of that bringing the noble js abstractions to phones 
I wrote the unofficial punch through NPM package on noble 
we like this so well go there
Code! - Discover Devices 
You search for a device based upon a service it has that you want. IE give me devices who have a heart rate service. You can leave that scan going for.. ever really. More 
likely you want to start a scan and stop it every couple minutes to see if your device popped up.
Code! - Connect and Discover Services 
When you get a hit, your callback will be called with a peripheral. Keep this around so you can disconnect it later. 
You might check that you got the right one, and stop scanning. 
We still actually need to discover the service so we can get the juicy characteristics were after. so do that with another callback. 
Now your callback gets called with a service.
Code! - Discover Characteristics 
Ask it for specific characteristics that you’re looking for like heart rate measurement. When your callback gets called you need to save a copy of that characteristic 
somewhere.
Code! - Save and Use Characteristics 
Now that you've got a characteristic you can set a notify on it so that function gets called every time theres new data, you can write to it to send data, or read from it.
Code! - Kappa 
npm install ble-bean 
So now a real world example 
Now, Ive taken all that for the bean for instance and wrapped it in a library called ble-bean so it looks like this 
https://www.npmjs.org/package/ble-bean
Agenda 
• Overview of BLE 
• Choosing your BLE solution 
• Platform support 
• Code (javascript) 
• Conclusion
Conclusion 
• Stick with BLE its still maturing 
• Buy a bean 
• feel free to email me with questions 
• check out this BLE hackathon at Arcosanti 
Ive also written ble for iOS and punch through offers a lot of stuff there 
also checkout hackathon upcoming at arcostanti 
I may or may not be able to attend :) 
https://www.facebook.com/events/503068346497493/ 
Basically all of these BLE chips are arm chip with a BLE stack on them. 
Arm They license their silicon designs and thumb (assembly) instruction set. But then all manufacturers made their own C abstraction above that. Tower of babel now. 
Arm trying to reunify ala arduino.. mbed. 
As we said Nordic is the only chip that has gcc, and thus its also being developed for arm 
Im working there right now

Desert Code Camp 2014.2 Intro to Bluetooth Low Energy

  • 1.
    BLE 101 JacobRosenthal pretty deep dive. Expect you'll want a copy of the slides to refresh i hear DCC likes code talks, so this is a bit of a bait and switch So really more of a state of BLE only a SMALL amount of code at the end
  • 2.
    About Me Consultinghardware and firmware engineer #hackPHX citizengadget.com @jacobrosenthal HeatSync and HackPHX Consulting hardware engineer - Hardware, firmware Done work for Octoblu several talks here today Consumer products, a lot of IOT right now Wearables my passion - did research at ASU and still consult for them on haptics citizengadget.com @jacobrosenthal fine places to get ahold of me if you need some work done
  • 3.
    Agenda • Overviewof BLE • Choosing your BLE solution • Platform support • Code (javascript) • Conclusion Seems simple enough… But lets see
  • 4.
    Agenda • Overviewof BLE • Choosing your BLE solution • Platform support • Code (javascript) • Conclusion Seems simple enough… But lets see
  • 5.
    Overview of BLE Bluetooth Smart (Bluetooth 4.0) • Bluetooth Classic • Bluetooth High Speed • Bluetooth Low Energy - nee Wibree/ULP Bluetooth 4.0 vs BLE Bluetooth 4 (also called Bluetooth Smart) is really three things, Bluetooth Low Energy, Bluetooth High Speed, and Bluetooth Classic. Bluetooth Classic (ie all of BT2.1, or BT3.0 is still there!) Bluetooth High Speed most people have never heard of yet. It lets Bluetooth Classic up negotiate a Wifi connection for high speed transfers. Finally Bluetooth Low Energy, BLE, is what we all talk about when we say BT4.0 - entirely new protocol stack
  • 6.
    Overview of BLE http://en.wikipedia.org/wiki/Bluetooth_low_energy So why did we a need BLE? as much as 2 magnitudes decrease in power consumption but you can push it, if you use the shit out of it its not low power anymore how: by reducing throughput from 0.7–2.1 Mbit/s to 0.27 Mbit/s reducing range from ~300ft to what Ive seen and experienced ~30ft reducing advertising rate to as low as every other second, and only on 3 of 40 channels so less to search through too means device doesn't have to stay awake as much All this means generally poorly supports high throughput or high current like streaming audio, leds/motors. Again BLE doesn't replace BT Classic. Also BT is a pain in the dick - sets out to fix that in some ways
  • 7.
    Overview of BLE- Terms GAP - Master/Slave or rather Central/Peripheral • Pairing - actually separated into Connection and Authentication BLE is a master/slave system, or rather Central/Peripheral. One connection at a time. No advertising while connected. .
  • 8.
    Overview of BLE- Terms Broadcasting - Sneak some data in Advertising. • In practice lets one device talk to many • Simple! - Uses nothing else well talk about today. • iBeacon is just Apples trademark for this concept • Almost nobody is doing anything interesting yet Advertising - big new thing here is broadcasting, we can sneak some data in Slaves ping out their advertising data rlatively rarely- including its tx power, ssid name and another up to 20 bytes of data. This data could be dynamic -, but no implementations I've come across let you change it outside of initial setup of the chip. This is what iBeacons and other proximity are using. Beware though, In my experience you really can only tell three distinct magnitudes <1 foot, <10ft, <100ft. This data could be dynamic, (stuff sensor data in there) though no implementations I've come across utilize that fact. Ive asked punch through why it hasn't been done yet and they think its because the apple implementation wouldn't support it easily and they’re the biggest dog right now.
  • 9.
    BLE Defined -Profiles, Services, Characteristics https://learn.adafruit.com/introduction-to-bluetooth-low-energy/introduction profiles hath services have characteristics
  • 10.
    BLE Defined -Profiles, Services, Characteristics https://developer.bluetooth.org/TechnologyOverview/Pages/HRP.aspx heartrate profile has heart rate service and device information service https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx Spec defines tons of profiles like blood pressure, alerts, thermometer, heart rate, HID, Proximity, Time, Or make your own!
  • 11.
    BLE Defined -Profiles, Services, Characteristics https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx Theres a location, the measurement itself, and a control (settings) characteristic
  • 12.
    BLE Defined -Profiles, Services, Characteristics https://developer.bluetooth.org/TechnologyOverview/Pages/HRS.aspx we can read the sensor location characteristic, and set a notification (subscribe) to the heart rate measurement characteristic, and we can write to the configurator descriptor (device setup, in this case to tell device to start or stop sending data)
  • 13.
    Overview of BLE- Terms UUIDs • Devices • Services • Characteristics Bean - A495FF10-C5B1-4B44-B512-1370F02D74DE Heart Rate -180D uuids official services and characteristics have a shortened 16 bit uuid, devices and custom services/characteristics have 128 bit uuids
  • 14.
    Agenda • Overviewof BLE • Choosing your BLE solution • Platform support • Code (javascript) • Conclusion
  • 15.
    Choosing BLE Solution- How to pick? Metawear, Bleduino, Zwear, Rfduino, RedBear Punchthrough
  • 16.
    Choosing BLE Solution- How to pick? MacGuffins: • Led • Accelerometer! • Temperature • Size • The word Arduino • Does it have the profile you want? • Does it let you make profiles? • Actually Low power? • Does it force you to use an IDE? • Can you program it on mac/linux? • Is it actually Arduino? Better criteria:
  • 17.
    Choosing BLE Solution- How to pick? Bean 2 microcontrollers, their module + actual Arduino Program wirelessly Immature SDK - Not a lot of services / profiles Cant make your own (though they have ‘scratch’ characteristics) I wont bury the lead. Ill start with the best and it'll get worse.
  • 18.
    Choosing BLE Solution- How to pick? Metawear You don't write ‘arduino’ code at all You’re stuck with what sensors it has
  • 19.
    Choosing BLE Solution- How to pick? Redbear Actually Arduino Really complex arduino SDK and uses up lots of your arduino Terrible Open Source track record Lets look at our list again redbear arduino has to communicate with nrf8001 transceiver which means its really complicated and theres not a lot of room for your stuff on the micro. Also very disappointed with their 'open source' label. have years long tickets asking for schematics and theyve finally released their ios stuff but it doesnt have firmata or other features their apps use. Continue to promise they'll release new stuff, well see. New stuff coming out very soon, but their track record is so bad.
  • 20.
    Choosing BLE Solution- How to pick? ZWear Its open source, but you have to use a Windows only IDE called IAR zwear is ‘open source’ (havent checked) some windows only IDE called IAR!
  • 21.
    Choosing BLE Solution- How to pick? Chinese tranceivers SPP devices, only Serial data out over BLE. No access to characteristics or services Terrible battery life, no real way to put them to sleep. They’re always listening for serial data to send!
  • 22.
    Choosing BLE Solution- How to pick? RFDuino Actually not Arduino. Rewriting arduino from scratch for arm processor! Terrible Open Source track record Lets look at our list again RFDuino was supposed to be open source + arduino but got into a lot of trouble and turned their back on open source. Not actually arduino! like Spark (but closed source) are rewriting arduino for arm AND rewriting nordics code so its a heroic effort and slow going
  • 23.
    How did thisget so hard so quick?
  • 24.
    Choosing BLE Solution Solution Module Chip Metawear, Bleduino, Zwear, Rfduino, RedBear Punchthrough Adafruit, RedBear, Panasonic, Bluegiga, Laird, ConnectBlue, Fujitsu, Stollman, Blue Radios, RfDuino, PunchThrough TI, CSR, ST blueNRG, Nordic, Broadcom ~$30 $15-30 $2-5 So lets separate our vendors into 3 categories, theres tons more vendors but this is a start
  • 25.
    Choosing BLE Solution Chip TI, CSR, ST blueNRG, Nordic mbientlab.com/blog/how-much-does-ble-really-cost-a-tip-from-renaissance-io/ Probably none of you will ever dwell here, and I hope to talk you out of it, but to explain that we need to talk at the chip level. ibeacons can be had under 5 each!? why pay 30?! http://mbientlab.com/blog/how-much-does-ble-really-cost-a-tip-from-renaissance-io/ First as a prototyper and consumer products engineer, not really. Basically nothing can be made and shipped for under $30. Arduino, $30, Arduino Shields $30, the list goes on and on True at scale and its not your main business model you can get Chinese clones and cheap shit for $15 but that doesn't support code development, support or anything else.
  • 26.
    Choosing BLE Solution Chip TI, CSR, ST blueNRG, Nordic Caution: • Difficult footprints to solder • NDA (forget open source) • Quantity Buys, only dealing with Corps • Windows only tools (No GCC) • Per Seat Licensing • $100s in development tools • Antenna engineering • FCC Certification ($5k per region) • Arm complexity (this aint Arduino) Probably none of you will ever dwell here, and I hope to talk you out of it, but to explain that we need to talk at the chip level. solder footprints, ndas, quantity buys and corporate domains, windows only, per seat licensing mean tools and compilers can cost thousands!, antenna engineering, arm isn't arduino—all arm code is an island, not like what arduino has accomplished over the past few years For nerds, closest right now is Nordic specifically their nrf51 parts and the MBED stack (arduino for arm) which is where Im currently focusing Knowing that NRF is the closest starts to tell you which solution you might want to look at
  • 27.
    Choosing BLE Solution Metawear, Bleduino, Zwear, Rfduino, RedBear Punchthrough So these guys absorbing all that pain for you, and charging you for it But no NDA means they can’t break their NDA, so they’re Rewriting the entire god damn stack Bluegiga uses cc2540 and sells bgscript to get you out of that nightmare. RFduino, laird, uses nordic Punchthrough uses TI, RedBear used to use TI, now uses Nordic? Cheap Chinese modules use CSR and ISSC - just serial port passthrough
  • 28.
    Choosing BLE Solution- PunchThrough Bean Bean Prefer nordic so we can eventually drop down to their base chip if we go to production so after all that, even though its based on TI, Punchthrough wins anyway runner up to bleeding its a silicon valley startup spin on it doing a great job making it friendly Bean actually has an arduino, don't have to reengineer that piece but doesn't fuss up your sketch with nonsense or use up all of your cycles power is good code is.. coming Im picking NRF51 based solutions for developers who are going to drop down and want more power
  • 29.
    Agenda • Overviewof BLE • Choosing your BLE solution • Platform support • Code (javascript) • Conclusion
  • 30.
    Platform Support -Windows Software Hardware • May be built in, or buy dongle • Windows 8+ BLE is already here Start with the bad though Windows8 brought BLE support, but I don’t know how much hardware has it built in. In the Windows ecosystem though, its a cheap purchase to grab a BLE dongle from amazon. However early reports are not good. Punchthrough is months behind on their windows support recent progress means they might get it, but indicating that workflow significantly poorer than other platforms https://punchthrough.com/bean/development-schedule/ Sorry windows people, but by now you should understand Windows is a platform saddled with huge legacy.
  • 31.
    Platform Support -Android Software Hardware • Samsung S3 and Note 2+ • HTC One+ • LG Optimus 4x, Nexus 4, Optimus G+ • Jellybean+ Android bet aggressively on NFC, and kind of lost on that. Their NFC is apparently good, not that it matters, but BLE has been bad. In frustration vendors like Samsung started rolling their own stacks. Official support came in 4.3 Jellybean. With hardware support Samsung s3 and note 2 and up, Htc One and up , LG Optimus 4x, Nexus 4, Optimus G and up. Your results may vary though. Grabbing a new phone is probably your best bet. Apple has aggressively implemented BLE as far back as 2011 in the iPhone 4s and 2012 for most of the rest of their products. The API is basically the same for both (corebluetooth). The experience is really nice. Further the Noble abstraction layer is available for BLE on macs via JS.
  • 32.
    Platform Support -Apple Software Hardware • Mac/IOS- 2011 Mac Air and Mac Mini+ • Ipad 3rd gen+ • 2012 Macbook Pros+ • IOS5+ • OSX 10.7.2 Lion+ Apple has aggressively implemented BLE as far back as 2011 in the iPhone 4s and 2012 for most of the rest of their products. The API is basically the same for both (corebluetooth). The experience is really nice. Further the Noble abstraction layer is available for BLE on macs via JS.
  • 33.
    Platform Support -Linux Software Hardware • Linux CSR • Broadcom • bluez or bluepy Linux -
  • 34.
    Agenda • Overviewof BLE • Choosing your BLE solution • Platform support • Code (javascript) • Conclusion
  • 35.
    Code! Noble -unified cross platform abstraction Mac / Linux Mobile soon thanks to @monteslu Lifecycle • Discover peripherals • Connect • Discover Services • Discover Characteristics • Use Characteristics That being said, Noble, on Mac and Linux, is becoming a unified https://www.npmjs.org/package/noble So based on that platform support mac linux have something called noble in JS that ties everything together cross platform more abstractions possible, our very own Luis Montes trying to help with some of that bringing the noble js abstractions to phones I wrote the unofficial punch through NPM package on noble we like this so well go there
  • 36.
    Code! - DiscoverDevices You search for a device based upon a service it has that you want. IE give me devices who have a heart rate service. You can leave that scan going for.. ever really. More likely you want to start a scan and stop it every couple minutes to see if your device popped up.
  • 37.
    Code! - Connectand Discover Services When you get a hit, your callback will be called with a peripheral. Keep this around so you can disconnect it later. You might check that you got the right one, and stop scanning. We still actually need to discover the service so we can get the juicy characteristics were after. so do that with another callback. Now your callback gets called with a service.
  • 38.
    Code! - DiscoverCharacteristics Ask it for specific characteristics that you’re looking for like heart rate measurement. When your callback gets called you need to save a copy of that characteristic somewhere.
  • 39.
    Code! - Saveand Use Characteristics Now that you've got a characteristic you can set a notify on it so that function gets called every time theres new data, you can write to it to send data, or read from it.
  • 40.
    Code! - Kappa npm install ble-bean So now a real world example Now, Ive taken all that for the bean for instance and wrapped it in a library called ble-bean so it looks like this https://www.npmjs.org/package/ble-bean
  • 41.
    Agenda • Overviewof BLE • Choosing your BLE solution • Platform support • Code (javascript) • Conclusion
  • 42.
    Conclusion • Stickwith BLE its still maturing • Buy a bean • feel free to email me with questions • check out this BLE hackathon at Arcosanti Ive also written ble for iOS and punch through offers a lot of stuff there also checkout hackathon upcoming at arcostanti I may or may not be able to attend :) https://www.facebook.com/events/503068346497493/ Basically all of these BLE chips are arm chip with a BLE stack on them. Arm They license their silicon designs and thumb (assembly) instruction set. But then all manufacturers made their own C abstraction above that. Tower of babel now. Arm trying to reunify ala arduino.. mbed. As we said Nordic is the only chip that has gcc, and thus its also being developed for arm Im working there right now