The internet-of-things has different meanings to different people. On one side you have old curmudgeonly operations techs who take pride in designing and maintaining systems with the technological sophistication of an NES cartridge and believes this IoT crap is the devil. On the flip side you have IT software developers who are at home cutting code for either the web or mobile devices but would manage to burn a bowl of cornflakes if asked to replace a fuse on a toaster. If you are reading this article I assume you are a part of the latter; I would be highly impressed if you are a part of the former. Either way, I am going to introduce you to a communications protocol that is traditionally used in building automation control systems and how you as a mobile developer can model edge device functionality and create sleek, innovative command and control IoT Android apps.

Here at Ai-tronics Systems, we specialize in physical security and building automation application and device development. We believe that by effectively using protocols as a type of API developers can create robust Android apps that compliment edge devices. To accomplish this we had to dig deep and merge technologies that would produce an outcome as awesome as Voltron. One of these technologies is a little known object oriented device protocol called BACnet.

The BACnet standard was released in 1995 and is maintained by a number of control system companies who are associated with the group known as ASHRAE. The current version of the standard was released in 2016. The basic architecture of the protocol can be organized into to components – objects and services. The objects are essentially classes that contain data fields that are communicated through out a network. The services are the means of how the object data is transported over an IP or MQTT or Insert_Your_Favorite_Protocol. In addition, the specification provides a means of attacking application and device design by organizing them into device profiles. For our purposes we will be reviewing the process of what it takes to turn an Android device into a B-OWS or BACnet operator workstation – one of the more basic UI driven profiles. Before we get further into the concepts lets describe a typical system overview.





As you can see from the above image there are at least 3-layers within a building automation system. The top layer is the cloud connection for remote workstations, second layer is the local network connections with on-site workstations, servers and devices, the third is the edge devices, sensors and actuators. Now, with the network layout established how do you we command-and-control these device via our android app? This is where the BACnet object and services comes in.

BACnet Objects

Think of BACnet objects as a type of database. Each device that implements this protocol has a collection of objects that describes that particular device’s physical attributes, non-physical computational attributes or its internal process tasks as it relates to the network. At Ai-tronics since we deal with physical security systems we create objects based on life-safety systems and access control systems. Most objects that you would need to build a mobile workstation app is written into the spec documentation. However, if you are too broke or cheap to buy the document feel free to ask us about our mobile API. Each object has a list of required and optional property fields. Optional properties and custom properties can be added at the developers discretion. To start using objects the one main rule that each developer must adhere to is that all BACnet devices must implement an object called ‘device’ and must implement the required property fields. The device object is the main identifier of a particular BACnet device and can only be instantiated once The most common required property fields that all devices need to implement are: Object Identifier, Object Name, Object Type. These fields not only identify the particular object but will also come in handy when using the Services methods needed to communicate with other BACnet devices on the network.

BACnet Services

So, question for you. Do you know what a web service is? If your an experienced android developer you should. The point is if you familiar with networking calls and web services then you already know what a BACnet service is. The only difference is instead of processing JSON objects you are processing APDU objects ( i.e. Application Protocol Data Unit) delivered via an application transport layer called an NPDU (i.e. Network Protocol Data Unit). On a side note, BACnet services can be delivered as a traditional web service but because there are so many legacy edge devices installed we cannot simply rely on them being able talk JSON or to a lesser extent XML. There are two types of services: confirmed and unconfirmed. A confirmed service is one where a request expects returned data. An unconfirmed service does not expect any thing but a simple acknowledgement from a remote device. Currently, there are roughly 35 services that are organized into five categories: Alarm and Events, File Access, Object Access, Remote Device management, and virtual termination services. The last service is there for legacy purposes. As stated earlier BACnet devices requires that a device object exists. BACnet device are also required to have at least one service – the ReadProperty service.

Well, this article is starting to get kind of long and since I did titled this piece as a part one I better wrap this up. My goal was introduce android developers to the concept of communicating with devices that are kind-of-sort-of computers – but not really. In part two we will be applying these concepts with some code samples.

About the Author

Sheldon Gabriel is the founder and CTO of Ai-tronics Systems. Ai-tronics specializes in physical security and building control systems mobile and embedded systems development tools that gives developers the ability to build cohesive, secure AI-based IoT and IIoT systems and solutions.







