Welcome to the second of a three-part blog series, kicked off last week by Rajeev where he reviewed TIBCO’s IoT strategy. In this blog, I’ll spend some time focusing on Flogo, the open source project and our newly introduced edge app support. Let’s get started, shall we?
Two weeks ago at TIBCO NOW in Berlin, we launched Flogo Edge Apps. I had the pleasure of demonstrating the concept during the keynote session, and the demo went off without a hitch! Essentially, I built an app in Flogo and showed it running on an Arduino Feather. Wait, what? A Flogo app running on an Arduino Feather?
What is a Flogo Edge App?
We’ve introduced the concept of application profiles within Flogo, that is, when creating a new app you may now specify whether or not your application is to be built targeting a device (or micro controller) or the traditional, Go-based Flogo runtime engine. Each device profile has a specific set of activities and triggers that are supported for the target device, and thus, we also have a contribution model for device activities and triggers, but more on this later.
With Flogo Edge apps, you can build applications leveraging Flogo’s zero-code development environment to produce feature-rich apps targeting the tiniest of microcontrollers in a matter of minutes, as opposed to hours or days if you were coding in C/C++. Of course, you also have the option of crafting your Flogo flow json representation by hand, using your favorite IDE, as well.
When I say tiny, I mean tiny, we’re targeting apps for devices with chips such as an ARM Cortex-M0, which as you may (or may not) know, the M0 is quite limited with resources, the ATSAMD21G18 has 32K of RAM and 256K of flash. To put this into perspective, the total flash size, including wifi, MQTT headers, and the app I demonstrated during the keynote was roughly 48K in size. Consider the following diagram (thanks for the diagram, Rajeev!)
Okay, to answer the topic question more directly, a Flogo Edge App is a Flogo application (or flow) that can be compiled down to binary to run on the tiniest of microcontrollers, enabling app devs to implement logic and enable a pub/sub model for sensor telemetry. Some of the key features include:
- Integration capabilities on the microcontroller: Integrate microcontrollers with backend systems via messaging patterns, such as MQTT or CoAP, etc.
- Take action on the device: Model your flow using branches with conditional logic. For example, if the temperature of a connected sensor reaches a specific threshold, take an action on the device.
Why is this different or unique?
Flogo Edge Apps were introduced to enable a full spectrum of IoT app development leveraging the same framework regardless of deployment target. The vast majority (all?) of other IoT app development frameworks typically focus on the larger footprint IoT gateway, or put more simply, target general purpose computers! While Node.js is a fantastic server-side framework, it is clearly not an ideal solution for resource-restricted environment, such as IoT gateways. That said, Flogo is uniquely positioned, as stated, to offer a similar experience for developers targeting microcontrollers, as well as resource restricted IoT gateways.
From a development perspective, consider the following flow. This is flow is designed to target an Arduino Feather. While the trigger and some of the activities are unique to edge apps, the flow is modeled the same, regardless of the deployment target.
The flows are identical from a flow developer perspective, obviously the activities and triggers are purpose-built for microcontrollers. We’ll discuss the activity and trigger contribution model in more detail in the subsequent section.
Making the edge smarter
A broad statement, no doubt and probably something you’ve heard before! I’d like to introduce the idea of a multi-phased approach at making the edge ‘smart’. Obviously smart in a very subjective term, but bear with me.
We began by enabling edge gateway devices, which are essentially, as said previously, just general purpose computers, with slightly less resources than a typical laptop. We enabled these edge gateways to gather telemetry from sensors and other devices connected via BLE, MQTT, CoAP, and perform logic, much of this logic focused around conditional checks, and maybe some aggregation. We’ve also enabled these gateways to easily and quickly integrate with other apps and cloud services.
With Flogo Edge Apps, we’ve taken this concept a bit further, we’ve moved the conditional logic to the device enabling devices to autonomously take action. We’ve enabled app developers to implement this logic in a zero-code fashion, which brings an entirely new set of app devs to the IoT space.
The next phase of intelligence was briefly mentioned in last weeks blog post by Rajeev, which will focus on AI and the execution or supervised and semi-supervised models at the edge, truly enabling an intelligent edge.
Flogo Edge App architecture
A picture is worth a thousand words, or so they say. Consider the following diagram depicting Flogo Edge Apps alongside traditional Flogo apps and where you could deploy Flogo across all of your edge devices.
The above diagram is a bit on the generic side, and what I really wanted to express are the truly unique capabilities to run apps built in the same development environment across gateways and edge microcontrollers, enabling you to develop Flogo apps for full spectrum of edge devices.
Flogo Edge Apps: A purpose-built application compiled to native flash binary for the target device. Includes app logic only.
Flogo: The traditional Flogo Go-based runtime environment. Includes the Flogo binary and runtime engine, as well as unique, edge-native features such as the Flogo State Service and Flogo Flow Service. More on the unique edge-native capabilities in a subsequent blog post.
Today, Flogo includes a robust and flexible contribution model for developers to contribute custom activities and triggers to the runtime. The activities and triggers can be installed via the CLI or the WebUI and leveraged just as you would any other Flogo activity or trigger. We’ve extended the contribution model to support activities and triggers for Flogo Edge App. Activities and triggers for Flogo Edge Apps are slightly different than those for the Golang-based runtime, as we’re targeting a different runtime platform and apps may require very specific triggers or activities, based on the sensor or device you’re attempting to work with. For example, not all sensors act the same. Consider a temperature sensor; fetching the readings may differ across different physical sensors.
Implementing an activity or trigger is quite simple, we’ve defined a very clean model for defining the metadata, that is, the name, inputs/outputs, etc. The code implementation is added to a single Eval method, which is used to produce the device specific code.
I am incredibly excited to share Flogo Edge Apps with the open source community! I truly believe this is a game changer and will open up the world of IoT development to a much larger audience! To get started, the Flogo Edge App CLI (flogodevice) and the contributions are in our GitHub repos under a device branch. We’ll be looking to merge the functionality into master within the coming weeks… Stay tuned!