beakn v0.2 : DIY Lync Status Light with an Arduino or Netduino, Ping Pong Ball and a Cardboard Box - Now Cloud Driven with MQTT

IMG_1827I’m working on a “maker experience” project called beakn. It’s a Lync status light that lights up red, yellow or green based on your Lync status. beakn v0.1 was all about getting it working without it being too complex – so I opted for using the USB connection from my computer to the Arduino and then send Serial commands over that connection to tell the Arduino what LED to light up. My ultimate goal of the project is to get into the shoes of a maker and see what it takes to take a product from inception to proof of concept to prototype and finally to production. The end product will be a completely wireless Lync status light that you place anywhere in your office, home or oil rig.

beakn v0.2 gets us one step closer by introducing Ethernet and MQTT (Message Queue Telemetry Transport), which is VERY light weight pub-sub messaging protocol for IoT devices (wikipedia). I spent a lot of time working with the Arduino WiFi shield as well, but I couldn’t get it stabilized in time for the v0.2 release. Also in that process I realized that WiFi is probably out of the picture because of the setup and config that is involved – you have to get the SSID and Password into the sketch and upload it via the IDE, which isn’t something I want my early adopters to have to do. I will likely end up going with a gateway device connected to Ethernet that listens for MQTT events and sends commands to the beakn via Bluetooth LE or Xbee. That was a rat hole I didn’t want to go down for this version. Also, with regard to power, I want it to run on battery – the problem is that the Uno and the WiFi shield together won’t run for very long on a 9V. I dug into what it would take to power the beakn, but didn’t get too far. I’m thinking I’m going to have to deal with that in the prototype phase…I still consider this to be in the proof of concept phase. Prototype will move away from Arduino and onto getting individual microcontrollers, surface mount LEDs, power management and a 3D printed enclosure.

This entire project is available on GitHub here: https://github.com/jonbgallant/beakn/

If you are new to beakn it might be a good idea for you to read through the beakn v0.1 post

Here are some pictures of the v0.2 build

IMG_1830IMG_1829IMG_1832IMG_1834

The design includes:

1. Arduino or Netduino with 3 LEDs

2. Ethernet Shield

3. MQTT

4. Desktop Application

The app flow is:

You have a desktop application that listens for Lync status change events and publishes a status message to the MQTT topic with the current status. The Arduino/Netduino subscribe to that same MQTT topic and changes the LED color based on the payload of the message.

Here are some of the changes in v0.2

  • The Arduino Uno does not come with an ethernet connectivity, so I had to get an ethernet shield. I opted for the Power Over Ethernet version – but didn’t focus on getting PoE working for this version – you need a power adapter for v0.2.

IMG_1835

  • If you are going to stick with Arduino and don’t have one yet, then get the Yun instead. It comes with an Ethernet port.* There are a couple of MQTT Arduino libraries out there and I decided to use the Arduino Client for MQTT because it looked simple enough and I got it running pretty quickly.
  • The beakn desktop application is much more stable and won’t lose connection when you sign in and out of Lync. It will lose connection if you completely exit Lync. I spent a bit of time researching that, but just decided to address that issue later.
  • For MQTT on the desktop app I decided to use M2Mqtt because it looks like it is the only game in town and they have a nuGet package.
  • There are a couple of free MQTT services out there to test things out and I decided to use a HiveMQ one here: http://mqttdashboard.com/info/broker. There also GnatMQ, but I couldn’t find a freely available version online. Obviously if you productionize this you are going to want to get your own MQTT server going.
  • The Arduino LED pin numbers have changed because the Ethernet shield uses some of the pins I was using before.

As a C#/JavaScript developer it was a big relief to work with the Netduino. It’s nice to be back in Visual Studio and C# and it was great that the M2Mqtt library was available. I didn’t get the Serial version working on Netduino, but that’s not important at this stage because of my wireless goal. I’m going to keep prototyping with the Arduino to see what is possible, but as a long time Microsoft developer the Netduino is definitely preferred. Being able to use nuGet is sweet too.

Here’s what you need to do to build this yourself:

1. Follow the hardware instructions for beakn v0.1

  • Carve out a little more space in the back of the box for Ethernet and Power

IMG_1838

  • For Netduino

  • Wire the pins as follows:* For Arduino

2. Deploy the sketch to the Arduino or Netduino

  • For Arduino

  • Open this sketch in the Arduino IDE.

  • Change both topicName and clientName to something unique. It can be whatever you want it to be. Deploy the sketch to your Arduino For Netduino

3. Install the beakn v0.2 desktop app or get the code here and compile it yourself.

4. Update the beakn.exe.config file.

  • [Only do this if you installed via msi installer] Open CMD as Admin. Navigate to the beakn install directory. Execute “notepad beakn.exe.config”
  • Change the “MqttPairingCode” setting to something unique. It can be anything, but it must match the same MqttPairingCode that you used in your Arduino or Netduino app.

KNOWN ISSUES

  1. beakn will lose the connection if you completely exit Lync. You’ll need to restart beakn.exe if you close Lync.
  2. You must first plug in the ethernet cable, then power when you setup the beakn. The init script runs when it boots and if the Ethernet isn’t there it will jus fail.

That should be all there is to it.

Let me know if you run into any other issues and follow me on twitter to get updates of future version.

Jon

p.s. Just for kicks – I wired up this full size traffic light in my office as a beakn – it’s super bright and very hot!

IMG_1837