16
DIY Eddystone BLE Beacons: Architecture & Hacking Getting Connected To… EVERYTHING!!! -- Mike Hinkle --

DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

DIY Eddystone BLE Beacons: Architecture & Hacking

Getting Connected To…

EVERYTHING!!!

-- Mike Hinkle --

Page 2: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

What is IoT?

• Google: “a proposed development of the Internet in which everyday objects have network connectivity, allowing them to send and receive data.”

• TechTarget: “The Internet of Things (IoT) is a scenario in which objects, animals or people are provided with unique identifiers and the ability to transfer data over a network without requiring human-to-human or human-to-computer interaction.”

• Wikipedia: “The Internet of Things allows objects to be sensed and controlled remotely across existing network infrastructure, creating opportunities for more direct integration between the physical world and computer-based systems, and resulting in improved efficiency, accuracy and economic benefit…. Experts estimate that the IoT will consist of almost 50 billion objects by 2020. Things, in the IoT, can refer to a wide variety of devices…. These devices collect useful data with the help of various existing technologies and then autonomously flow the data between other devices. Current market examples include smart thermostat systems and washer/dryers that utilize Wi-Fi for remote monitoring. IoT is also expected to generate large amounts of data from diverse locations that is aggregated very quickly, thereby increasing the need to better index, store and process such data.”

Page 3: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Getting Started

• Go to the Apps or Play store on your mobile device and download:

– “Beacon Scanner”

– And/or “RadBeacon” by Radius Networks

– If you have a current OS, download the Physical Web app (by the Physical Web project)

Page 4: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Why?

• We’re mid-way through the big inflection point for IoT device and infrastructure design

– Best chance to have big impact is next 3 years

• To make sure the Houston and Texas developer, inventor and engineering communities are informed and know how to get started

• To build the technical “can do” skills so we’re ready to capitalize on the biggest change in the human/computing interface yet

Page 5: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

What’s Next?

• DO SOMETHING with what you learn here! – Experiment, fail, challenge, learn, SUCCEED

• Share with the broader community – Best forum: Houston Mini Maker Faire @ GRB

11/12-13. Get energized and inspire others!

• Contact info – Houstonmakerfaire.com

[email protected]

[email protected]

Page 6: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

IoT: A Systems View

Inputs Connections Actions

Inform

Control

Output/Feed

Control

Sensors

Systems

People

Processing is Everywhere

Page 7: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

BLE Beacons: Original Architecture

Where am I?

• Originally targeted indoor location and information systems • Locate customer

in store • Provide location-

relevant info to customer

• Compared received power (RSSI) vs. transmit power to figure distance from each beacon • Then triangulation

• Clever, but too costly (at the time) and not accurate enough

Indoor Space GPS not useful

Bringing intelligence to indoor spaces is a primary challenge for IoT

Page 8: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Technology Marches Forward

• Bluetooth (BLE) chipsets got better and CHEAPER

• In 2014 some radical new hardware appeared

– Step change in price performance

– Network stack, including IP, in firmware

• We all bought smartphones, and most now support BLE

• IoT dreams became real

Page 9: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

New IoT Potential for BLE Beacons

• IoT differentiators: – Harvesting and collecting a LOT more data from

the real world, via sensors

– Using that data to generate actions (control) back in the real world

• The #1 challenge for IoT sensor units: POWER

• The #2 challenge: COST of all those sensors!

• The advances in BLE chip sets have changed the game here

Page 10: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Eddystone Unlocks a BIG DOOR

• 3 beacon standards: iBeacon, AltBeacon, Eddystone – Most commercial units can do all 3

• Eddystone designed for the most varied use cases – Centerpiece of the Physical Web

• Beacons become the URLs of physical objects and places, thus giving them implied digital intelligence

– Designed for configurable data in the payload

– Google has embedded beacon support in the OS (Android, iOS and add-in) and browser (Chrome)

Page 11: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Why Am I Interested in BLE Beacons?

• Because I’m developing sensor-driven IoT systems

• And I want to deploy a LOT of sensors

• So I want the hardware to be cheap, good, small and VERY power efficient

• I want to hack the comm protocols to serve my own application needs

• I want a reasonable balance of communication vs. reliability vs. security

Page 12: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Seeing The Light

• I had a strong dislike of Bluetooth before BLE – Short range, troublesome, finicky, etc.

• But BLE beacons introduced connection-less Bluetooth communication broadly – This changes everything! RX @ beacon can be turned

off, and comm link maintenance not required

• Delivers a powerful combination: – Very low power demands

– Excellent range (up to 200 ft!)

– Inexpensive and programmable/adaptable

Page 13: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Thinking Like A Hacker

• What do BLE beacons have? – Integrated mechanism for distance determination

– Reasonable method for device tracking including status determination and prediction

– Data payload capability

– Excellent technical capabilities

• What do I want? – Ability to transmit custom sensor data while

leveraging the beacon’s software infrastructure

• Strategy: hack the data payload section

Page 14: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

BLE Sensor Beacon: Ideal Architecture

• Power conservation is key

• Use sleep modes extensively on CPU and Bluetooth

• Time the CPU to best detect sensor events

• Do status tracking and error checking on the central collection point

• With good power management on CPU and comms, sensor power draw becomes the big issue

Real World - Continuous - 24x7 - Noisy - Everywhere

Sensors - Sampled - 24x7 - Energy hogs - Spreading

Microprocessor - Cycled/timed - Batched - Power manager - @ sensor

Comms - Minimize transmit - Only as needed - Minimize power - Figure 100’ range

Sensor Module

Page 15: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

Results & Characteristics

• Target final design: ATtiny85 (or similar) CPU + nRF24L01 BLE radio – Use device “sleep” controls to conserve power – Transmit data as infrequently as possible to meet data reporting objectives

• Leverages Eddystone-URL standards to capitalize on hardware, firmware and software improvements – But currently creates a non-standard data payload that common Eddystone

clients will not understand

• Beacon distance and TX power history can be tracked • Unique ID (UUID) supports asset status tracking and error/noise

management • Power supply voltage tracking built-in • Very low power demand – sensor module itself can run from (good)

batteries for 1 year or more, or solar+battery forever – Focus will move to sensor technology to improve energy efficiency there

• Range to nearest monitor point up to 200’ • Supports up to 4 analog or digital sensor devices per sensor module

Page 16: DIY Eddystone BLE Beacons: Architecture & Hackingfiles.meetup.com/19544573/Techno Chaos -- DIY Eddystone Beacon.… · –Centerpiece of the Physical Web •Beacons become the URLs

About The Demo

• For the Houston IoT Meetup session, here are the specifics of what I shared:

• The demo device was the RFduino RFD22102 BLE development board

– You also need the RFD22121 USB Shield; these 2 boards are available in one pack online and at Micro Center

– Note: the USB Shield does a full factory reset on the RFD22102 every time both are initially plugged into a PC; just re-upload your Arduino program to recover.

• The RFduino is programmable via the Arduino IDE v1.6.8 or later. Full instructions for setup are in the RFduino_Quickstart PDF file.

– Google and download the RFduinoBLE.h library from a reputable website and place it in the Arduino libraries folder

• The examples are provided in 2 Arduino programs (packaged in 1 ZIP file):

– RFDuino_EddystoneURL_v2b.ino : base code, showing a shortened URL in the data section of the beacon payload

– RFDuino_EddystoneURL_v3r6.ino : full code for the sensor module, with inputs for pushbutton switch (connected to GPIO 0 and GND) and DHT11 temp/humidity sensor (data on GPIO 5). A status LED can be connected to pins GPIO 6 and GND.