Skip to content

Instantly share code, notes, and snippets.

@janjongboom
Created March 27, 2016 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janjongboom/a232098fae5e72175463 to your computer and use it in GitHub Desktop.
Save janjongboom/a232098fae5e72175463 to your computer and use it in GitHub Desktop.
Building IoT devices for fun & profit - Codefest 2016

Codefest

  • Jan Jongboom, Developer Evangelist IoT for ARM. Used to be a web dev for the longest time, worked as Core OS engineer on Firefox OS, Google Developer Expert for Web. Switched to embedded'ish. Still like to explore things that are on the boundary of physical devices and web.
  • As developers we're very focused on whatever is happening on the device. Optimizing performance, getting data out of sensors, all very nice.
  • Very limited world view. The world is so much bigger than what your phone can see. We want to interact with the physical world.
  • Internet of Things: building smart devices that can help us get more meaningful information out of the real world. Not talking about the smart fridge here. Some really good ideas. Here's some that I worked on in an office building:
  • If toilet doors are smart, they can count the number of times the toilet is used, can send cleaning staff more efficiently around the building. Not cleaning toilets that are never used.
  • If a meeting room is smart, it can let you know if you're standing in front of it whether you can walk in because it's not booked; and automatically block it in your name. Or unblock it when someone did not show up.
  • Of course also bunch of things that sound silly. There's a whole twitter account for it.
  • Now three problems:
    1. how to build smart devices? constraints are completely different. years on a battery is one of the things we'd like to achieve.
    2. how do people know that the device is around? having to find the device first is kind of a bummer. how do I know a meeting room is smart?
    3. how to interact with the device? how do I know which app is being used to control this thing? there's no standardization, everyone uses a different protocol.

Discovery

  • Let's start with 2. discovery. It's hard to discover devices right now. Google project: Physical Web.
  • 'Walk up and use anything'
  • Like a QR code that works up to 50 meters away, advertising a URL to everyone in its vicinity.
  • Bluetooth Low Energy beacons. Can send a packet (31 bytes) about once per second, achieving battery life of 7 years on AA battery. Can use it to encode IDs.
  • Google figured, let's encode a URL in it! Eddystone URL protocol.
  • Parking meter can send out URL to booking app. Movie poster can send out URL to showtimes in local theater. Meeting room can send out URL to its calendar.
  • URLs will pop up in your homescreen! Hit it to go to the web page advertised.
  • Part of Google Chrome for Android and iOS + Opera. Mozilla been thinking about it.
  • Small and cheap. (show beacon), 4$ from Alibaba. Chip itself is about 2$. Combines Bluetooth and the MCU.

Interact

  • So we got a URL but that's only good for a number of things. We want to interact with the device.
  • Already Bluetooth chip in it, because we send out URL.
  • Bluetooth Low Energy can do more than just advertising. Also use it to interact with devices. F.e. heart rate monitor.
  • GATT services. A service has characteristics. Device can have multiple services. F.e. heart rate service, has current heart rate, and max. detectable heart rate chars.
  • Every BLE device works like this. Parrot drones: also have services & characteristics.
  • If you want to take a look at device characteristics: Nordic Semi nrf Master Control Panel. Excellent app.
  • Google is now adding bluetooth support to Chrome. Can talk to devices straight from the browser!
  • Need UI currently to select the device (choose which service you're looking for), but after that reading / writing to device is very straight forward.
  • F.e. we can now fly drones from a web page.
  • Combine Physical Web & Web Bluetooth -> solve discoverability & interactivity problem with just one chip.

Programming devices

  • Alright. So if we want to build devices, how do we do that?
  • Embedded landscape is very spread out. Every has their own tools, SDKs, docs, etc.
  • In 2009 ARM wanted to unify the dev ecosystem around Cortex M-series microcontrollers.
  • ARM is kind of a weird company. We're semiconductor company, but don't make anything. We don't have factories. We make processor architectures and sell it to other semiconductor companies. They then make the actual MCUs. Anyway, we want to make better dev environment.
  • mbed, started in 2009, 91 boards supported, 170000 devs on the platform. Online IDE to make development easy.
  • Nice hardware abstraction layer to deal with multiple vendors in a single way. Rock solid bluetooth stack.
  • HDK, to go from prototyping to real device. Also have a reference design for wearables.
  • nrf51822, most used BLE chip. Programmable with mbed. So that's what we're gonna do today. Two versions with me, DK and the micro:bit.
  • It's C/C++, but pretty straight forward. Libraries for BLE, Eddystone, etc.
  • Automatic battery management to get good battery life out of device.
  • Tell about path to actual hardware?

OK, enough talk, let's build some demo's

  • Lighting system
  • Juggling visualizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment