Smart Home Latency

Latency (Wikipedia definition) is a measure of the time delays experienced in a system such as a smart home. There are many sources of latency in the smart home and this article aims to provide some insight into this latency, where it occurs, the real-world implications and what you can do to minimise its impact. Latency should be a consideration in any smart home design and must be considered when installing structured wiring and any home automation equipment.

Sources Of Latency

Sensors

HIH-400 humidity sensor

Any 'dumb' sensor from a Dallas DS1820 temperature sensor to a HIH-4000 humidity sensor (pictured) has some inherent latency. Sensors like this take time to stabilise and establish a reading that can be extracted from the sensor. These delays are usually very short but this latency should be a consideration when selecting your sensors.

PIR sensor

Even a simple digital sensors such as PIR sensors have latency, more so if using an internal relay and not solid-state electronics. Relays take a small amount of time to switch their contacts. Most PIR sensors also have jumpers to configure the sensitivity (setting the number of pulses required to trigger them) and this adds greater latency. These delays can be significant (several seconds) when you want to detect occupancy and then take action based upon it.

Sensor Location

The location of a sensor is also a factor that increases latency. A humidity sensor in a bathroom may be just a few feet away from the shower cubicle but, it may take many seconds for the moisture from a shower to reach the sensor and for the increase to then be measured and reported.

PIR sensors used to detect occupancy need to be close to entrances and exits, in order to rapidly detect people moving. A ceiling mounted 360° PIR sensor in the centre of a room may take longer to detect someone walking into it.

The height at which a temperature sensor is mounted will affect its ability to detect temperature rises from under floor heating.

Example:  It is for this reason that we have 3 temperature sensors in our conservatory, one at floor level, another 1.5m above the floor level and a third at ceiling level. These can then be used to decide if the ceiling fan should be switched on, to mix the air up in the conservatory and thus reduce the temperature gradient within the room.
Example:  The best way to detect occupancy of a room is to use a wired door contact sensor and we have done this for every door in our home, where possible. We have invisibly wired reed switches into each door frame, with a magnet in the top of each door to activate them. These connect to an Arduino processor with a wired Ethernet connection, to deliver state change events to our Home Control System with incredibly low latency. This enables it to switch on lights for us instantly.

Measurement

The process used to actually collect a measurement from a sensor will also introduce latency. The electrical signal passing down the wires introduces a tiny delay. Analogue sensors such as temperature or humidity sensors require an analogue to digital conversion which also adds 'conversion' time.

Example:  We use Dallas DS1820 devices for most of our temperature sensors. The Dallas 1-Wire technology uses polling, which is another source of latency. If you have many sensors on your 1-Wire network, then each is polled in turn to get a temperature measurement. With many sensors on the same network segment, this could then take many seconds between checking each sensor. This is one reason why we use a distributed architecture with slave processors.
Note:  If anything in your design or installation is using polling then take a long hard look at it and ask yourself, is there a better way to do this? Technologies like this must be used wisely and applied to situations where latency will not be an issue.

Acknowledgement

If there is latency in requesting a particular state from a device, then there will most likely be a similar delay in getting back an acknowledgement that the requested state has been set.

Note:  We only use home automation technologies that provide two-way communications with acknowledgements. Without this there is no way of knowing that something requested has actually happened. In many home automation applications (security, safety, etc.) this is essential.

Networks

Any form of networking is going to introduce latency. Wired networks are much better than wireless in this respect but it does depend upon the networking technology being used.

Wireless IP networks (e.g. Wi-Fi) inherently introduce latency and a large number of external factors (congestion, packet loss, interference, lower speeds, etc.). There are many reasons not to use Wi-Fi for smart home automation and latency is just one of them. That said, it does work well for remote control user interfaces (apps) on Smartphone and tablets, where latency is less of an issue.

Wired IP networks are fast, reliable and provide very low latency if used correctly. Typically, this means separating home control and automation traffic from general data flows (web browsing, backups, etc.) and especially from entertainment traffic (e.g. video streaming). This separation can be done using network switches or physically separate network cables and infrastructure. If your home automation control data is sharing the same network as high-definition video streaming, then latency can increase long before you approach the maximum throughput of the network.

Processing & Analysis

