Application of Bluetooth Low Energy in Classic Cars
Application of Bluetooth Low Energy in Classic Cars Rogier van der rogier@zoidbergsolutions. nl Hee
Rogier van der Hee 2007 - : Zoidberg Solutions (independent developer - ZZP) Plant. Scout app (i. OS / Android) for variety assessment for orchid growers: www. plantscout. eu Invoice Management for Blue 10: www. inkoopfacturen. nl ATC simulation tests for candidate selection purposes for EUROCONTROL: www. eurocontrol. int/services/feast Ignition systems for classic cars: www. 123 ignition. nl 2
The project: classic car ignition systems • How does an engine work: • Suck -> Squeeze -> Bang -> Blow! • Modern cars ignition is done purely electronically, classic car it is mechanical on the crankshaft 3
What does an ignition system do? • Timing of the spark for optimal combustion, right at the moment the cylinder is at the top dead center. • Based on piston position (advance) and power demand (vacuum) 4
Why electronic ignition in your classic car? Why electronic? • No more maintenance • Better starting • Better torque in lower RPM Why programmable? • Almost endless combinations possible: different curve per engine, distributor and fuel (petrol, ethanol, LPG) • Fabrication is unified: 1 embedded software program • Best possible setup for your specific engine: tuners and export hobbyists (racing) • Because we can 5
Today Ignition advance RPM Rx Temperature Manifold pressure Battery Serial over USB Tx Atmel ATMega 16 • 8 Mhz • -40 – 120 Celsius • 16 kb Flash Windows XP / 7 / 8 • . Net 2. 0 app 6
The challenge Ignition advance RPM Rx Temperature Manifold pressure Battery Tx Atmel ATMega • 8 Mhz • -40 – 120 Celsius • 16 kb Flash ? IPhone 5 S • Dual core 1. 3 GHz ARM v 8 • 16/32/64 Gb • 1 GB RAM DDR 3 7
Wireless hardware options • Classic Bluetooth 1. 1/2. 0/3. 0 (2002 -2009) • Slow, long latency, requires MFI program for Apple • Smart Ready: Dual mode device with 4. 0 and classic, Smart is 4. 0 only • Zig. Bee, mostly home automation • No frequency hopping, not present in devices. No hardware support in phones. • Wi-Fi • Point to point difficult (Direct), software hard, optimized for large data transfer • ANT (+), mostly health and fitness • Proprietary, + since 2011 requires certification. Native Android, no i. OS • NFC • Range limited to 5 cm, targeted for payments. Android, no i. OS 8
Why Bluetooth 4 Low Energy? • Hype “Internet of Things”: enables low cost, low power sensor communication between endless combination of devices, wearables, you name it! • Proximity and out of range detection (geofencing) • Fast connections (10 msec) and low data latency (3 -6 msec): very responsive apps • Adaptive Frequency Hopping (AFH), resilient to interference • Broadcast support (i. Beacons) • Connectionless always off technology • Low power consumption: ~30μA average consumption with 1 second data interval, equivalent to 330 days on a single coin cell • Range up to 280 meters (in practice about 10 -30 meters) • No more MFI program for Apple 9
Real life range sample • Direct line of sight 30 m • Faraday was right! • Plastic casing in prototype Ignition behind fan under hood Bluetooth Status LED Static timing LED Still connected! 10
Hardware implementation • System-on-Chip: Bluetooth needs external controller with embedded software to run • Option 1: buy separate chip: • TI CC 2540/CC 2541, Nordic n. RF 8001 • Complete control • High startup costs (FCC, dev kits etc) • Option 2: buy integrated solution: • • • Blue. Giga, Blue. Radios, CSR, Nordic No FCC approval Avoid high dev kit license Ready to go Drawback: “vendor” libraries CC 2540 under RF Shield Antenna Crystal / Transistor EEPROM 11
User Application GAP Role Profiles (Master / Slave) GATT Profiles Application Bluetooth Low Energy Architecture ATT SMP L 2 CAP Host Controller Interface (HCI) Link Layer (LL) Physical Layer (PHY) Controller GAP Host GATT 12
Generic Acces Profile (GAP) • Ensures basic connection handling: discovery of what type of Bluetooth profile a device supports • Common for Bluetooth 1/2/3/4, basis for all profiles • Handles advertising and roles • Handles security (SMP): • Bonds or pairing between devices • Access and address security 13
Generic Access Profile (GAP) : Roles Broadcaster (Advertiser) • Transmit advertisement only (i. Beacons) Observer (Scanner) • Only receives advertisements Peripheral (Slave) • 1 connection to a master Central (Master) • Supports multiple connections • Initiates connections to devices in peripheral role Periph eral Central Broadcaster Observer 14
GATT Profile • Bluetooth SIG defines standard Profiles for interoperability: HID, Health, Hear Rate, Proximity, Cycling Power, Find Me, etc Profile Service Characteristic C# sort of comparison: Profile = Model Service = Class Characteristic = Property Descriptor = Property Attribute 15
GATT Characteristic Value Descriptor • Value types: • • • Broadcast Read Write without response Notify Indicate (needs reply) • Descriptors describe: • • Presentation format Valid Range User description … • See Bluetooth. org for complete specification 16
Advertisement Packet layout Protocol Data Unit (PDU) Preamble Acces Address Adv Header Overhead Payload Length Advertiser Address Payload (31 bytes) CRC Overh ead 17
Support per platform • Available Since 6. 0 (IPhone 4 S / IPad 3 and newer • Most mature API and software • Pairing almost workable • Since 7. 1 notification triggers for closed apps • Very buggy in 4. 3 • Better in 4. 4 but still “adventurous” • Open source i. Beacon library • Background Service way to start app • Windows 8. 1 too barebones: Store only, missing API’s • Phone 8. 1 big improvement, also includes background Triggers • Preview not working on Nokia (which did initiate Bluetooth Low Energy research in 2001! sigh) 18
Show me the money … code! • Example for reading the Battery Level characteristic • • i. OS Android Windows 8. 1 (or how far I got. . ) Windows Phone 8. 1 (theory only. . ) 19
Security • Security modes • “Just Works”, no pairing needed to connect (doesn’t work with Windows 8) • Simple Pairing (Authorization only, no PIN) • Secure Authenticated Pairing with MITM protection (PIN) • Triggered by setting certain permissions on characteristics • Personal experience so far: authenticated pairing is difficult to implement to cover all use cases for devices without a display. Also there are bugs in both i. OS and Android which makes the experience cumbersome 20
i. Beacons • Hype in the advertisement market, new way to personalize shop experiences • Broadcast devices, not connectable • Special layout of Advertisement Packet • • Company identifier code set to 0 x 004 C -> Apple i. Beacon proximity uuid in manufacturer data Major / minor Id (for grouping beacons: home->living, attic, basement) Measured Power (RSSI in d. B at 1 m, translated to immediate, near, far) 21
Conclusions / Lessons learned • BLE is fast and fluid from end user point of view • Hardware integration is always a big pain • Writing polished apps takes an incredible amount of time ; -) 22
- Slides: 22