Smart bulbs or how to be lazier (part 1)

Probably, AllJoyn is the only topic that I have never covered in my posts. I simply don’t have any AllJoyn device. Once Microsoft introduced AllJoyn support I discovered that the cheapest LED costs around fifty American dollars and my positive attitude to AllJoyn decreased to minimum. Of course, I could use my laptop and Raspberry to make some experiments but it’s not funny.

Last week two things had happened to me:

  • I have selected several Wi-Fi modules and found that ESP8266 costs about $3 only. At the same time, you can find microcontrollers with built-in Wi-Fi starting from $7. Frankly speaking, I am ready to pay $5-7 to be able to check if I forgot to switch-off my iron and to switch it off in case of my forgetfulness. Looks like that Wi-Fi will be everywhere very soon
  • More than 50% bulbs in my flat burned and I had to visit HomeDepot in order to buy several new ones. I was very surprised because I found lots of LEDs with reasonable prices starting from $10, which support integration with mobile devices. Obviously these LEDs should support Wi-Fi or Bluetooth.

These two things set my mind back on AllJoyn, and I started to investigate if there was anything that I could test right away, spending $10-15 dollars. My experiments have a very practical ground: I don’t want to get up from my bed if I forget to switch off the lights in my kitchen. I am too lazy, and I want to reach the absolute laziness.

Unfortunately, many of available LEDs don’t have any notes if any standard protocol is supported, and if it is possible to connect the LEDs from my application instead of using a standard one. Finally, I found two models: GE Link and Cree with a magical sign ZigBee on the boxes.

Stop! Zig what? And what about AllJoyn?

Unfortunately, there is still not many AllJoyn devices on the market but it’s not a problem at all. Microsoft introduced Device System Bridge concept that allows to use non-AllJoyn devices with AllJoyn API and tools. Visiting https://ms-iot.github.io/content/en-US/win10/AllJoynDSB.htm you can find several system bridges for the most popular home automation protocols like ZigBee, Z-Wave and BACNet. That’s why I was happy to find ZigBee bulb.

Some words about AllJoyn and ZigBee.

AllJoyn is an open-source framework for IoT devices that allows to publish over a network in a standard way. So, you can easily discover devices, evaluate their APIs and communicate to them. Windows 10 supports AllJoyn, and you can start using it on your Windows 10 IoT devices.

ZigBee is a specification of communication protocols which are based on low power digital radio technologies. Using ZigBee, you should have a device called coordinator and all other devices will be connected to it.

So, you can see a difference. In order to use AllJoyn, you can use any communication protocol based on Wi-Fi or Bluetooth but in case of ZigBee we have to include a coordinator to our network and think about special low power devices to transmit our data.

Of course, if I want to manage my bulbs from anywhere I need to setup a hub in any case. My hub will be connected to Azure, and I will use Azure Event Hub to send messages to my physical Hub. The cheapest way to develop a physical hub based on Windows 10 is using Raspberry Pi 2. I think that I can spend thirty dollars in order to create a device that will control my home and thanks to Windows 10 IoT I should not learn anything about microcontrollers. Of course, if I am going to send my hub to production, I will need to create my own device as well as Windows 10 IoT image from scratch.

The most important question with ZigBee is how to enable Raspberry to connect my LEDs using radio protocols. It’s better to solder your own connector using a microchip from Texas Instruments or from other manufacturers that support ZigBee communications. You can find lots of these chips. But the simplest way to start working with our led is using the famous XBee controller which you can buy in any electronic shop. Additionally, we will need to configure out XBee using a PC. In order to do it, you have to buy an XBee Explorer or a simple USB to TTL serial adapter. Of course, XBee Explorer is better but I found that it costs the same price as the XBee itself. So, I decided to buy a simple adapter but it’s important to make sure that the adapter has CTS and RTS pins because in some cases you can find only RX and TX pins. This adapter should work find.

Finally, in order to start with the bulb, I will need:

  • ·         The bulb itself;
  • ·         A Raspberry Pi 2;
  • ·         An XBee device (you need that one, which supports 2.4 Mhz)
  • ·         A USB to TTL adapter
  • ·         Access to Azure

Next time I will try to connect all these things together and, finally, I will use Azure and Universal Windows Platform to create a service and a mobile application to turn on my bulbs.