While there are many traditional Arduino* libraries that are useful for microcontrollers, there is a lot of functionality to be had with Linux* based targets to take advantage of the additional processing and OS capabilities. This article will show you what libraries are available inside of Arduino Create for Intel®-based platforms running Linux.
How it's Architected
Since Arduino Create* is run entirely in the cloud, your code is compiled on a server (AWS at the time of this writing), then the binary is copied to your board in the ~/sketches folder. The binary is run as root.
Most libraries inside of Arduino Create are statically linked, meaning that they are linked in the Arduino Create cloud. A few libraries (the larger ones) are dynamically linked to the library installed on the target platform, and must be installed manually on the target for that library to be used. For example, MRAA calls do not require that MRAA be installed previously on a board to work (statically linked in the cloud). Intel® Math Kernel Library (MKL), requires it to be installed on the board manually first (dynamically linked).
The current list of available libraries and how they are compiled is listed below:
|Intel® Math Kernel Library
|AWS* IoT Device SDK
|Microsoft Azure* IoT Device SDK
If you’re interested in adding additional libraries, read the section on Adding Other Libraries below. Additional libraries that get added will be statically linked.
Libraries can be added by going to the Libraries tab in the Editor.
I’ll cover a few of the libraries below.
MRAA and UPM in Arduino* Libraries
Arduino libraries now use MRAA as the Hardware Abstraction Layer (HAL) for Linux based platforms. The Arduino C++ API can still be used just like for other platforms, but underneath MRAA does the translation to talk to the hardware. For more information on using MRAA and UPM in Arduino Create see my other article /content/www/us/en/develop/articles/mraa-and-upm-basics-in-arduino-create.html .
As one of the libraries now available in Arduino Create, you can use OpenCV version 3.3.0. It is a dynamically linked library so it requires OpenCV to be installed on your target platform first. For instructions on installing it see https://github.com/intel-iot-devkit/up-squared-grove-IoT-dev-kit-arduino-create/tree/master/examples/OpenCV-Setup . While this tutorial was written for the UpSquared* Grove IoT Development Kit running Ubuntu* Server 16.04, the steps can easily be applied to any system running Ubuntu.
The OpenCV library (Libraries>OPENCV) in Arduino Create comes with two examples: Contours and HelloOpenCV. We’ve also created a People Counter example, which can be found in Libraries>UP SQUARED GROVE IOT DEV KIT>OpenCV-PeopleCounter.
Both the HelloOpenCV and OpenCV-PeopleCounter examples require a webcam. The Contours example does not.
Intel® Math Kernel Library (MKL)
This library is mainly used for data and signal processing. It speeds up matrix multiplication and also includes FFT, filters, and a couple transforms. There are several situations where you may want to use this library for IoT applications:
- FFT of sensor data, in order to process and aggregate data from multiple sensors before sending over the network
- Data analysis, fitting data to mathematical models
- Data compression, taking data sets and creating smaller approximations for analysis or transmission
It is a dynamically linked library in Arduino Create, which means you need to install it on your target platform first.
Adding other libraries
If there is a library you’d like to use, but it isn’t listed, you can import it using the Library Manager in Arduino Create. When you do this essentially the Arduino Create cloud re-compiles the library you uploaded and makes it available inside the Create environment. In general to do this all you do is:
- Find the github repository of the library you want
- Download the .zip from that repository
- Import it into the Library Manager (this can take anywhere from a few seconds to several minutes depending on the size)
Since these libraries are coming from various sources, the best place to file issues for each library is at the following locations: