12 min read

In this article by Miguel de Sousa, author of the book Internet of Things with Intel Galileo, we will cover the following topics:

  • Wiring the circuit
  • The Muzzley IoT ecosystem
  • Creating a Muzzley app
  • Lighting up the entrance door

(For more resources related to this topic, see here.)

One identified issue regarding IoT is that there will be lots of connected devices and each one speaks its own language, not sharing the same protocols with other devices. This leads to an increasing number of apps to control each of those devices. Every time you purchase connected products, you’ll be required to have the exclusive product app, and, in the near future, where it is predicted that more devices will be connected to the Internet than people, this is indeed a problem, which is known as the basket of remotes.

Many solutions have been appearing for this problem. Some of them focus on creating common communication standards between the devices or even creating their own protocol such as the Intel Common Connectivity Framework (CCF). A different approach consists in predicting the device’s interactions, where collected data is used to predict and trigger actions on the specific devices. An example using this approach is Muzzley. It not only supports a common way to speak with the devices, but also learns from the users’ interaction, allowing them to control all their devices from a common app, and on collecting usage data, it can predict users’ actions and even make different devices work together.

In this article, we will start by understanding what Muzzley is and how we can integrate with it. We will then do some development to allow you to control your own building’s entrance door. For this purpose, we will use Galileo as a bridge to communicate with a relay and the Muzzley cloud, allowing you to control the door from a common mobile app and from anywhere as long as there is Internet access.

Wiring the circuit

In this article, we’ll be using a real home AC inter-communicator with a building entrance door unlock button and this will require you to do some homework. This integration will require you to open your inter-communicator and adjust the inner circuit, so be aware that there are always risks of damaging it.

If you don’t want to use a real inter-communicator, you can replace it by an LED or even by the buzzer module. If you want to use a real device, you can use a DC inter-communicator, but in this guide, we’ll only be explaining how to do the wiring using an AC inter-communicator.

The first thing you have to do is to take a look at the device manual and check whether it works with AC current, and the voltage it requires. If you can’t locate your product manual, search for it online.

In this article, we’ll be using the solid state relay. This relay accepts a voltage range from 24 V up to 380 V AC, and your inter-communicator should also work in this voltage range.

You’ll also need some electrical wires and electrical wires junctions:

Wire junctions and the solid state relay

This equipment will be used to adapt the door unlocking circuit to allow it to be controlled from the Galileo board using a relay.

The main idea is to use a relay to close the door opener circuit, resulting in the door being unlocked. This can be accomplished by joining the inter-communicator switch wires with the relay wires. Use some wire and wire junctions to do it, as displayed in the following image:

Wiring the circuit

The building/house AC circuit is represented in yellow, and S1 and S2 represent the inter-communicator switch (button). On pressing the button, we will also be closing this circuit, and the door will be unlocked. This way, the lock can be controlled both ways, using the original button and the relay.

Before starting to wire the circuit, make sure that the inter-communicator circuit is powered off. If you can’t switch it off, you can always turn off your house electrical board for a couple of minutes. Make sure that it is powered off by pressing the unlock button and trying to open the door.

If you are not sure of what you must do or don’t feel comfortable doing it, ask for help from someone more experienced.

Open your inter-communicator, locate the switch, and perform the changes displayed in the preceding image (you may have to do some soldering).

The Intel Galileo board will then activate the relay using pin 13, where you should wire it to the relay’s connector number 3, and the Galileo’s ground (GND) should be connected to the relay’s connector number 4.

Beware that not all the inter-communicator circuits work the same way and although we try to provide a general way to do it, there’re always the risk of damaging your device or being electrocuted. Do it at your own risk.

Power on your inter-communicator circuit and check whether you can open the door by pressing the unlock door button.

If you prefer not using the inter-communicator with the relay, you can always replace it with a buzzer or an LED to simulate the door opening. Also, since the relay is connected to Galileo’s pin 13, with the same relay code, you’ll have visual feedback from the Galileo’s onboard LED.

The Muzzley IoT ecosystem

Muzzley is an Internet of Things ecosystem that is composed of connected devices, mobile apps, and cloud-based services. Devices can be integrated with Muzzley through the device cloud or the device itself:

It offers device control, a rules system, and a machine learning system that predicts and suggests actions, based on the device usage.

The mobile app is available for Android, iOS, and Windows phone. It can pack all your Internet-connected devices in to a single common app, allowing them to be controlled together, and to work with other devices that are available in real-world stores or even other homemade connected devices, like the one we will create in this article.

Muzzley is known for being one of the first generation platforms with the ability to predict a users’ actions by learning from the user’s interaction with their own devices.

Human behavior is mostly unpredictable, but for convenience, people end up creating routines in their daily lives. The interaction with home devices is an example where human behavior can be observed and learned by an automated system.

Muzzley tries to take advantage of these behaviors by identifying the user’s recurrent routines and making suggestions that could accelerate and simplify the interaction with the mobile app and devices. Devices that don’t know of each others’ existence get connected through the user behavior and may create synergies among themselves.

