The rise of Bluetooth Low Energy (BLE) has taken the concept Internet of Things (IoT) from concept to commercial reality. The biggest reason for the proliferation of BLE has been its presence in smartphones, tablets and off-late, laptops too. This is where BLE has the advantage over previous proprietary protocols which required custom hardware, usually a USB dongle or an integrated radio, to complete the other end of the wireless communication. This, amongst other reasons like power consumption and standards-based software has caused BLE to become the de-facto choice for IoT applications. The most popular IoT applications have so far been seen in wearable electronics (e.g. the Jawbone Up), where a device gathers sensor data, runs complex algorithms to extract meaningful information, then transmits this information to a mobile device. Similar concepts are now being adopted by home appliances and sensor modules to convert ordinary homes into smart homes. Examples of such appliances include smart coffee makers that brew coffee of your choice and have it ready as you're ready to leave in the morning, or smart lighting control systems that detect your presence in the room and turn lights on or off automatically. One challenge with the current implementation of the BLE standard is its limited network topology. In systems such as smart homes where you may have multiple nodes (sensors and light switches in many locations), each node has to be individually controlled by a common central device, usually a mobile phone. In this article, we take a look at one novel approach as a solution to this limitation. Consider a smart home system with multiple nodes. Each node has a sensor interface, a light control unit, and a BLE communication unit. The sensor interface can detect human presence and ambient light levels. The light control unit can turn lights on or off and also control the colour temperature and intensity of the lights. The communication unit implements the BLE protocol to talk with the other nodes in the smart home system. Figure 1 shows a high-level block diagram of the smart home system.

EDNAOL 2016MAY27 TA 01Fig1Figure 1: Smart home system – block diagram.
In this smart home system, all nodes communicate over a mesh network – each working as a master or a slave in a time-multiplexed manner. Each node implements the following functionality: Sensor Interface: Each node implements interfaces for a proximity sensor and an ambient light sensor. The signals from these sensors are conditioned using an amplifier then digitized using an ADC. The digitized signals are then used for the LED control functionality and for communication with other nodes in the system. Light Control Unit: The measured signals are processed by an MCU and converted into the control information for the light's colour temperature and intensity. The control unit can adjust the light's colour temperature and intensity based on the ambient light levels and the time of day (from an RTC), or based on the user's input received via an app running on a BLE-enabled mobile phone. BLE Communication: In this system BLE serves two purposes. First, it provides a way for a mobile phone to control the lights on the node. In this case the node operate as GAP Peripheral and receives control information from the phone, which is the GAP Central. In the second case, BLE provides a mechanism for the node to control other nodes in the smart home system. During this, the node changes it role to operate as the GAP Central so it can send control information to the other nodes. Figure 2 shows a high-level BLE mesh implementation for the smart home system.

EDNAOL 2016MAY27 TA 01Fig2 Figure 2: BLE interface.
Dynamically Changing BLE GAP Roles: In this application, all nodes operate as GAP Peripherals (slaves) and try to establish a BLE connection with the GAP Central (master). Once a node receives control information from the GAP Central or it detects motion from the PIR sensors, it changes its role to a GAP Central and establishes connections with the other nodes in the system to forward the information onwards. By doing so, the other nodes do not need direct control information from the mobile phone, but instead can receive this same information from a nearby node. Due to the wide range of functionalities required in this application, one would typically need a multi-chip solution. Using multiple chips not only increases the BOM cost but also increases the PCB size, which is critical for space-constrained applications such as these. Cypress' PSoC 4 BLE solution is a perfect fit for such applications. This solution provides BLE communication, which can not only work as both the GAP Peripheral and GAP Central, but also dynamically switch between the two GAP roles. Additionally, PSoC 4 BLE includes programmable analogue blocks to create custom sensor interfaces and programmable digital blocks to implement control units – all of which can be used to design a true single-chip solution. This approach provides an economical solution by integrating the BOM and reducing PCB size, while also providing modularity by using the same chip to implement different functionalities for different nodes. Figure 3 shows the implementation of the Smart Light Controller using PSoC 4 BLE.

EDNAOL 2016MAY27 TA 01Fig3Figure 3: Smart light control application—PSoC 4 BLE solution.

This device not only implements all three of the above mentioned system features (sensor interface, light control unit, BLE communication), but also makes the implementation easy by providing the BLE Component, that creates BLE GAP Central and GAP Peripheral products in minutes. Cypress application note AN91162 provides information on implementing BLE-compatible Profiles for such custom applications that are not supported by the BLE Standard-Adopted Profiles from the Bluetooth SIG.
Conclusion
BLE has played a key role in making the IoT successful and has become the de-facto standard for IoT applications. It is not only used for wearable applications but is also proving to be a useful standard for home automation applications. BLE's current limitations in network topologies can be overcome by using novel approaches such as dynamic reconfiguration of GAP roles between Central and Peripheral. Cypress' PSoC 4 BLE provides a solution that integrates all requirements for IoT applications while also making it very easy-to-implement by providing free software tools, low-cost development kits and hundreds of design examples to get you started with.
About the authors
Pushek Madaan is Senior Marketing Engineer at Cypress. Gagan Luthra is Product Marketing Manager at Cypress.