MaKin211 edited this page Jan 27, 2017 · 54 revisions

Table of contents

Project goal
Service design
Organization
MVP
Architecture
Implementation
IoT Methods

Project goal

A service utilizing beacon technology providing additional value for students and lecturers at Herman Hollerith Centre shall be designed and a MVP implemented.

Service Design

A sensor network as part of an IoT architecture should be implemented and beacons be deployed in order to provide access to the sensor data. The rooms at Herman Hollerith Centre shall be equipped with sensors measuring values like temperature, humidity and CO2 in order to assure an optimal climatic environment for students and lecturers. The sensor data of distinct areas can be viewed via a web interface. The access to the web interface will be provided by BLE beacons that have Eddystone URL enabled.

Easy maintainability, stability as well as scalability are of highest importance. The system can be extended by further components as well as automation rules triggering the actors upon sensor events or sending notifications.

The value proposition is visualized in the following canvas:

Value Proposition Canvas

Organization

The team consisted of the following team members:

  • Martin Kinitzki
  • Lara Rall
  • Stefan Trieflinger
  • Tim Wilke

Martin Kinitzki acted as a lead architect for the development of the sensor network due to his experience with MySensors platform. The other team members focused on the beacon technology. However, most tasks were carried out by the whole team and only minor subtasks were executed by individual team members. For example, during setup of the sensor network many small tasks emerged (e.g. installing OS on Raspberry Pi, soldering of the pins to Arduino Nano, setup of router etc.). We simply managed these tasks by acclamation.

All tasks were carried out in one office with all team members present working face-to-face. This enabled us to discuss problems and find solutions without any delays.

MVP

The MVP consists of a partly implementation of the Service Design. A Controller, a Gateway as well as a Sensor node measuring temperature and humidity in room 125 are installed at Herman Hollerith Centre. The sensor data can be viewed via a web interface accessed through Eddystone URL of an Estimote beacon.

By using an app on a mobile device, every student and lecturer has the opportunity to get information about the temperature and humidity in room 125 of Herman Hollerith Centre. This is realized by adding an Estimote beacon to the entrance door. The students activate Bluetooth on their devices, open the app and are then able to see and open the link. By clicking on the link which refers to the web interface of the sensor data the user immediately receives information about the current temperature and humidity in room 125.

Instead of equipping all rooms of Herman Hollerith Centre we apply it in room 125 for MVP.

Architecture

Explanation

Our sensor network is built upon the proprietary MySensors open source platform following an Internet-of-Your-Things (IoYT) paradigm where sensor data is kept private in the first instance. The network topology consists of four elements: Sensor node, Gateway, Repeater node and Controller. Sensor nodes consist of a temperature and a humidity sensor serving as sensors for smart objects. They send their information to a Gateway which then forwards it to a Controller via common protocols and interfaces like Ethernet, Serial or MQTT (in our case we use the serial port). Being a proprietary protocol using the 2.4 Ghz radio frequency band, MySensors requires a Gateway. The communication is bidirectional - in case actors are controlled. Additionally Repeater nodes can be used to extend the sensor network. The continuous data exchange is rendered possible by using radio modules.

Each node has a unique sensorId that is used to address it. This sensorId can either be assigned in the sketch or later by the Controller. When booting up a sensor, it will send out a 'Find-Me'-Message in order to be discovered by the Gateway (always sensorId 0). It connects to the nearest Gateway or Repeater node and repeats this procedure if the connection is lost - making it self-healable.

Further every sensor has child-sensor nodes that are determined in the sensor sketch. For example there is a sensor (sensor.hhz_1_X) with sensorId 1 measuring temperature and humidity. These measurements are carried out by its child-sensor nodes, e.g. 0 for temperature (sensor.hhz_1_0) and 1 for humidity (sensor.hhz_1_1).

Access to the Controller's web interface is provided via the beacon's Eddystone URL. Communication between users' devices and the controller is realized via WiFi. The beacons on the other hand communicate using Bluetooth Low Energy (BLE) technology.

A list of hardware and software used in this projects is shown in the following.

Used hardware

  • Controller: Raspberry Pi 3 running Home-Assistant (0.35.3) on Raspbian Jessie Lite (Kernel 4.4)
  • Gateway and Sensors: Arduino Nano (xcsource clone)
  • Radio module: NRF24L01+
  • Air/Humidity sensor: DHT-22
  • Beacons: Estimote beacon

