An Internet Button

Wow! Its been way to long since I sat down to share something. I’ve meant to dozens of times. But just never knew exactly what I wanted to share. I’m hoping I’ll get to some of those ideas, like a deeper discussion of my Power BI automation API project, or perhaps discuss my new Intelligent Orchestrator blog. But since I’m really out of practice, I thought I might try something a bit simpler.

I’ve been playing with an internet button. 🙂

Particle’s Internet Button

So what we have here 120Mhz ARM Cortex processor paired with a Wi-Fi module (aka Particle’s “Photon” board). this board is then mounted on a circuit board that contains a ring of 11 RGB (red, green, blue) LEDs, a 3-axis accelerometer, and 4 push buttons that let you use this like a controller style D-pad. The result is a pre-packaged circuit board with lights and sensors that doesn’t require any wiring or breadboards.

This appears to be the product of a partnershipt between Particle and Adafruit. With the former having responsibility for the “brain”, and the later for breadboard and likely manufacture of the button as a whole. I shopped around and if you bought all the components contained in this kit yourself (minus the custom plastic housing)  you’d be spending about $40-45. Considering that for few bucks more you get the entire thing assembled for you, testing, in a nice metal “can” case, I think its a worthwhile spend.

If you’ve programmed an Arduino, you’ll be right at home with the Photon. It uses a Wiring so you’ll be able to apply existing skills.

But why?

So the question you may be asking yourself about this… why? Well, like most of my projects, it started with a customer ask. They had noticed Amazon’s IOT Button and wanted to know if there was something similar for Azure (Amazon’s button is aimed at AWS of course). As I went poking I found the Particle button.

Now admittedly, it was more than twice the price of Amazon’s. But again, we’re getting 4 times as many buttons, plus the accelerometer, and the LED ring. So from a prototyping standpoint, there’s alot more to work with.

With this in mind, I figured I’d needed a sample project to work on. So I set about to create a “busy light” for Skype. I work from home most of the time and my family has noted it would be great if they could know I was on a call or not without having to come and ask me. With the LEDs, this seemed like an easy project. And after a little poking around, I found a colleague, Jon Gallant had already done some work in this area.

So with a will, and an idea about the way, I ordered my button and got ready to get to work.

How I set it up…

After about a week, my button arrived. I followed the initial setup instructions and set about loading a sample program in to make sure it was set up and working. This is one of the reasons I like working with the Particle stuff. Once the device is set up, all you need to do is keep it plugged in and connected to the internet via Wi-Fi. You can do all your device management and programming via Particle’s web based IDE.

This simple IED also includes access to a marketplace of programs and samples you can easily load onto your Photon. I selected the “blink an LED” sample program and clicked “Flash” to send it to my Photon. Sure enough, in a few seconds the LED in the center of the Photon started doing a rainbow affect.

Now to my “busy light” code working….

I started by creating a simple loop routine that could create a spinning ring of colors. Green for “available”, Yellow for “away”, and Red for “busy”. This took a bit of playing because I’m not someone who normally writes code for devices. But after a few hours, I managed to work out a solution that got the job done, and admittedly wasn’t so bright that it would give my wife a migraine.

With the light code in place, I had to have a way to get the status of Skype on my computer to the device. Unfortunately, there’s no modern “Office Add-in” model for Skype for Business. At least yet. And if you’ve seen the news, the plan is to merge Skype and Teams into a unified communications platform. That’s alot of work, so it may take awhile before there’s an add-in model we can leverage. Fortunately, Jon had already built a project using the now deprecated Skype for Business SDK. While it may be officially deprecated, it still works. So I immediately went and snagged his Beakn project.

Since the SDK has been deprecated, finding the bit to build Jon’s code is difficult. Fortunately, he’s published several releases (linked above) so you can snag one and install it. One VERY important thing you need to do after installation…. Go to the install location and update the beakn.exe.config so that Protocol app setting is “SparkCore”. If you don’t do this, you may waste way to many hours trying to figure why things won’t work. Personal experience talking… You can find this file at: %programfiles(x86)%\beakn\beakn v0.4.3 With this change made, you just run the Beakn client and configure it to point at your device.

The Beakn client is looking to send events to an API function named “setStatus”. One of the really neat aspects to Particle’s boards is that they connect (by default) to their device management back end. This allows you to register functions on the device that can be accessed via this API. And the API is managed entirely by Particle. So my code would register a “setStatus” function that changes the color.

The code for the Photon isn’t that big, but I’ll save you an ugly copy and paste. I’ve shared the code via Particle’s IDE environment. You can find it at: https://build.particle.io/shared_apps/5a60ce6a3654b2494f000391 (this does require registration).

With the code flashed to my device, and the Beakn client running… I now have interruption free calls.

Device.Disconnect

So there you have it. While its not a $50 commercially made Busy light. It does get the job done. And when not being used as a status indicator, it will have numerous other uses it can be put too.

Until next time… keep connecting the things. 🙂

Advertisements

One Response to An Internet Button

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: