VIPER, the acronym for Viper Is Python Embedded in Real-Time, is a solution for making your design interactive and connected to the Internet of Things (IoT) easily. The package offers a set of software and hardware tools to seamlessly implement your embedded design ideas, without worrying about actually putting together stuff using solders to make your design work.
The suite is open source and released under general-public licence version 3 (GPL3), Apache2 and Massachusetts Institute of Technology (MIT) licences, depending on the libraries and codes put to use. For commercial usage, their respective websites offer a separate package along with added support. Built to be cross-platform, VIPER is a development suite for high-level design of interactive objects, artistic installations and Internet/cloud-connected devices.
What it offers
VIPER provides a platform for developing embedded designs in Python, using paradigms and features typical of personal computers and mobile programming. It lets you make your object connected and smart with just a few lines of code and almost no wiring.
Multi-board compatibility. Converting your product idea into a prototype can be easily achieved with VIPER, which can run on all 32-bit ARM processors and professional hardware based on ARM microcontrollers (MCUs). It also offers support to do-it-yourself MCU boards like Arduino, UDOO, ST Nucleo, Particle and all Spark products. Creators of VIPER, Things On Internet (TOI), have also come up with their own TOI shield, a multi-sensor board with ready-to-plug communication ports. The shield claims to be a first of its kind, enabling plugging on Arduino and Particle boards without any adaptors. To program using VIPER, you just have to make sure you install the universal serial bus (USB) driver corresponding to your board. The board has to ‘viperised’ before you can use it, and this involves installing VIPER virtual machine (VM) and the required real-time operating system (RTOS) on the board.
A multi-threaded RTOS. Using ChibiOS as the embedded device OS, VIPER permits hardware-architecture-independent design implementation. Implementing multi-threading on top of the OS has brought a new dimension to VIPER. Every VIPER thread is an RTOS thread with a specific priority, and these are synchronised using a global interpreter lock that is released when a higher priority one requests processing.
Elegant handling of peripherals. Abstraction layer of ChibiOS supports basic peripherals like general-purpose input/output (I/O), pulse width modulation (PWM), analogue-to-digital converters, inter-integrated circuits, serial peripheral interfaces, timers, external interrupts, serials and USBs. The required interface codes can be found as modules in Python library. For other drivers, all that is required is C-function that can be embedded in the script. What this means is that, most Raspberry Pi drivers you work with can be easily adapted and ported into VIPER Python scripts.
Libraries for scripting. Useful modules from the standard Python library, like json, math and urlparse, have been ported to VIPER, and these can be used while working with codes. Along with these, VIPER adds a set of built-ins that can be used directly. You can also import modules while working with sensors, shields or even specific ones pertaining to VIPER threads and connections.
Efficient management. Memory and space management are up to the mark with VIPER. With an intentional effort at minimising object space, built-in functions occupy just four bytes, against 16 for a normal one. It implements a novel memory management system and a memory allocator with specialised garbage collector to suit embedded operations.
VIPER converts local and global names to 16-bit integers instead of saving it as strings. While this saves resources spent by the MCU, names information is not available during runtime. Also, for time-constrained functions, you can write the fast code in C and call it from Python script.
Customisability. As the embedded machine being used is virtual, you can customise it to your application. Customisation referred to here is in terms of the number of drivers initialised, functioning of ports, level of optimisation and so on. This results in saving precious flash and random access memory.
VIPER tools. A compiler reads the input code and produces an optimised byte-code that can be understood by the VM. Optimisation here involves saving code objects on flash for direct access and analysing the code for static reachability. A VM builder allows you to configure and create a VM that suits your application better, for better functionality and to help you work within your constraints.
There is also a VIPER Up-linker that prepares the packages required by the VM for executing the expected design. All of these are integrated into the integrated development environment (IDE) to enable one-click execution of the entire process.
The latest release, VIPER 0.2.0.0009, also includes a photon Wi-Fi driver, Adafruit neopixel light emitting diode (LED) matrix driver, an infrared read-and-write control module, drivers for servomotor and thermal printer and an animation module. Inclusion of these additional features promises an enhanced and smooth user experience.
What VIPER Suite is
A comprehensive development environment, VIPER Suite consists of three main components. With the help of these you can easily and quickly design your embedded system and integrate with sensors and the cloud. Let us see each of these components one by one.