Implementation

Development process

Setup of the controller (Raspberry Pi 3)

  • Install Raspbian Jessie Lite (Kernel 4.4) on Raspberry Pi 3.
  • Enable SSH access by creating an empty file titled ssh in root directory (/boot) of Raspberry Pi 3.
  • Connect Raspberry Pi 3 via LAN (and configure WLAN via SSH).

ssh pi@raspberrypi (use IP alternatively)

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

  • Enter SSID and PSK as follows:
network={
    ssid="MySSID"
    psk="MyWifiPassword"
}
  • Reboot Raspberry Pi 3.

sudo reboot

Note: Ideally the ethernet interface (eth0) should be used at HHZ as there are less obstacles to be overcome.

Issue: There is no static IP address for the Raspberry Pi as a DHCP server with IP leasing is used.

  • Expand file system and set timezone to 'Berlin' and keyboard layout to Generic 105-German in internationalization settings.

sudo raspi-config

  • Install Home-Assistant on Raspberry Pi 3.
wget -Nnv https://raw.githubusercontent.com/home-assistant/fabric-home-assistant/master/hass_rpi_installer.sh && chown pi:pi hass_rpi_installer.sh && bash hass_rpi_installer.sh

Setup of sensor network

Issue: When using an Arduino clone with CH340 USB chip on a Mac there is currently no official USB FTDI driver so that the Arduino IDE will not find the USB port for these clones. Installing a wrong unsigned driver will result in kernel panic when connecting the Arduino. A fixed driver can be found here.

Note: For the DHT22 sensor to properly work the modified DHT-Library has to be imported as referenced in the MySensors doc.

In the following picture the implementation of the sensor network is shown.

Hardware

Configuration of Home-Assistant

  • The single point for configuration is the configuration.yaml inside home/homeassistant/.homeassistant. It is possible to outsource parts of the configuration for better maintainability.

  • Add the MySensors component according to MySensors component doc.

  • As soon as Home-Assistant is restarted the reachable sensors will be added as entities and can be further used. Newly added sensors will be added automatically as they are seen by the Gateway.

  • All sensors are persisted inside a .pickle file which guarantees that disconnected sensors will be recognized as soon as they are available again instead of being identified as new ones.

Issue: With the wrong baudrate configured, an error like mysensors.mysensors: Error decoding message from gateway, probably received bad byte. might occur. It has to be ensured that the baudrate set up in the Arduino sketch matches the baudrate configured in the MySensors section of Home-Assistant.

After configuration the user interface is available as shown below. Later, the link to this user interface will be provided using the beacon technology.

General commands

  • Change to homeassistant user:

sudo su -s /bin/bash homeassistant

  • Change to virtual enviroment:

source /srv/homeassistant/homeassistant_venv/bin/activate

  • Update HA (after activation of virtual environment):

pip3 install --upgrade homeassistant

  • Type exit to logout the homeassistant user and return to the pi user. The home-assistant service can be restarted via sudo service home-assistant restart as pi user or via the Services menu of Home-Assistant.

Configuration of service discovery

In our first approach we used Onyx beacons for service discovery but later we found out that implementing Estimote beacons is much easier. Although both beacons support the Eddystone protocol, Android users were only able to find Onyx beacons using the official Onyx beacon app and Google Chrome. However, for Android users it is not possible to configure the beacons or update the firmware.

Configuration of Onyx beacons

  • Register on the website connect.onyxbeacon.com.
  • Add a new 'iBeacon' with major and minor numbers which can be found on the beacon.
  • Download the Onyx beacon app on mobile device and activate bluetooth.
  • Update the firmware on the Onyx beacon in order to support Eddystone protocol using the Onyx beacon app (at least version 4.0.5).
  • Issue: Android version exists, but only offers limited functionalities. Currently, it is not possible to configure Onyx beacons or update the firmware.
  • Change protocol from 'iBeacon' to 'Eddystone URL'. Make sure that protocol actually changed to 'Eddystone' and not reverted back to 'iBeacon'.
  • Issue: Several retries were needed in order to change the protocol. App seems to be buggy.
  • Insert the URL which refers to the mysensors platform in the field 'URL'.
  • Issue: URL must start with 'https:' and must not contain more than 17 characters. Therfore we used the link shortener bit.ly.

