O’Reilly Solid: Hardware, Software, & the IoT

Rachel Bennett
  

Rachel Bennett

July 27, 2015

O’Reilly describes their Solid conference as “hardware, software, and the IoT.” In other words, a perfect fit for Kinoma, and an ideal venue for introducing new prototyping hardware products and our implementation of JavaScript 6th Edition. Our favorable impression of Solid from Year 1 made it an easy choice to sponsor this year, June 23-25 at the Fort Mason Center on San Francisco’s waterfront.

Screen Shot 2015-07-23 at 7.23.26 PM

Introducing Kinoma Element and Kinoma HD

Our booth featured demonstrations of our new hardware product prototypes, Kinoma Element and Kinoma HD. The main demo on display was a Smart Life, Smart Lifestyle Hub, which runs on a large HD display via Kinoma HD and is driven by data collected and sent from Kinoma Create and Kinoma Element.

alternate-family-layout

The demos connected to the Hub:

  • Climate Sensor: a temperature and humidity sensor attached to one Kinoma Element placed at the far end of the booth. When the temperature or humidity changes (for instance, when the device was held in hand), the readout on the display ratchets up. The Climate Sensor uses I²C for communication between the sensor and Kinoma Element, zeroconf discovery for Kinoma HD to find Kinoma Element, and HTTP for information sharing between them.
  • Gesture Sensor: a hover board attached to Kinoma Create, taking readings of the direction of a hand movement. When a hand moves right to left, for example, that data is sent to the Kinoma HD and the large-screen app animates a hand right to left. Simultaneously, Kinoma HD sends the sensor data back to a second Kinoma Element that has an 8×8 LED matrix attached which then animates an arrow pointing to the left. The Gesture Sensor uses I²C to communicate between the hover board and Kinoma Create, I²C to communicate between the LED matrix and Kinoma Element, zeroconf for device discovery, and WebSockets for cross-device communication.
  • Air Doodle: a game that allows the user to doodle in midair by holding and manipulating a Kinoma Create, with the resulting drawing displaying on the Kinoma HD screen. Input on the Kinoma Create is captured using a 3D accelerometer, a potentiometer, a button, and the touch screen. Air Doodle uses analog input for the 3D accelerometer and potentiometer, digital input for the button, zeroconf for device discovery, and WebSockets for communication between Kinoma Create and Kinoma HD.

Screen Shot 2015-07-23 at 5.00.10 PM

Kinoma’s JavaScript 6th Edition implementation

A key part of our presence this year was announcing our implementation of JavaScript 6th Edition—the most complete—and what this means to the growing Kinoma developer community building the IoT. We are bringing JavaScript to the smallest devices ever.

It was exciting to unveil the growing family of Kinoma solutions for developers, especially to such knowledgable attendees. The majority of people who came through the Kinoma booth were from IoT product development agencies, design labs, consumer electronics brands, and companies from a range of industries (including media and automotive) exploring their IoT future.

Media

O’Reilly Solid was a good opportunity to share our news beyond the event. Thank you to all the member of the press who spoke with us about our news, views of IoT, and thoughts for what’s ahead.

Screen Shot 2015-07-23 at 7.40.52 PM

Panel participation

Kinoma is still called on to discuss crowdfunding due to our successful campaign for Kinoma Create, our approach to crowdfunding while part of an established company, and our reasons for taking to crowdfunding. Peter Hoddie participated in the panel, “Indiegogo: The feedback channel for your new hardware products,” hosted by Kate Drane of Indiegogo.

CIX3CZkVEAA5V1a

Thanks to everyone at O’Reilly Solid for making this such a great event. We look forward to Year 3!

Solid logo cropped



Kinoma at O’Reilly OSCON: Open Source Meets Hardware

Rachel Bennett
  

Rachel Bennett

July 17, 2015

Kinoma is headed to O’Reilly OSCON next week, to give attendees a hands-on experience of open source prototyping solutions for IoT innovators. OSCON is O’Reilly’s largest event of the year, and takes place at the Portland Convention Center July 20-24.
oscon2014_logo

Hardware Showcase

We’re delighted to have been invited to the Hardware Showcase. O’Reilly recognizes the innovation taking place in open source for hardware, and is assembling a dozen hand-picked companies to exhibit in the Hardware Showcase. Our demo will focus on the recently introduced Kinoma Element and Kinoma HD.

Kinoma Element is the smallest JavaScript-powered embedded prototyping platform that’s endlessly configurable with a pair of eight pin expansion ports, and always Wi-Fi connected—ideal for prototyping embedded devices poised for mass production. Kinoma HD is the thumb-sized stick that turns HDMI screens into Wi-Fi connected, JavaScript programmable displays for visually rich content that can interface with IoT products, mobile devices, the cloud, and web content.

