MicroFlo: flow-based programming for microcontrollers
Implementation of Flow-based programming for microcontrollers and embedded devices. MicroFlo supports multiple targets, including Arduino, Atmel AVR, ARM Cortex M devices (mbed, TI Tiva/Stellaris), ESP8266 and Embedded Linux.
Unlike most other visually programmable systems, MicroFlo programs runs standalone, does not make use of code generation, can be introspected and reconfigured at runtime, and supports automated testing.
One can program with MicroFlo either:
- Visually, using Flowhub/NoFlo UI
- Textually, using the declarative .fbp DSL or .json definition
- Programatically, by embedding it and building a graph using the C++ API
Minimally useful. Simple programs work, components exists for most I/O on standard Arduino devices. Minimal support for automated testing. Suitable for those curious to play with alternative microcontroller programming models. Probably a bit early to use it for general tasks.
MicroFlo in the wild:
- Jon's fridge thermostat has been running uninterrupted since September 2013.
- The Ingress table at c-base station, Berlin uses MicroFlo to control the lights. One major upgrade/bugfix since March 2014.
- The lights on the CNC-milled Christmas tree at Bitraf, Oslo ran for 4 weeks during Christmas 2013.
Use the Google Group Flow Based Programming or IRC channel #firstname.lastname@example.org. Alternatively, file issues here on Github.
- September 2013, 0.1.0 "The Fridge". First deployment of a Microflo-based device
- November 2013, 0.2.0 "The start of something visual". First version programmable using Flowhub
- May 2014, 0.3.0 "Node in a Node, to infinity". Suppport for non-Arduino platforms, NoFlo integration
- 0.4.0, "Runtime persistable, Introspectable": Uploaded graphs can be persisted to EEPROM, be monitored at runtime, and be composed of sub-graphs
- 0.5.0, "Simulated": One can program and test MicroFlo programs in a simulator, before putting it on device
- 0.?.0, "Generally useful": Most of Arduino tutorial have been, or can easily be, reproduced
- ?.0.0, "Production quality": A commercial product based on MicroFlo has been shipped.
- ?.0.0, "Device freedom": An open source hardware, free software electronics product based on MicroFlo with an integrated IDE allowing and encouraging the user to customize the code has been shipped.
git grep -E 'TODO|FIXME|XXX|IDEA|PERF'
For visual programming your Arduino, follow the MicroFlo for Arduino tutorial. If interested in extending MicroFlo, using it for other microcontrollers, see the next section.
Instructions below valid for
- Arch Linux and Ubuntu (any GNU/Linux should be OK),
- Mac OSX 10.8 Mountain Lion (10.6 -> 10.9 should be OK)
You can however use the Arduino IDE or another tool for flashing your microcontroller.
Note: Mostly tested on Arduino Uno R3 and Arduino Nano R3. Other Arduino devices should however work.
Get the code
git clone https://github.com/microflo/microflo.git cd microflo git submodule update --init # only for old git versions
Install prerequsites: Arduino 1.6 or later Download
To build and run tests
npm install && npm test
To flash your Arduino with the MicroFlo runtime, including an embedded graph:
make upload GRAPH=examples/blink.fbp BOARD=arduino:avr:uno
Now you can use Flowhub Chrome app to talk directly to MicroFlo over serial/USB or use:
node microflo.js runtime
To see existing or add new components, check the files
To see existing or add microcontroller targets, see
Remember to rebuild MicroFlo after changes:
MIT for the code in MicroFlo, see ./LICENSE.
Note that some MicroFlo components may be under other licenses!
- People should not need to understand text-based, C style programming to be able to program microcontrollers. But those that do know it should be able to use that knowledge, and be able to mix-and-match it with higher-level paradims within a single program.
- It should be possible to verify correctness of a microcontroller program in an automated way, and ideally in a hardware-independent manner.
- It should be possible to visually debug microcontroller programs.
- Microcontroller functionality should be reprogrammable on the fly.
- Microcontrollers should easily integrate into and with higher-level systems: other microcontrollers, host computers, and the Internet.
- Microcontroller programs should be portable between different uC models and uC architectures.
- Run on 8bit+ uCs with 32kB+ program memory and 1kB+ RAM
- Primarily as bare-metal, but embedded Linux also possible in future
- For initial component implementations, wrap Arduino/LUFA/etc
- Components that are not tied to a particular I/O system shall have host-equivalents possible
- Take .fbp/.json flow definition files used by NoFlo as the canonical end-user input
- Use NoFlo code to convert this to a more compact and easy-to-parse binary format, architecture-independent flow representation
- Flows in binary format can be baked into the firmware image.
- Allow to introspect and manipulate graphs at runtime from a host over serial/USB/Ethernet.
- Use a binary protocol derived from the binary graph representation for this.
- Allow a flow network to be embedded into an existing C/C++ application, provide API for manipulating
- Port and I/O configuration is stored in a central place, to easily change according to device/board deployed to.