Integrating Presence Sensors in Mobile Application

Wassa Team
Wassa
Published in
6 min readSep 18, 2018

Context and challenge

At Wassa, we build many applications with Location Based Services (LBS) in various domains such as malls, office buildings, airports, museums… Generally, our customers need localization at first glance. But after using the applications for a few months, their needs evolve towards something more advanced. With notifications, bluetooth, network connectivity, embedded sensors, web services and everything a smartphone could offer. Localization become a first step to more advanced features such as: “Where is my colleague?” “How many of my customers are passing by this store?” “Where is the boarding gate for my plane?” “Could I book the meeting room near my office?”.

One of our customers has tens of thousands of employees, working in many different office buildings. They have hundreds of meeting rooms that can be booked with a complex system. There are also “boxes”, smaller non bookable meeting rooms. The mobile application we provide can already find any box inside the building and let the employee walk to it. Unfortunately, most of the time when the employee arrives at the box, it is already occupied by other colleagues. Sometimes he can lose 10 to 15 minutes looking for a free room.

So, the last challenge we were facing was: where is the nearest unoccupied box?

There were several ways we could answer this question. The easiest one was to rely on our own app: thanks to LBS, it would have bean easy to detect when someone enters a room and then call some kind of API to update the room status. However, it requires the employees to have the app installed on their phones, which is not always the case. That’s why we chose to use IoT (Internet of Things) sensors: we installed a sensor in each box, with each sensor periodically sending various data, including motion detection, to a centralized server. Next, we updated our app to provide a “Free boxes” feature.

This technical article will present the full solution to this challenge!

LoRa Network

What is LoRa?

The sensor we chose to solve the problem, uses the LoRa network which is developed specifically for connected object and for supporting IoT.

From Wikipedia : LoRa (Long Range) is a patented digital wireless data communication IoT technology developed by Cycleo of Grenoble, France, and acquired by Semtech in 2012, […] LoRa enables very-long-range transmissions (more than 10 km in rural areas) with low power consumption. The technology is presented in two parts — LoRa, the physical layer and LoRaWAN (Long Range Wide Area Network), the upper layers. LoRa and LoRaWAN permit inexpensive, long-range connectivity for IoT devices […]

In terms of infrastructures, end devices communicate to dedicated antennas which communicate over IP network.

So What?

Firstly, it is a wireless and long-range network; so, it can cover wide surfaces easily. In fact, France has 95% of coverage today (source from Objenious and Orange Business Services). Secondly, it is low power consumption; so, it is adapted to small embedded battery. Finally, you can connect LoRa with any object that requires low consumption, which has no infrastructures, even without network nor power cables.

Like our new autonomous presence sensor, there are many other connected objects that are power autonomous, can run for years, wireless, simple to install sometimes self-sealing and connected to LoRa.

Provided infrastructure

Of course, we work with a partner who is an expert of IoT, LoRa network, and sensors. He provides a full integrated solution. Please take a look at the global architecture:

Coverage

In France, the coverage is nearly 100%

Sensors

Sensor installation

Installing the sensor is supposed to be simple: self-sealing as we said. But we had come across several problems.

The detection angle is not wide enough even though the box is small. People are usually sitting down and staying still. Box has glass wall (we do not want to detect walkers outside). So, we had to search for the best place to install them, invent and adapt best practices from reseller.

Sensor tuning

Theoretically these sensors are simple, there have 2 statuses: Free / Occupied. Once again, simple but not that simple. How does the sensor decide when to change the status? If one presence is detected once, it can lead to false positives. 3 detections in less than one minutes? How does the sensor decide that the box is empty: no detection from 5 minutes? 10? What about people who stay still? We were trained with the ‘simple’ configuration of those ‘simple’ sensors. Let’s says they embed some advanced logic:

Who said simple??

Sensor configuration

Once the tuning logic was decided, we had to update embedded configuration. That is possible, but only once a day when the sensor reports its ‘I am alive’ message to the system. But that configuration is heavy and the once per day flow is short, you need a few days to update each sensor, passing a small part of the configuration for each sensor everyday.

Integration

Sensor back office

Our partner provides a very rich back office system, that can handle thousands of connected objects, dispatched in various structures, such as components, sites, divisions, companies… We had to configure each sensor, associate each sensor to a box ID.

The back office provides a rich API, web services with REST and Json. Rich, yes! In our case, we use one only. Rich and simple!

Integrating in application

Finally, this was the easiest part for us, our specialty.

Connect to the sensor back office with dedicated api-key.

Call the API, get the sensors id.

Match the id to associated box.

Calculating the distance between the box and my position: it was already a part of the application.

Listing of the boxes ordered by proximity was already implemented too.

We just add a new filter about that the property is ‘Free’ to use.

Android source code snippet

iOS source code snippet

DONE!

What’s next?

First step is to generalize the process for the customer, set up xox throughout the whole building, then to all other buildings. Think also about the potential benefits of other connected objects, combined with localization. For example: navigating to free parking spaces in malls, controlling external devices such as lights, air conditioners, curtains, just wherever I am… My favorite would be having the coffee machine to run automatically when I go near it ;)

Resources and references

LoRa Alliance: a nonprofit association, collaborates and shares experiences to promote and drive the success of the LoRaWAN protocol

Future of LoRa: Nano satellites

Other IoT network : SigFox

Do you want to know more about WASSA?

Wassa is an Innovative Digital Agency expert in Indoor Location and Computer Vision. Whether you are looking to help your customers to find their way in a building, enhance the user experience of your products, collect data about your customers or analyze the human traffic and behavior in a location, our Innovation Lab brings scientific expertise to design the most adapted solution to your goals.

Find us on:

· Facebook and Twitter

· LinkedIn

· GitHub

· Our WebSite

--

--

Wassa Team
Wassa
Editor for

Wassa is a company specialized in the design of innovative digital solutions with great added value.