alternate-family-layout

As we do with Kinoma Create, we plan the following for Kinoma Element and Kinoma HD:

  • Publishing the complete PCB design files, including the parts list.
  • Publishing the 3D design files for all parts of the product, used by developers to design and print custom enclosures so prototypes reflect their project vision.

Additionally, since OSCON 2014, we have fully open sourced KinomaJS, the application framework used by developers to build the core applications of embedded devices prototyped with our hardware products.

KinomaJS-logo-final

The Hardware Showcase is a dynamic, rotating roster of companies. You will be able to find a Kinoma table during the Reception Tuesday July 21st at 5:00pm; during Expo Hall hours Wednesday July 22nd 12:20pm – 2:40pm, and 2:40pm – 5:00pm; during the Booth Crawl Wednesday 5:40pm; and during Expo Hall hours Thursday July 23rd 10:00am – 12:20pm, and 12:20pm – 2:40pm.

Closed devices powered by open source software? The IoT Paradox.

Peter Hoddie will be giving a talk titled, “Closed devices powered by open source software? The IoT Paradox.” on Thursday July 23rd at 4:10pm.

The idea that you should be able to modify the software on your computer as much as your technical skills allow is at the foundation of the free source movement. Why should it be different for IoT products, purchased and installed with high hopes for interoperability? These products are developed with open software and standards, after all.

This talk will explore ways to steer IoT back toward openness and interoperability in hardware and in software.

To book meetings with the Kinoma team at O’Reilly OSCON, please email pr@kinoma.com.

We hope you can join us in Portland.

 

 


Language matters.

Peter Hoddie
  

Peter Hoddie

June 24, 2015

Do computer languages really matter? Any good computer science student can make the argument that most of them are roughly equivalent. But any experienced coder can explain why they consistently chose certain languages for certain tasks. The choice of language matters. It isn’t a matter of theory, it is a matter of practical engineering.

No less an industry legend than Steve Wozniak explained that a defining characteristic of the original Apple Computer was the choice of programming language:

I sniffed the wind and knew that the key to making my computer good (popular) was to include a high-level language and that it had to be BASIC. Engineers programming in FORTRAN were not going to be what would start a home computer revolution.

Screen Shot 2015-07-14 at 4.57.01 PM

Different operating systems have different computer language preferences. Different industries have their preferences.

For a long time now, what we now call the IoT industry, has worked in C, occasionally allowing itself to dabble in C++. Those embedded products typically didn’t connect to a network, or did so in very limited ways. But the Internet is embedded in the name of IoT; embedded products have no choice but to embrace the Internet. To do that, the language needs to change. On the browser, JavaScript is the only language for communications. On servers, JavaScript is a popular choice thanks to node.js, but more broadly scripting languages have dominated for years, from Perl to PHP to Python to Ruby to the more esoteric Erlang.

imgres

Scripts win because they are easy to write, easy to read, and fast to modify. There’s no question that the scripting language with the most momentum in the last decade is JavaScript. And just this month (June 2015) the most significant update to the language has been ratified. Formally known as ECMAScript Sixth Edition or ECMAScript 2015, and informally known as ES6, JavaScript 6th Edition brings the most significant changes to the language since it was introduced in the early days of the Web.

IoT is a revolution. In the next few years, our industry is going to try to connect just about everything to the network. As with the personal computer revolution that Woz propelled forward with BASIC, the IoT revolution needs its high level language to supplant the language of the last generation. And with the advances in JavaScript 6th Edition, that language will be JavaScript. Engineers working in C will be hard pressed to match the speed or creativity of an engineering working in JavaScript.

JavaScript 6th Edition

Work on JavaScript 6th Edition has been going on for years. It involved the efforts of an incredibly skilled and insightful group of engineers collaborating on finding the best way to improve the language. The full specification is huge (nearly 550 pages), and marvelously detailed. Even if you aren’t a computer language fanatic, it is worth a look just to appreciate the precision and attention to detail.

E

The Kinoma team has been monitoring these efforts, knowing that one day we would need to support the language changes. Because we have implemented our own JavaScript engine, XS, adopting a new version of the language means that first we have to update XS. Once that’s done, we can migrate our JavaScript code to take advantage of the new features.

As work on the language stabilized in late 2014, we decided we should begin work on updating XS to support JavaScript 6th Edition. It was inevitable that we would need to support it. Better to do that sooner than later. Because we started early, we had the luxury of time to write and rewrite support for the new features in XS. Because the changes to the language were so significant, we had the opportunity to revisit everything about our JavaScript virtual machine. The result is a considerably faster runtime, that has smaller runtime memory requirements, and excellent compatibility with the JavaScript specification.

What makes JavaScript 6th Edition important for IoT?

By one count, there are about 400 different changes in JavaScript 6th Edition. Each developer will have their own personal favorites. From an IoT product development perspective, these are the features that have made us so enthusiastic:

  • Modules. Modules are now an integral part of the language, rather than a feature added by individual runtimes (like node.js has done so successfully). A single module interface will make sharing and re-using JavaScript code considerably easier. Modules are fundamental to building large-scale systems. When JavaScript was invented, most scripts were just a few lines so long there was no need for modules. But with IoT products that are expected to speak multiple network protocols, connect to dozens of different devices, and connect to an ever changing landscape of web services, modules are a necessity. They are a fundamental tool for minimizing code dependencies.
  • More concise. There have been numerous additions and enhancements to the JavaScript language syntax that reduce the amount of code developers need to write. Common coding patterns that used to take several lines of code are now just a few characters. It is a well documented that the number of bugs in a code base increases with the size of the code base. JavaScript 6th Edition reduces the code.
  • Classes. JavaScript uses a prototype-based inheritance model, which is extremely powerful but unusual. It has often confused programmers coming to JavaScript from languages with more conventional inheritance. With support for classes, JavaScript maintains its prototype-based inheritance but adds a more convention syntax for working with it.
  • Faster. By moving features commonly implemented in scripts into the language, JavaScript 6th Edition has the potential to execute faster.
  • Promises. JavaScript is, by its nature, a single threaded language. To implement asynchronous behaviors, developers have used callbacks. This works, but the code can quickly become a challenging cascade of nested callback functions. Promises are an elegant way of implementing callbacks efficiently.
  • Generators. Generators are a simple mechanism that provides something between cooperative multitasking and streams for JavaScript. They are a little tricky to understand, but we are already seeing how they can considerably simplify the APIs for common operations.
  • Symbols. With the formal introduction of modules, there is a need for modules to attach private data to an object. In the past, code has attached properties with random names to objects to get close to private data. The Symbols object in JavaScript 6th Edition provides true anonymous symbols. Symbols have other intriguing uses as well, which remain for us to explore.

And those are the high points of the language from the Kinoma team’s perspective. There’s more still.

Conformance with the standard

At this point, you may be wondering how many of these features will be available to developers working with KinomaJS? As of this writing (June 23, 2015) most of them. Getting a perfect measure of language conformance for JavaScript 6th Edition is challenging because the language is so new that the formal conformance tests are not yet complete. The most complete language test is the Kagax ECMAScript Compatibility table. Based on those tests, XS6 is at nearly 96% conformance. The next closest engines are at 71% and 66%. You can see our detailed results here.

We’re pleased to have an early head start in implementing JavaScript 6th Edition. We have every confidence that the other engines will catch-up in time. As additional conformance tests become available, we will continue to refine our implementation to be as compatible as practical.

js6-adoption-kinoma_720

Optimized for IoT

Support for the standard is a starting point. There is a great deal of space to innovate around the standard. While most work on JavaScript is concerned with optimizing for the browser or web servers, our focus is on adapting JavaScript for embedded products, to help build better IoT products. Here are some of the areas that the XS6 implementation of JavaScript 6th Edition are optimized for IoT:

  • No JIT. Most JavaScript engines today use a JIT (just in time compiler) to run scripts as fast as possible. JITs do execute scripts spectacularly fast. However, the JIT has to compile the script to native code, which takes time and uses considerably memory. And, due to the dynamic nature of JavaScript, a good JIT is incredibly complex, which means it requires a lot of code. XS6 is pure byte code interpreter. This keeps the runtime small and simple, much more appropriate for memory constrained devices. The IoT developer can code native functions for performance critical functions, so the overall result is fast.
  • Fast runloop. For any interpreter, the runloop is among the most performance critical pieces of code. In XS6, the runloop is optimized in several ways. It is implemented in C, not C++, to minimize runtime overhead, and to keep key state in registers. The byte code instruction dispatch uses labeled C instructions (a so-called threaded dispatch). It avoids recursion on function calls, so a JavaScript function call does not require a C function call, minimizing the native stack and jumps. Further, the XS6 runloop contains inline assembly code for key operations when running on ARM processors. The result is fast, small, portable, and maintainable.
  • Modules. XS6 fully supports modules, and extends it one important way. The module specification defines how to load a module, but makes no provision for unloading a module. On a memory constrained device, that can create a problem as there may well not be enough memory to hold all modules in memory simultaneously that a product uses. XS6 adds a special version of the require function to indicate that a module is eligible for unloaded. The require.weak function loads a module in such a way that when the module is no longer referenced, the garbage collector will automatically unload the module This small addition allows XS6 to significantly reduce the memory requirements of many programs, so they can be run on devices with considerably less memory.
  • Tools. In addition to its JavaScript runtime, XS6 also has a few command line tools. The xsc tool is an offline JavaScript compiler that turns program and module source code into bytecode. xsc has some optimizations built into it, that simplify the byte code deployed to the target device. We expect to expand these optimizations in the future. The xsl tool is the archive utility for XS6. It takes the byte code from multiple programs and modules and links them together in a single archive for deployment. XS6 is able to run code directly from the module, without further loading or linking at runtime. This significantly improves application start-up and module loading time (as much as 4x), and allows byte code to run directly from flash memory (execute in place, e.g. XIP) which reduces RAM usage.
  • Debugging. Eventually, everyone writes code that has a bug. XS6 includes a network debugging protocol that allows source level debugging on most any device XS6 runs on. Because the debugging protocol operates over a TCP connection, remote debugging is always an option. The Kinoma team maintains a GUI XS6 debugger for Mac OS X, Windows, and Linux/GTK.

