Logic Gates. Doorway to Smart Home Perfection.
Smart Home systems help boost our quality of life, no doubt about it. After all, you can’t beat lights and heating turning themselves on whenever... Hang on a sec, whenever what? Whenever a motion sensor detects someone walking around? Or when a pre-set timer routine kicks in? In a nutshell, Conrad Connect allows you to decide what happens when. And unlike other IoT platforms, our framework isn’t limited to one single condition when it comes to triggering smart home action. Our system is based on what’s called logic gates. Sounds like Greek to you? Don’t worry. Below, we explain what logic gates are all about, and how you can apply them to fine-tune IoT projects by simply using drag and drop.
Logic Gates. The Number One Tool of Every Smart Home Enthusiast
Logic gates are a long-established method used in electronics and across the digital world to determine how devices need to respond when facing an ambiguous or potentially confusing situation. In short, whenever home automation actuators encounter a scenario with more than one way of possible action, logic gates tell them which one to choose.
Metaphorically speaking, logic gates act as a doorway or filter, making sure only the right sort of signal gets through to the actuator, using a process of implementing logical conjunctions.
Conrad Connect allows you to use four different gates, namely
- NAND (NOT-AND)
There are other types of gates, such as the NOT gate, but you won’t need those on our platform. Logic gates originate from a branch of mathematics called Boolean Algebra, and are denoted in caps.
Using logic gates to set up smart home routines puts you right up there with all those code wizards and brilliant mathematicians. And doing it feels way more awesome than during those math lessons back then, at school.
Before we really dive into the subject, however, here are two more key terms you need to know:
Logic gates assess the input received from multiple sensors simultaneously, use above terms to decide on what action should be taken, and afterwards forward the decision to actuators. If the outcome is TRUE, this will trigger a response, such as the actuator turning the lights on, or changing the temperature settings of the central heating system . If the outcome is FALSE, nothing happens.
Five Steps to Using Logic Gates Effectively
The easiest way to interconnect data collected by multiple sensors or services by different brands or providers is using our browser-based graphical rule editor.
- Log in to your Conrad Connect account.
- Click “Projects” in the navigation bar.
- Select “+ New Product” in the right-hand column.
- This opens the editor. Choose the sensors and actuators you want to use from the left-hand column.
- Scroll down and select the appropriate logic gate that defines the interaction between the sensors and actuators.
The browser window looks like this:
Each of the four available logic gates covers a different interaction scenario:
- AND: two sensor readings are TRUE down to the last digit and, hence, trigger a response.
- NAND: useful when it comes to addressing parameter ranges rather than exact values, e.g. if you want to keep room temperature within certain limits.
- OR: basically similar to NAND but using one of two exact thresholds (no range!) to trigger a response.
- GENERAL: Enables using a large number of different conditions to trigger a response, with the respective conditions to be selected using a checkbox.
Below four practical examples of what gate to choose when setting up basic automation scenarios.
AND Gate. It Takes Two.
When to use it. The AND gate computes input received from at least two sensors. Means it’s the one to go for if you want to activate devices whenever two or more conditions apply. Our example illustrates this using Philips Hue smart bulbs, with the light being switched on over weekends and during the dark hours only.
Settings. Clicking the AND icon in the project field results in the gate parameters being displayed in the right hand column. In our case, the AND gate checks whether it’s either Saturday or Sunday, and whether it’s after dark. If both conditions are met (i.e. are TRUE), the gate output is also TRUE. Click the Hue icon (actuator) and select TRUE as a trigger (as shown below).
Because the sensors continually check what day it is, and whether it’s after sunset or still daylight hours, the system will only turn on the lights during weekend nights (i.e. when the AND gate produces a TRUE).
NAND Gate: Relax, Everything Is Fine.
When to use it. Let’s say you want to keep the room temperature and carbon dioxide levels within certain limits, for instance, to make sure the latest addition to your family gets a good night’s sleep or working from home stays on the productive side of things. Means your objective is to set up e.g. your Netatmo weather station in a way that involves you getting notified by email whenever one of the sensors detects levels below your chosen presets. This is precisely where the NAND gate comes in.
Settings. First, connect the sensors and the email actuator to the NAND gate. Afterwards, select the required temperature and carbon dioxide range. The underlying logical conjunction needs to be set as follows: as long as the input received from all sensors is TRUE (i.e. within the permitted range), the gate needs to output a FALSE means to action is triggered. However, as soon as one of the sensors produces a FALSE (i.e. temperature below or CO2 above preset values), the gate needs to output a TRUE which results in an email being sent. Don’t forget to choose TRUE as a trigger for the email notification.
OR Gate. There‘s Only One Way. Or Maybe Two.
When to use it. Doing a bit (or lots) of gardening is many people’s favourite pastime. However, a stint of bad weather can pretty much devastate your efforts. No need to worry though. Here’s a project that helps protect your precious green life from the effects of too much rain or sudden cold spells. Unlike in our previous example, this time we want to get a text message as soon as one of the two conditions is met. Means we need to work with the OR gate.
Settings. OR gate conjunctions are very simple. The gate produces a FALSE (i.e. no action being taken) only if the input received from both sensors is FALSE. Otherwise, the gate constantly outputs a TRUE. Setting the trigger to TRUE means you’ll get a text as soon as one or both sensors produce a TRUE (i.e. in the case of dropping temperatures and/or persistent rainfall).
GENERAL Gate: Not All at the Same Time, Please!
When to use it. The GENERAL gate (basically a combination of gates) comes in handy if you are facing way to many options, and you want to handpick a limited set of conditions that trigger action. For instance, weather forecasts normally fall into this category of scenarios as they are based on a wide range of different environmental readings.
Settings. Use a checkbox to define the set of conditions that meet your requirements.
Everything logic? Have fun!