Keyless / RFID Smart-City-Usecase Part 2

Written by Marvin Siegert

Keyless / RFID Smart-City-Usecase Part 2

Monday, 01 Aug 2016 00:00

In the first part of the blog series „Keyless / RFID Smart-City-Usecase“, the use cases and the exact requirements were described. In this post we want to concentrate on the technical details and look precisely into the technologies used.

RFID

Main component of the Showcase is the automatic identification method (Radio Frequency IDentification). It concerns a contact less communication technique, that transmits information for the identification of people, animals and goods.

In our case, we want to identify a person before the automatic opening of the door. For this purpose a small RFID reader has been attached to the Lego house, which consists of a control board and a copper coil. For identification, each house occupant has an RFID transponder (also called tag). Data is stored on each transponder- a unique access key can also be stored here.

When the reader is operated, it generates via the copper coil (antenna), an electromagnetic field. If a transponder comes in the area of the magnetic field, its micro chip is energized and it can contactlessly transmit data to the reader. As soon as the transponder leaves the magnetic field, the connection is disconnected and the transponder is inactive again.

When choosing the right transponder, there are some features to be taken into account. In addition to those used in our inactive readonly transponders (read-only), there are also transponders that are rewritable (write / read) more than once, and some that are writable only once (write once, read many). These 3 types of tags exist also as active transponders with their own energy source.

Range, stability and transmission speed are mainly dependent on the selected frequency. Thus, the ultra high frequency (UHF) of 689 megahertz, which is used in the European automotive industry, has a significantly greater range than that of 125 kHz frequency – used in our Showcase. In addition, it is significantly more stable when, for example, metal comes in the vicinity of the magnetic field. The chart above shows a few examples of application areas of different frequencies.

MQTT

As a second option for opening our door, we have created a Webapp. The framework Ionic was used here, with which the app can be compiled additionally as a “native” app for all major operating systems and can be made available in the app stores.
Since we work with a frequency of 125 kHz in our showcase, the NFC Sensor of a smartphone could not be used for the communication with the Raspberry Pi. (NFC has a frequency of 13.56 MHz). Therefore, the communication from the smartphone to the Raspberry was implemented using MQTT.

A WebApp that runs in the browser, has by default no realtime capability. Browsers can accomplish this only using the WebSocket protocol. Websockets build a communications canal over a separate TCP connection, in which the client and server can communicate at the same time (full duplex). In addition, using TLS, the WebSocket connection can be secured.
In this communication channel messages can now be transmitted via MQTT protocol. Here, it must be ensured that the MQTT Broker is configured so that it can communicate also via WebSockets.

WebSocket support is not yet a standard with all MQTT brokers. In our showcase, we use a Mosquitto Broker Version 1.4 – The first version that supports WebSockets.
To open the door, we have created the topic “lego house / open door / {code}”. The Raspberry logs on to the broker on the topic (subscribe) and the app sends the messages with the entered Pin Code (publish).

The Raspberry then decides whether the pin belongs to a resident of the house and opens the door for him.
In the next and final part of this blog post series, we describe the logic on the Raspberry Pi and take a closer look at the corresponding Python code.