Configuration of Estimote beacons

  • Register on estimote.com to buy Estimote beacons (the ownership rights are automatically assigned to the purchaser).
  • Download the Estimote app on mobile device and activate bluetooth.
  • Configure the beacons by adding the URL.

Conclusion

  • If you consider buying beacons, we recommend to buy the Estimote beacons because the usability and configuration is much easier. Furthermore, Estimote beacons are working with Android and iOS devices.
  • Issue: Batteries of Estimote beacons can not be changed (they will only last 1-2 years).

Service discovery using beacons

  • Due to the missing functionality of Onyx beacon app on Android devices and to be independent from Onyx beacons we were looking for an alternative app. Several apps were considered:

Onyx beacon

  • Beacons can be found on both operating systems.
  • Issue: The link provided by the beacon is not clickable. App is intended as a configuration tool for the beacons and not for service discovery.

Estimote

  • Beacons can be found on both operating systems.
  • Issue: The link provided by the beacon is not clickable. App is intended as a configuration tool for the beacons and not for service discovery.

Physical Web

  • Works great on iOS devices.
  • Issue: Beacons could not be found on Android devices.

Google Chrome

  • For Android devices, physical web needs to be activated in privacy settings. Furthermore, a web-bluetooth needs to be activated at chrome://flags/#enable-web-bluetooth. Beacons can then be found at chrome://physical-web on Android devices.
  • Issue: Beacons could not be found on iOS devices.

BeaconScanner

  • Works great on Android devices.
  • Issue: No app available for iOS devices.

PHY.net

  • Doesn't work on both operating systems.
  • Issue: Beacons could neither be found on Android nor iOS devices.

Conclusion

  • We recommend to use Physical Web on iOS devices and BeaconScanner on Android devices based on our experiences with the apps.

Custom-built apps using SDKs (not implemented)

Why 'no need for an app' is not correct

If there really was no need for an app users might feel violated in their privacy with beacons spamming notifications on their devices. For that reason every app notification has to be explicitly allowed by the user. In order to achieve push notifications for certain beacons there has to be an app with proper permissions.

Instead of using existing apps, it is possible to build custom apps if special requirements need to be fulfilled. This allows for a higher independency and flexibility which is needed in order to implement complex use-cases (especially in the business context). A major benefit of a custom built app would be the notification feature which can be triggered upon entering the proximity of the beacons. However, due to the limited time of this hackathon, the development of such an app was out of scope. For our MVP we think that the use of existing apps suffices.

IoT Methods

Living Lab

As our projects should be part of a living lab we followed the living lab process.

  • Co-Creation: Given the idea of beacons for location based services we discussed possible value propositions for lecturers and students at HHZ in order to improve the working and learning environment. Starting with an empty Value Proposition Canvas we collected pains and brainstormed how to possibly relieve them.
  • Exploration: At this point we discussed and set up our MVP.
  • Experimentation: The MVP was implemented in room 125 at HHZ as a living lab.
  • Evaluation: After the experimentation phase (e.g. one month) evaluation is possible as part of a workshop with students and lectures - and coffee.

IoT Design Principles

Designing an IoT architecture we followed the design principles stated in the IoT lecture:

  • Invisibility: The sensor network is not visible and no user interaction is needed.
  • Manual override: A manual override is neither applicable nor necessary in this case.
  • Feedback: Sensor data can be monitored using the web UI accessed via beacons.

Outlook

Due to the limited scope of our hackathon there are a few open items remaining:

  • Develop a custom-built app for HHZ to enable more complex use cases (e.g. sending of push notifications).
  • Implement automation rules, e.g. 'set thermostat to 22 °C if room is occupied'.
  • Equip other rooms with sensors.
  • Fit in other sensors to measure CO2, air pressure, motion, dust, gas or other environmental conditions.
  • Integrate heater, AC, alarms, lights etc. into the sensor network.
  • Find a way to access beacons via webbrowser on notebooks, MacBooks, PCs etc. (non smart devices).

Presentation

Our final presentation can be found in the repository.

Remarks

The current password for pi is hackathon2016.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.