Integrating Flic Smart Buttons with the SMIP
Gregor Vilkner, Ph.D.
Digital Transformation | TimeSeries + Graph DB | Data Visualization | BIM | DCIM | Industry 4.0
1 Smart Buttons for Smart Manufacturing
Flic is a range of IoT products made by the Swedish company Shortcut Labs AB . The product line includes various hub devices and wireless buttons. Although the product is primarily targeting end users and smart home integrations, we believe that low-cost wireless devices such as Flic smart buttons can positively impact brown-field manufacturing. Activities such as counting, indicating of status, signing in and out of workstations, starting, pausing, stopping of production runs can easily be digitized by implementing easy-to-use IoT buttons.
2 Modes of Operation for Smart Buttons
First use cases are limited to simply write a value at a time of a button press to a target attribute. Once we obtain an attribute's current value, however, a number of interesting use cases become possible:
a) Simply write "1"
This would support apps such as an inspection walk. Simply place an appropriate number of buttons at points of interest, and when an inspector passes by the buttons are pressed to log time and sequence.
b) Switch a Boolean On/Off
Switching on/off simply toggles a Boolean attribute. We can use this to control networked devices or to indicate simple alerts or states.
c) Increase or Decrease Count
You can think of the following setup: Single click to count up, double click to count down, click&hold to reset to zero. An interesting use of smart buttons is simply to harvest timestamps. Combined with counts, this could make production time studies more efficient as it would reduce the need of manual note taking. That supervisor with a hand in their pockets: probably harvesting timestamps or busy counting.
d) Toggle Enumeration Forwards/Backwards
If we target enumeration attributes we can use the list of enumeration values to iterate forward (single click) or backwards (double click). Finally, click&hold would be used to submit a new status.
While the first use case would use "none" as interpolation method, the later three use cases would utilize "previous" as interpolation method.
Finally, an exciting product that is not yet supported in the SDK is the Twist Button: it is a button with a turn dial around it. One would use click&hold to change an enumeration value and any of the simple click operations to submit a new state value. Either 4 or 12 dial values are supported. Flick buttons ship with a broad range of example stickers, and one could easily imagine appropriate manufacturing iconography to stick on the buttons.
3 Getting Technical: From Unpacking to Ready for Use
3.1 Getting Connected and Establishing Communication with the SMIP
Control hubs and buttons are super easy to setup and manage using an app on a phone. The Flic team provides a range of api's and SDK's to support custom use cases. We used the web-based hub SDK to create a simple JavaScript module that runs on the hub and subscribes to button click events. First we created a FlicManager type on the SMIP and placed a single instance in our model tree. At this point the FlicManager is a simple type with a single json time series attribute to store messages. We used the SMIP's GraphQL API to:
领英推荐
A few comments on this first step:
3.2 Refactor to Store JWT
Our first iteration was a quick nesting of http requests: a little Pyramid of Doom. It worked, and it had to be cleaned up a bit. Since a module runs on the hub continuously as a service, we pursued two goals with this refactor:
3.3 Mediator on the SMIP to Manage Buttons and Push to Attributes
At this point our hub continuously executes a stable runtime of our module in a steady fashion: no matter if you are clicking buttons in the morning after several hours of idleness or if we test random power cycling of the hub - events simply show up in the SMIP. This is a great milestone, because it means that we store and reliably rotate JWT's and that we always have a valid target attribute id. Time to leave the hub alone for a bit, move over to the SMIP, and figure out what to do with the events... We put three things in place to distribute events in the SMIP:
In addition to receiving messages reliably on the FlicManager's messages attribute, we now also distribute messages across our model according to mappings managed by a display script. The only drawback is that "periodically" means "once per minute polling". Let's think if we can get the click events where they should go more efficiently.
3.4 Push Events directly to Attributes
One thing we put into the Flic JS module right after obtaining a JWT and before posting a click-event message is to lookup the "target attribute id". What if we could retrieve not only the target attribute id for all messages, but also a FlicMapping, if available for a single/double/click&hold event for a particular button? Turns out we can do just that using a single query using the SMIP GraphQL API. So, in addition to pushing all click-events into the FlicManager's messages attribute, we also push messages directly into a mapped target attribute, if such a mapping exists. This has been in place for a while now and works really well. It also effectively renders the mediator mute and unnecessary.
Curiosity hurt the cat, Satisfaction brought it back.
4 个月Spectacular write up as always.
Cofounder of Shortcut Labs AB
4 个月Very cool, great work!
Advisor Digital Mfg / Smart Factory
4 个月Works great, highly scalable and delivers value across a wide variety of connected worker applications!
Advisor, doer, and experienced board member. Making manufacturers more profitable and sustainable.
4 个月Great job,?Gregor.?Nothing beats a person who knows what needs to be done, knows how to do it, and can share the results.
Smart Manufacturing and Industry 4.0 Leader
4 个月Great work, Gregor Vilkner, Ph.D. - this will bring a simple but powerful tool to the plant floor for digitization.