How little memory?

XS6 contains many optimizations specifically related to reducing memory usage. The total impact of that is considerable. We are able to run nearly the full JavaScript 6th Edition language on a microprocessor (Marvell MW302) that has only 512 KB of RAM. That half megabyte of memory holds the FreeRTOS operating system, networking stack, all dynamic data, and all JavaScript data. On that system, over half the memory is available to scripts. We will provide more detailed memory figures as in the coming weeks. Compare that to a typical JavaScript engine that has been optimized for the browser or a web server, where minimum memory requirements are measured in megabytes, if not tens of megabytes.

There’s no question that operating on a constrained memory device requires discipline. There’s no magic. For example, taking care to split code into modules, and using require.weak to allow unused modules to be garbage collected, makes a big difference. XS6 makes it practical to use JavaScript 6th Edition on embedded devices. As with any engineering task, it requires some knowledge, practice, and care.

The language of IoT

There’s no other programming language today that has as much activity as JavaScript. The work to standardize and evolve the language are unmatched. Work has already begun on the 7th Edition, which looks to improve performance even further. Because of the broad use of the language, specialized efforts, like that of the Kinoma team on XS6, are helping to make JavaScript applicable in more and more places.

This isn’t to say that C is going away. A script will never beat well-optimized C code. For performance critical code and for binding to native platform features, C will continue to dominate. But for more and more application code, networking code, and even hardware interface code, JavaScript is going to be the right choice.

There was a time when JavaScript was the awkward new language. No one was quite sure what to make of it, or whether it would endure. Those days are past. Any developer serious about building IoT products should give JavaScript a hard look. As James Governor of RedMonk observed back in 2010

Try it

If you are find yourself at O’Reilly OSCON in Portland next week, stop by the Kinoma table in the Hardware Showcase. We’ll be showing XS6 powered devices running JavaScript 6th Edition. We’ll have Kinoma Studio, our IDE for KinomaJS development, with XS6 integration, so you can try out the new language syntax. We have also built XS6 Intro, a KinomaJS application that explains many of the JavaScript 6th Edition features with source code examples you can run and modify in real time. xs6-Intro-screenshotWe’ll be making a preview of our JavaScript 6th Edition support available at the end of this month. That will include an update to Kinoma Create and Kinoma Studio so you can begin working in JavaScript 6th Edition. We’ll also post XS6 to our GitHub repository.    


Frigo Magic: the App a Cook & Developer Made

Sebastien Burel
  

Sebastien Burel

June 22, 2015

Frigo Magic is a smartphone application developed to help young French people cook recipes based on the ingredients they already have at home.

The current version is free and accessible worldwide in both the Apple App Store and Google Play Store.
Screen Shot 2015-06-11 at 9.59.08 PM

Screen Shot 2015-06-15 at 10.15.47 PM

Making our app with Kinoma software

The application prototypes and first version (App Store only) were done with Apache Cordova, a platform for building native mobile applications using HTML, CSS and JavaScript. The server part was also built using Apache Cordova. The result was great on my iPhone 6, but terrible on older phones. That was mainly due to rendering in HTML. I used a lot of CSS transition between screens, and that required a good OpenGL implementation.

During the same time, I built a simple project with Kinoma Create by using a barometer sensor and pushing the result to connected server. I’m a former Kinoma engineer and a big fan of Kinoma Create.