The processing and analysis of sensor data and other events is what makes a smart home really smart. It needs to be able to do this in near real-time and with very low latency, in order for the people in the smart home to not be frustrated by visible delays in the user experience. Latency is often one of the biggest issues in providing a great user experience.

We have a Home Control System that receives all our smart home events and it uses multi-threading to provide excellent performance. During a typical weekend day (where someone is at home all day), it will handle over 300,000 real-time events and analyse and action them all in less than a few milliseconds. In our next home we expect this to rise to over 500,000 daily events (that's an average of about 6 per sec) and are confident our contextual smart home could easily handle many millions of events whilst maintaining this performance and very low latency.

To achieve this it needs to be situated in the smart home and be connected to a low-latency wired network. We are using Gigabit Ethernet. The overall speed is less of an issue due to the relative low volume of data being sent and its relatively even distribution over the course of a day. Home automation network data is rarely 'peaky' in nature. We keep latency low by keeping home automation data on a separate network. We also do this for resilience and reliability with our home automation network being protected from power outages using a Uninterruptible Power Supply (UPS).

Action

If you have networked actuators and devices, then they too are subject to network latency and the devices themselves may introduce more latency. Our preferred approach is to use Ethernet connected I/O as this provides the best performance and reliability.

Where we cannot run physical wires in our current home, we are using Z-Wave mesh networking, which provides fairly low latency as you can see from the examples below.

Internet & Cloud

As soon as you introduce the Internet into the measurement and control loop, you introduce a lot of latency. More of the problem than the actual time delays is the lack of predictability and consistency now present. A cloud service could be down or temporarily unreachable. Your local Internet connectivity or a remote server could be congested at certain times of the day, resulting in latency of many seconds.

We have deliberately designed our HCS to be autonomous and to operate independently from the Internet. It does use the Internet and cloud services but, only to improve the main user experience and it makes no assumptions about them being available.

Remote networked services, such as notification engines and SMS gateways have inherent delays. SMS doesn't even guarantee delivery.

Smart Sensors

We consider 'smart sensors' to be a source of latency, because anything that sits between a dumb sensor and its ability to provide raw data into the decision making Home Control System will simply slow things down. So called 'smart sensors' provide additional complexity and prevent simple and fast access to the basic raw data by often adding a 'service wrap' or limited and proprietary APIs to gain access to it. Many also try to make complex decisions with a very limited view of the home (i.e. without whole home context). A collection of smart sensors from a competing group of vendors will not work in harmony and there will be duplicated functionality and many compromises.

Put simply, we want (for example) our smoke detectors to detect smoke and let my home automation controller quickly decide what to do with this information, whilst taking into account all the other information and context available.

Why Does It Matter?

Having covered many of the possible sources of latency in the smart home, you can hopefully see that they might all add up to significant delays, especially when you want a sensor to trigger an action that is highly visible to someone within your smart home.

Latency is also not always consistent. It can have the effect of delaying some events but not others. This could mean that things that happened in a particular order in the real world, could appear to have happened in a different order at the controller (where the decisions are made). Some examples:

People care about latency because low latency is key to a simple and great user experience.

Real-World Examples

The following video clip shows a real-world example in our current home. The steps involved and the latency introduced here are:

As you can see in the above video, this is a real-world example where the latency between door opening and the entrance hall light coming on is clearly evident but not significant from a user perspective. The annoying thing is that this is not always the case though. Our Z-Wave installation has proven to be variable in this respect. Generally performance is good but, on occasions there are more noticeable delays.

If we were to use wired technologies to address the exact same problem in our home (as we do in other rooms), the latency is consistent and not noticeable. The light on the other side of the door is much like the light in your fridge. It comes on before you can see it was actually off.

What Can You Do?

  1. Position sensors wisely, to ensure they are in the best location to detect and measure the thing they were installed for.
  2. Select sensors and devices (and associated interface and networking technology) carefully, to ensure suitability for your intended application.
  3. Avoid wireless networks if at all possible.
  4. Structured wiring is the best option but, make sure the topology is right for the environment and layout of your home.
  5. Use ducting to support easy installation and upgrade over time.
  6. Keep IP network traffic types (e.g. home automation, general home usage and entertainment services) apart using switches or physically isolated networks.
  7. Use a high performance smart home controller.