A gdg group photo in front of Sir Thomas Moore Building, Strathmore University, Jan. 14, 2017

IoT at DevFest Nairobi

Google Beacon Platform, JavaScript Electronics & The Internet of Things

Ngesa Marvin 10x
IoT/5G Extreme Ideas Lab
9 min readJan 14, 2017

--

Level: Absolute beginners

As you walk, your eyes processes terabytes of information about the world around you, your subconscious is constantly scanning for recognizable objects and location to give you context and help you navigate. But if you close your eyes for a moment, you can only walk a few steps before your brain loses its context and forces you to stop. That’s the world your smartphone lives in every day. It is a powerful computer, but it is completely blind. To solve this, Google has come up with the Google Beacon Platform. During this event I talked about Intel Architecture, The Google Beacon Platform, JavaScript Electronics, Web Bluetooth and The physical Web.

This presentation was given at GDG DevFest Nairobi, Strathmore University on the 14th January 2017. It covers Google Beacon Platform, Intel Architecture, JavaScript Electronics & The Internet of Things.

The Internet of Things

I first gave the developers a brief overview of the internet of things, specific use cases and opportunities across different industries. The developers were introduced to the following IoT architecture:

  1. Device
  2. Gateway
  3. Cloud
Jan. 14, 2017

A device includes hardware and software that directly interacts with the world. Devices connect to a network to communicate with each other, or to centralized applications. Devices might be directly or indirectly connected to the Internet.

A gateway enables devices that are not directly connected to the Internet to reach cloud services. Although the term gateway has a specific function in networking, it is also used to describe a class of device that processes data on behalf of a group or cluster of devices. The data from each device is sent to Cloud Platform, where it is processed and combined with data from other devices, and potentially with other business-transactional data.

After your IoT project is up and running, many devices will be producing lots of data. You need an efficient, scalable, affordable way to handle all that information and make it work for you. When it comes to storing, processing, and analyzing data, especially big data, it’s hard to beat the cloud.

I explained to them the elements they could combine with Intel Architecture to build a robust, maintainable, end-to-end IoT solution on Cloud Platform. I discussed the Google’s unique long-term vision in IoT which include machine learning, cloud, and geo-location.

I also explained the exciting present and the fascinating future of the Internet of Things. It covered how IoT is being implemented today, where the new sources of opportunity will be tomorrow and how different separate sectors of the economy can be transformed.

Durin the presentation, I also focused on how to make IoT relevant for the African people and developers with an African perspective.

Google Beacon Platform

I talked about a wide range of sensors from the Google Grove Seed Studio Indoor environment kit. I also talked about how Google Beacon platform enables developers to manage their beacons remotely, integrate them with Google services and help users’ devices to discover content and functionality across Android, native apps and the web.

Beacons are essentially tiny, low power computers attached to walls or objects in the physical world. Using proximity technologies, they detect human presence and behavior and trigger pre-programmed actions delivering contextual and personalized experiences. They normally operate on simplex mode of communication (one-way transmitters).

Beacons are powered by a coin battery, has an ARM processor, memory, Bluetooth Smart module, and light, temperature and motion sensors. They also have a real time clock.

Broadcasting Power and Beacon’s Range

Broadcasting Power (or Transmit Power) is the power with which the beacon broadcasts its signal. The beacon’s range is technically up to 70 m (+ 4dBM). In real-world conditions, however, you should expect up to 40–50 m.

The long-range Location Beacons’ signal travels for up to 200 m.

Beacon protocols

Just as Wi-Fi and Bluetooth are standards of radio communication, beacon protocols are standards of BLE communication. Each protocol describes the structure of a data packet beacons broadcast. These protocols include Eddystone which was developed by Google.

The Google beacon platform essentially consist of three components. These are the eddystone (the open beacon format from Google that works with Android and iOS.), the Nearby API for Android and iOS, (used for managing beacon scanning for developers apps.) and Proximity Beacon API for integrating with Google products and developers app.

With Google Beacons Platform, developers can enable their apps to react to the users context through the beacons attachment. They can also monitor the status of a a fleet using the Eddystone telemetry frame, and the diagnostics endpoint.

I then gave the developers a wide range of its applications. Beacons can be deployed at fixed places such as airports, museums, and bus stops, and attached to movable objects such as bicycles, kiosks, and taxis.

Normally, each beacon has a Bluetooth Low Energy transmitter. It broadcasts tiny radio signals over the air containing unique, location-specific data. Services on devices such as Google Chrome or Nearby Notifications can scan for and display these signals(URLs) after passing them through a proxy. If they enter their range an associated app responds with the desired action. For example, it can fetch content that is tied to a user’s profile or micro-location. Apps can also push to the cloud user data or statistics. Personalized content is displayed as a notification or directly in the app. Nearby screens can also respond with relevant information.

Electrical Engineering Basics

During my IoT service in the community, when developers are given micro controllers, most of the time they provide less power to board and still add more sensors thus overloading the board, sometimes they short circuited the board or event get confused about how they can interface the hardware. I Introduced the developers to basic electrical engineering concepts that they should be familiar with to safely connect peripherals to devices and begin writing apps that control them.

I explained the basic relationships between voltage, current, resistance, DC Circuit Theory and Ohms Law. I also introduced them to breadboards, Analog inputs and outputs, Digital inputs and outputs, resistor pull-ups and pull-downs, signal debouncing, Pulse width modulation and how to protect the I/O pins.

