Web Bluetooth Is Your New Squeeze
13 Mar 2017
One of the side-effects to living that Internet-Of-Things lifestyle is that you end up with a lot of pseudo-smart devices, mostly collecting dust. I wanted to see if Web Bluetooth could breathe new life into them.
Turns out, hacking Bluetooth Low Energy toys is way more fun than actually using them. I spoke at NebraskaJS about what I learned, and why I'm excited about hooking Bluetooth up to the Web.
Watch the talk, then check out these links:
- Interact with Bluetooth Devices on the Web
- Bluetooth and Progressive Web Apps
- Hacking Unicorns with Web Bluetooth
BBQ Thermometer - Code
I picked this one up from Meh. No specs available, but you can reverse engineer the temperature if you know some Big Endian notation.
For part of the talk I advanced my slides by dropping the thermometer into glasses of hot & cold water. I called it TDD - Thermometer-Driven-Development. Uncle Bob was right, TDD truly is the pinnacle of professional software development.
Elfy Smart Light - Code
The Elfy is a color-changing night light I picked up from a rando site in China. It looks the part. You can hit it, and it'll alternate between a set of colors.
For one demo, I hooked up an
<input type="color"> to the Elfy.
I also wired it up to change color every time the BBQ Thermometer registered a new temperature.
Jessica Codr and I also built a timer for Toastmasters competitions.
This app is a great example of using Web Bluetooth for progressive enhancement.
For browsers that don't support Web Bluetooth, the app shows the color with a
<div> on the screen.
If there's a Elfy nearby, you also get it on the device.
No specs on the Bluetooth services, so I had to reverse engineer it using Wireshark, as described in the video.
Bicycle Speed/Cadence Sensor - Code
I used a Wahoo Bluetooth/ANT+ sensor. Luckily this used well-known Bluetooth GATT profiles, so hooking it up was a piece of cake; just required a little math.
I took some cues from Max Goodman's Bicycle.js talk. But his Progressive Web App was far too useful, so I just built a Flappy Bird clone. You know how we do.
Sphero BB-8 - Code
The hottest Christmas toy of 2015 meets the technical stylings of 1985. Opera's devrel team originally wrote the code to control the toy. I removed the code that made it spin off my desk, and instead just had it change colors. It's a testament to the remix culture of the web.