When the user starts using the Muzzley app, the interaction is observed by a profiler agent that tries to acquire a behavioral network of the linked cause-effect events. When the frequency of these network associations becomes important enough, the profiler agent emits a suggestion for the user to act upon. For instance, if every time a user arrives home, he switches on the house lights, check the thermostat, and adjust the air conditioner accordingly, the profiler agent will emit a set of suggestions based on this. The cause of the suggestion is identified and shortcuts are offered for the effect-associated action. For instance, the user could receive in the Muzzley app the following suggestions: “You are arriving at a known location. Every time you arrive here, you switch on the «Entrance bulb». Would you like to do it now?”; or “You are arriving at a known location. The thermostat «Living room» says that the temperature is at 15 degrees Celsius. Would you like to set your «Living room» air conditioner to 21 degrees Celsius?”

When it comes to security and privacy, Muzzley takes it seriously and all the collected data is used exclusively to analyze behaviors to help make your life easier.

This is the system where we will be integrating our door unlocker.

Creating a Muzzley app

The first step is to own a Muzzley developer account.

If you don’t have one yet, you can obtain one by visiting https://muzzley.com/developers, clicking on the Sign up button, and submitting the displayed form.

To create an app, click on the top menu option Apps and then Create app. Name your App Galileo Lock and if you want to, add a description to your project.

As soon as you click on Submit, you’ll see two buttons displayed, allowing you to select the integration type:

Muzzley allows you to integrate through the product manufacturer cloud or directly with a device. In this example, we will be integrating directly with the device. To do so, click on Device to Cloud integration.

Fill in the provider name as you wish and pick two image URLs to be used as the profile (for example, http://hub.packtpub.com/wp-content/uploads/2015/08/Commercial1.jpg) and channel (for example, http://hub.packtpub.com/wp-content/uploads/2015/08/lock.png) images.

We can select one of two available ways to add our device: it can be done using UPnP discovery or by inserting a custom serial number. Pick the device discovery option Serial number and ignore the fields Interface UUID and Email Access List; we will come back for them later. Save your changes by pressing the Save changes button.

Lighting up the entrance door

Now that we can unlock our door from anywhere using the mobile phone with an Internet connection, a nice thing to have is the entrance lights turn on when you open the building door using your Muzzley app.

To do this, you can use the Muzzley workers to define rules to perform an action when the door is unlocked using the mobile app. To do this, you’ll need to own one of the Muzzley-enabled smart bulbs such as Philips Hue, WeMo LED Lighting, Milight, Easybulb, or LIFX. You can find all the enabled devices in the app profiles selection list:

If you don’t have those specific lighting devices but have another type of connected device, search the available list to see whether it is supported. If it is, you can use that instead.

Add your bulb channel to your account. You should now find it listed in your channels under the category Lighting. If you click on it, you’ll be able to control the lights.

To activate the trigger option in the lock profile we created previously, go to the Muzzley website and head back to the Profile Spec app, located inside App Details. Expand the property lock status by clicking on the arrow sign in the property #1 – Lock Status section and then expand the controlInterfaces section. Create a new control interface by clicking on the +controlInterface button. In the new controlInterface #1 section, we’ll need to define the possible choices of label-values for this property when setting a rule. Feel free to insert an id, and in the control interface option, select the text-picker option. In the config field, we’ll need to specify each of the available options, setting the display label and the real value that will be published. Insert the following JSON object:

{"options":[{"value":"true","label":"Lock"}, {"value":"false","label":"Unlock"}]}.

Now we need to create a trigger. In the profile spec, expand the trigger section. Create a new trigger by clicking on the +trigger button. Inside the newly created section, select the equals condition. Create an input by clicking on +input, insert the ID value, insert the ID of the control interface you have just created in the controlInterfaceId text field. Finally, add the [{“source”:”selection.value”,”target”:”data.value”}].path to map the data.

Open your mobile app and click on the workers icon. Clicking on Create Worker will display the worker creation menu to you. Here, you’ll be able to select a channel component property as a trigger to some other channel component property:

Select the lock and select the Lock Status is equal to Unlock trigger. Save it and select the action button. In here, select the smart bulb you own and select the Status On option:

After saving this rule, give it a try and use your mobile phone to unlock the door. The smart bulb should then turn on. With this, you can configure many things in your home even before you arrive there. In this specific scenario, we used our door locker as a trigger to accomplish an action on a lightbulb. If you want, you can do the opposite and open the door when a lightbulb lights up a specific color for instance. To do it, similar to how you configured your device trigger, you just have to set up the action options in your device profile page.

Summary

Everyday objects that surround us are being transformed into information ecosystems and the way we interact with them is slowly changing. Although IoT is growing up fast, it is nowadays in an early stage, and many issues must be solved in order to make it successfully scalable. By 2020, it is estimated that there will be more than 25 billion devices connected to the Internet.

This fast growth without security regulations and deep security studies are leading to major concerns regarding the two biggest IoT challenges—security and privacy. Devices in our home that are remotely controllable or even personal data information getting into the wrong hands could be the recipe for a disaster.

In this article you have learned the basic steps in wiring the circuit of your Galileo board, creating a Muzzley app, and lighting up the entrance door of your building through your Muzzley app, by using Intel Galileo board as a bridge to communicate with Muzzley cloud.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here