Breadboards are a common tool for quickly prototyping circuits without needing to solder components together. They allow developers to make wiring changes during development until the design is stable. Breadboards can also be useful in testing, by allowing developers to connect instrumentation easily and probe various connections in the circuit.

Intel Edison, Physical web, Web USB & Web Bluetooth

IoT developers are building apps for transportation (smart parking) and houses (Smart Houses)for every town and city. This may cause the users to install applications that they rarely use. A Kenyan traveling form Eldoret to Nairobi through Nakuru for example, will install a smart parking app in Eldoret, another one in Nakuru and a third one in Nairobi. The user may not use the Nakuru app for a long period until he goes back to the same town. Extending this other IoT applications, users may cluster their devices with several application that they rarely use. This can be annoying. To make IoT devices more intuitive and less intrusive, developers can take advantage of upcoming web technologies such as the Physical Web and Web Bluetooth and Web NFC.

The Physical Web

This is an open approach that enables quick and seamless interactions with physical objects and locations. The Physical Web enables developers to see a list of URLs being broadcast by objects in the environment around you.

Web Bluetooth

This new technology connects the Web with the Internet of Things. It let developers control any Bluetooth Low Energy device (smart home appliances, health accessories like heart rate or glucose monitors, temperature sensors, etc.) directly from their PC or smart phone, without having to install an app first. It supports communication among devices that implement Bluetooth 4.0 or later.

Web NFC

I also talked about Web NFC. Near Field Communication (NFC) enables wireless communication between two devices at close proximity, usually less than a few centimeters. This API enables Near Field Communication (NFC) capabilities for Web Bluetooth.

With these combination, developers can make their web content discoverable on the Physical Web.

Microelectronics

I then talked about the diverse different micro controllers such as Intel Edison, Arduino Uno, Arduino 101, Raspberry pi and the Beaglebone Green.

I introduced the developers to the new Google IoT Developer Prototyping kit, the new Seeed Studio BeagleBone Green Wireless board which is tailored specifically for Google Cloud Platform.

I also introduced them to the Intel Edison and shown the different features of the board. They were also shown the different breakouts boards that works with Intel Edison which includes Arduino Expansion Board, Intel Edison breakout board, and Spankfun boards.

I then discussed the general consideration when choosing hardware. These considerations are affected by how the hardware is deployed.

Developers can utilize the Intel XDK powerful features to build Node Js (J5) applications. They can to build Physical Web Applications.

They can create an Angular 2, or a Polymer app on the client side. This app can have a web Bluetooth on the client side. Bluetooth Low Energy can then enable communication between the web client and Node.js (Johnny five) on the server side (Intel Edison). To implement BLE (Bluetooth Low Energy) peripherals, developers can use Node Js modules such as bleno.

Using the Physical Web and Web Bluetooth, Chrome finds the device and allows the user to easily connect to it without installing seldom-used applications that they may not want, and which may update from time to time.

Real time Internet of Things Development with Intel Edison, Firebase and Node Js

I also talked about how developers can use a combination of Intel Edison, Firebase and Johnny five for IoT prototyping.

To get started with Johnny five framework, we need to install the Firmata protocol on the Arduino Uno so that it can accept JavaScript commands. This protocol will allow us to use JavaScript (or other languages) to control the board via a REPL. Firmata is an API running on the Arduino which the JavaScript (or any other language) running on your laptop can call to manipulate the Arduino. To get started do the following:

  • downloading and installing the Arduino IDE.
  • Connect your Arduino to your computer with the USB Cable, and fire up the Arduino IDE
  • Ensure that the the correct serial port is selected in the Arduino IDE (via Tools-Serial Port).
  • Open the Standard Firmata sketch (via File->Examples->Firmata->Standard Firmata) in the IDE.
  • Upload the Standard Firmata sketch to your Arduino Uno.

Once this is done, install Node Js; set up the micro controller and then run Run: npm install johnny-five

Johnny five framework supports a variety of Arduino-compatible Boards and for non-Arduino based projects, platform-specific IO Plugins are available.

Board initialization

Demos

Jan. 14, 2017

Input (Streams) — Photoresistor

Prerequisites

  • At least an Arduino or compatible board (Uno, Mega, Leonardo, Fio, Pro, Pro Mini)
  • 1 220 Ohm resistors
  • Hook up wires
  • Breadboard
  • Photoresistor

Circuit

Schematic

The schematic looks intimidating? Interested to learning more about it? here

Code

Output — Mini Dance Hall

Prerequisites

  • At least an Arduino or compatible board (Uno, Mega, Leonardo, Fio, Pro, Pro Mini)
  • 3 Leds
  • 3 220 Ohm resistors
  • Hook up wires
  • Breadboard

Circuit

Schematic

The schematic looks intimidating? Interested to learning more about it? here

Code

What Next?

  • Improve the algorithm
  • Add more sensors
  • Design more complex circuit

Final Thoughts

While meeting common IoT needs can be challenging at times, development platforms such as Google Cloud Platform/Firebase provide services that allow developers to meet many of these requirements.

If you found this helpful, click the 💚 . Follow this publication for more tutorials on The Internet of Things.

NB-If you have any IoT concepts you’d like explained in a post, any question, comment, or suggestions, please let me know. I’ll get back to as many as I can.

--

--

Ngesa Marvin 10x
IoT/5G Extreme Ideas Lab

Electronic Engineer. Engineering Manager. AI Innovator, Intel. Grew @LiquidInTech, Deep Learning Abantu. Wabi -Sabi. #AI #Cloud #5G Freak. Opinions are my own