When Kinoma open sourced the full KinomaJS tree in March, I conducted tests on iOS and Android. I got some very good results in terms of development speed and performance.

KinomaJS-logo-final

I tried to code (only JavaScript) the same transition that wasn’t working well with an older device. The result was much better than Cordova. I got about the same transition on an old iPhone 4 as on the latest iPhone 6 (certainly with a slower frame rate, but it was working great).

I tried the Android version (with no code change, just the build) and got the same good result.

By the beginning of April, I decided to move Frigo Magic from Apache Cordova to KinomaJS. It took me less than three weeks, in part because the UI development was really easy. I wrote my own plugin to implement access to some internal data (iOS/Android version, UUID, Token…) and to implement a SQLiteDatabase (I was using WebSQL with Cordova).

The experience was great. The second version of Frigo Magic (1.1), was published in both the Apple App Store and Google Play Store at the beginning of May.

Though the KinomaJS documentation is sparse in places, it is easy to figure how to code stuff, especially searching through Kinoma Create samples. The only problems I encountered were due to the use of Ant and CMake which are somewhat difficult to understand and to follow.

Version 1.3, and what’s next

Version 1.3 of Frigo Magic is now in the app stores, and it implements Facebook login (using KinomaJS webview) and Google Analytics API.

One of my next goals is to run webkool inside a KinomaJS app, but we are currently focused on developing the Frigo Magic business.

Recognition for Frigo Magic

It’s been going well! We were honored to participate in TEDxRennes, presenting our work on Frigo Magic.

Frigo Magic at TEDx

We’ve received great media coverage, including articles in Goûts d’Ouest and 20 Minutes.

Screen Shot 2015-06-17 at 11.46.12 AM

And we’re gaining followers on Facebook.

Frigo Magic banner

The app is localized only in French at this time because recipes and ingredients are cultural. We would need to partner with others who know cooking in other cultures in order to build recipes for countries beyond France.

Small & mighty team

One last thing: we are only two people running Frigo Magic. Christophe is the cook, and I am the developer.

Frigo-Magic-4-398x266


 

Christophe Boisselier is a wine consultant to businesses and individuals, provides instruction at Faculty of trades Ker Lann for those entering the sommelier profession, provides introduction to wine tasting at the Atelier des Chefs in Rennes, and advises Wine Fair Centre Leclerc. He has worked as sommelier for multiple Michelin starred restaurant, was the main sommelier of Alain Passard (L’Arpège), was named Best Sommelier of Britain 1987, and Sommelier of 1990.  

Sébastien Burel has 20 years experience in the Internet sector, with a focus on API-centric web app technology, and developing apps for connected devices. He’s versed in HTML, CSS, Javascript, C, and SQL. Sébastien also identifies as a Server Architech and Database Designer. Before co-founding Frigo Magic with Christophe, Sébastien founded haruni.net, co-founded CornerNews Corp, and more.



Kinoma Studio Update — Full Linux Version, and More

Jared Kaplan
  

Jared Kaplan

June 19, 2015

Kinoma Studio Version 1.3.41.3

This week, the Kinoma team released a new version of Kinoma Studio, our Eclipse-based IDE. Many of the updates are a direct result of developer community input.

kinoma_studio_logo-high_contrast

Linux support is now complete

This Kinoma Studio release contains full Linux support that is fully functional and tested. This update is a follow-up to our preview of the Linux update earlier this year. We released the Linux preview and asked you, the developers, to try it on your system and tell us about your results – good news, problems – anything you encountered.

As much as practical, it shares the same capabilities as Kinoma Studio for Mac and Windows.

Two additional updates

This latest release of Kinoma Studio also includes:

Improved sample installer – Install apps directly from our Github repository (and provides the latest updates to sample apps).

system_installer_smaller

Improved profiler UI – This makes it easier to profile apps directly from the application.xml editor screen.

Untitled 3

Here’s a video of the improved profiler UI in action:

Getting the latest version

For current users, Kinoma Studio will automatically update the next time they open the IDE. For new Kinoma Studio users, the update will automatically apply to the new download.

For questions on compatibility, preparing your system for Linux, or installing Kinoma Studio for Linux, post your questions in the Kinoma Studio section of the Kinoma Forums.

 

Jared Kaplan is Senior Staff Software Engineer on the Kinoma team. His mission is to help software developers, designers, and end users realize their ideas in the most efficient, enjoyable way possible. He does this by providing a rich complement of integrated tools for creating software, regardless of its underlying complexity. Jared brings this focus to Kinoma Studio, making the Kinoma software platform more accessible to developers with an intuitive IDE.