Designing smart home and wearables IoT applications, part one
July 03, 2018
In part one of this series, we will cover IoT market trends and the relevance of smart home and wearable applications, followed by an example implementation of a smart home door lock controller.
Based on numerous studies, smart home and wearables are the most popular IoT applications today. Embedded MCUs are at the core of these IoT applications. However, to serve as an effective foundation in this fast and competitive market, embedded MCUs need to be able to support an increasing rate of innovation. To speed development and lower manufacturing costs, IoT designers are looking to single-chip MCUs that integrate security, I/O, and wireless connectivity with ultra-low power system design and a flexible architecture to keep designs up to date with changing standards.
In part one of this series, we will cover IoT market trends and the relevance of smart home and wearable applications, followed by an example implementation of a smart home door lock controller. In part two, wearables applications will be discussed along with an example implementation. Part three will illustrate how a wearable implementation can be leveraged to interact with a smart home network.
IoT technology continues to make work and life more affordable, accessible, comfortable, and intelligent. As shown by a study from IoT analytics, smart home and wearables are the most popular IoT applications that people look for (see Figure 1).
[Figure 1 | IoT commercial market trends]
The concept of a smart home involves the interaction of devices throughout the home with limited user involvement. For example, at 6:00 am your alarm wakes you to the sound of music from your favorite playlist. At the same time, the bedroom lights slowly light up, allowing you to wake up in your own time. While the downstairs intruder alarm system is deactivated, the coffee machine in the kitchen turns on so it’s ready by the time you are. The ground floor curtains and blinds open, and the towel heater in the bathroom warms the towels. And you haven't even gotten out of bed yet. This is truly one smart home.
At the core of these IoT appliances and their interactions are security, reliability, cost effectiveness, and wireless connectivity. Security ensures that sensitive personal information is kept private and that the overall system is protected from malicious hackers. Reliability is critical for seamless, error-free control of the system. Connectivity enables wireless information exchange and provides access to the Internet where advanced analytics can be performed and the system can self-learn to provide even more personalized service. Additional data, like context (i.e., who has entered the house) can be used to enhance intelligence. For example, room settings can be adjusted to match the preferences of a person when he or she enters the home. Voice command capabilities make appliances easier to use, such as telling the front door to unlock itself for friends and family. Finally, the system needs to keep costs down to make IoT technology affordable for mass market adoption. Figure 2 shows an example of a smart home.
[Figure 2 | Smart home example]
Smart home door lock controller implementation
To understand the complexity behind developing IoT-based applications, consider the implementation of a smart home door lock controller (see Figure 3). This controller implements fingerprint-based security for door operation; two room control nodes for controlling the lights, thermostat, and appliances in a room; a temperature monitoring node; and a secure network over Bluetooth Low Energy (BLE) 4.2 for all these nodes. A fair amount of processing is required to implement all of these capabilities. Many of today’s embedded MCUs, including the PSoC 6 BLE used in this example, provide sufficient processing performance while meeting low power operation requirements. In the case of the PSoC 6 BLE, this is achieved through a dual?core architecture: An Arm Cortex?M4 is available for high?performance tasks while an Arm Cortex?M0+ handles low-power tasks. Integrated security capabilities maintain the security of the overall controller.
[Figure 3 | Embedded MCU smart home example]
Fingerprint-based door lock: Security is needed to ensure that an unauthorized person doesn’t have access to the home through the front door. A highly secure system can be built using fingerprint authentication. Unauthorized access to the door can be prevented by designing a door lock that stores the fingerprints of authorized users. For this application, a fingerprint sensor senses the person’s finger, the embedded controller authenticates the person, and then the door lock is deactivated. More advanced capabilities can be implemented as well, such as triggering an alarm or sending a notification to the home owner if an unauthorized person attempts to access the home.
A typical fingerprint-based authentication system includes a fingerprint sensor/module that captures the fingerprint and a processor that runs various high-level algorithms such as enrollment of users and authentication. The high-performance core of the embedded MCU can perform these functions, as well as manage communication with a fingerprint module through interfaces such as SPI. Fingerprint technology is fairly mature, and fingerprint modules are available from MCU manufacturers that provide an entire software framework for capturing and authenticating fingerprints through the module. For example, the fingerprint framework takes care of generating low-level commands to the fingerprint module and providing encapsulated functions that can be invoked to perform more complicated tasks such as “Get Fingerprint Image” or “Enroll Fingerprint Image.” SPI communication with the module follows an interrupt-based methodology where the host sends a command and waits for the module to process the command. The module responds by generating an interrupt upon which the host reads the data prepared by the module. The module can also be configured to interrupt the processor on a finger touch on the sensor. This enables the processor to operate in a low-power state while waiting for the module to wake it upon a finger touch.
Fingerprint data can be stored in internal Flash. However, given the size of each fingerprint image and number of fingerprints the controller may need to support in the average home, Flash consumption will increase. As internal Flash is a premium resource, especially when designing complex applications like a smart home controller, offloading fingerprint data storage to external Flash is often a better approach for this use case.
External Flash interfaced via an interface like quad-SPI provides an effective way to store fingerprint data. Quad-SPI interfaces that also supports XIP (eXecute-In-Place) mode allow the CPU to view external memory as a part of internal Flash. This enables external memory access similar to internal Flash access, thus simplifying design and operation. In addition, the quad-SPI interface supports on-the-fly encryption and decryption (128-bit AES) in hardware, ensuring that fingerprint data is stored securely in external Flash.
To integrate the door lock controller into a smart home network, BLE is used. BLE not only connects the door lock controller to the smart home network, but also provides a secure way of enrolling fingerprints. This is achieved by pairing the door lock controller with an authorized phone. In addition to providing users an interface for configuring the door lock, it allows them to control the enrollment process (see Figure 4).
[Figure 4 | Finger print secure door example flow]
Room controls and monitoring: Room control nodes allow users to control lighting, thermostat, and other appliances in a room. They also enable monitoring of environment parameters like temperature, humidity. These nodes can be controlled through either a smart phone and/or local controls present in the node. The system shown in Figure 3, for example, includes two light control nodes and one temperature monitoring node. In addition, the light control nodes support smart control based on user identification. For instance, the node can be configured to turn on the lights when the house door is unlocked using an authenticated fingerprint. Similarly, the lights can be turned off when the door is locked when someone leaves (see Figure 5).
[Figure 5 | Room control implementation example]
Forming a secure network
After provisioning and initial configuration through a smart phone, nodes establish a cluster-based network using BLE secure connections. Each cluster head supports a unique 16-bit token. During node configuration, each node is provided the token and the details of its cluster head. The nodes add the cluster head to a whitelist and send the token only to the whitelisted cluster head on request to establish a connection. Once the connection is established, nodes send data to the head over notifications, the head forwards the packets to other heads, which are then distributed over the network. Packets can be addressed to another node or as a broadcast packet. For instance, when a user unlocks the door, this information (i.e., user 1 has entered the house) can be sent from the door lock node to its cluster head. The data is then forwards to the room control node, which then turns on the lights.
[Figure 6 | Room node control example flow]
A cluster-based network eliminates the need to route a packet through all nodes by enabling select devices (cluster heads) to handle routing and additional processing. This saves energy and processing power requirements at slave nodes, many of which may be running on batteries. Cluster heads can be selected depending upon the energy at their disposal. This network is analogous to an IPv6 over low power wireless personal area network (6LoWPAN) with routers (heads) and hosts (nodes). Having a cluster-based network also simplifies access to Internet through a gateway (edge router), enabling nodes to be controlled remotely through Internet, if desired.
[Figure 7 | Internet room nodes control example]
Smart home appliances can be quite complex. Providing security in a reliable and cost-effective manner requires on-chip cryptographic capabilities, integrated secure wireless connectivity, and mechanisms for securing personal data (i.e., captured fingerprints) in both internal and external memory. Because IoT standards are rapidly changing, secure over-the-air (OTA) capabilities with a secure-boot process are needed to keep appliances up to date. In addition, the available of firmware configurable peripherals and programmable blocks ensures that devices can integrate many of the components required for IoT system operation.
Power is critical for many IoT devices, especially those using batteries. Ultra-low-leakage allows devices to always be on and provide immediate responsiveness. Dual core architectures with dynamic voltage and frequency scaling allows appliances to support both high-performance capabilities such as fingerprint authentication and power-critical processes such as wake-to-touch.
In part one, we have covered IoT market trends, the relevance of smart home and wearable applications, and show an example implementation of a smart home door lock controller. In part two, we’ll explore the implementation of a wearables application.
- PSoC 6 MCU: PSoC 63 with BLE Datasheet Programmable System-on-Chip (PSoC)
- PSoC 63 with BLE Architecture Technical Reference Manual (TRM)
- AN210781 - Getting Started with PSoC 6 MCU with Bluetooth Low Energy (BLE) Connectivity
- AN219528 - PSoC 6 MCU Low-Power Modes and Power Reduction Techniques
- AN215656 – PSoC 6 MCU Dual-Core CPU System Design
- AN213924 - PSoC 6 MCU Bootloader Software Development Kit (SDK) Guide
- AN217666 – PSoC 6 MCU Interrupts
- AN218241 - PSoC 6 MCU Hardware Design Considerations
- AN92239 - Proximity Sensing with CapSense
- AN219434 - Importing PSoC Creator Code into an IDE for a PSoC 6 Project
- AN91445 - Antenna Design and RF Layout Guidelines
Jaya Kathuria works as an Applications Manager at Cypress Semiconductor Corporation where she is managing the Embedded Applications Group and Solutions Development using the PSoC platform. She has 12+ years of experience in Semiconductor Industry. She earned executive management credential from IIM, Bangalore and holds BS in Electronics Engineering from the Kurukshetra University.
Meenakshi Sundaram is a Senior Staff Applications Engineer at Cypress Semiconductor Corporation. He works on Bluetooth low energy and System-on-Chip solution development with Cypress’ PSoC platform. He has 7+ years’ experience in Embedded System and Solution development. He holds a MS degree in Embedded Systems from Birla Institute of Technology, Pilani.