You often hear that to work with graphic displays on the Arduino platform you need to use a Mega or other high-performance board. I got curious about how much you can actually get done on an a measly Uno and similar boards based on the classic ATmega328P. You can find the ongoing results on my wiki.
With the mainstream shift away from desktop to mobile devices, it seems the relevance of open source ecosystems is diminishing. The two major mobile OSes have a very effective grip on the mobile OS space, and they have engendered app models that do little to encourage or motivate open source designers and developers. So now might be a good time to remind ourselves of some of the benefits that open source confers.
One benefit I am considering increasingly is the control open source projects give communities over their experience and priorities. In particular, in the current context of mainstream device use there’s little room for economically disadvantaged voices. Where the entire raison d’être of a platform is monetization (which applies to both mainstream mobile platforms, though they go about it differently), lack of economic might translates directly to lack of impact.
The marginalization of limited income impacts everything from design (personas taken from the developing world aren’t likely to appear on a design team’s list) to implementation (everyone has a recent, fast device, right?). Open source projects empower communities to develop solutions tailored to their own needs, independent of their monetization potential or other considerations. So, no matter your role in society, if you want help establish more equity in the world, then please support open source!
In spite of some valiant efforts, I very much doubt that a mainstream mobile OS that is truly open for users will not become a reality anytime soon. The next best thing we can do is focus attention on open source apps. In future posts, I will try to discuss some mobile open source projects that work well enough to replace popular proprietary and/or monetized ones. But for now, if you are on Android you can check out F-droid: the go-to store for open source mobile apps. Many of these projects are eager for contributions from designers and developers. But even your simple act of using an open source app helps to establish and promote it.
Now I wasn’t the first or only person to think this by any means, but the idea of using Web technologies to build desktop apps didn’t really begin to gain much traction until fairly recently. Frameworks like NW.js and Electron, on which GitHub’s Atom and Microsoft’s Visual Code are built, do just that. But they’re not not quite the same thing as what I had in mind: implementing an app as a server that all sorts of different kinds of UI clients might interact with, including those built with Web front end technologies.
Here’s what I mean. Below is a diagram of what Electron and similar frameworks do:
In this model, the user interface is rendered inside a dedicated environment provided by the framework using whatever HTML, CSS, and front-end JS frameworks you desire. The UI is tightly bound in a one-to-one relationship with the app engine. The app engine is implemented with a Web back-end language, typically Node.js, and it makes system calls through the engine’s baked-in features or, if the baked-in features don’t do what you need, through generic child_process.exec()-like calls that then invoke custom functions written on the host.
What I’ve got in mind looks like this:
In this model, the tight UI↔app engine binding is replaced by a flexible REST API binding, and the app engine is simply a REST server embellished with whatever libraries are needed for accessing the required host resources.
The UI can be implemented with any kind of client that can speak the API, including HTML/CSS/JS clients, native mobile clients, terminal clients, etc. The REST server can be implemented in any language on which a REST server can be built. Thus the language the “app” is written in can be one that most easily supports the necessary system interactions or is otherwise best-suited to the app’s requirements. Also, unlike the conventional architecture, the client need not be local, which makes remote-controlled apps almost trivial to implement. As with any network-based communication, adequate measures must be taken to assure secure communication with the REST server.
So a few vacations ago, I set out to see whether this approach was actually workable. Because I have a high threshold of abuse, my test case wasn’t going to be some self-contained desktop app. Instead, I created a mini research project to study this architecture in the context of real-time control of a physical appliance. (In reality, this was relevant to some other research I was doing. My tolerance of abuse had little to do with it.) The appliance I decided to prototype was an audio preamp with screen-based control.
This is where I ended up:
It’s not much to look at, but there’s a fair amount going on under the hood — which I’ll talk about in a future post.
I am cautiously optimistic about the recently announced resolution of conflict between Arduino LLC and Arduino Srl. Back when the issue flared up, I took sides based on the information I had available, but I then decided to refrain from public comment as additional information on the issue did not seem to be forthcoming.
While I am hoping this announcement means a lovebath for everyone, I am concerned about some of the wording used in the announcement, specifically that, “The newly created ‘Arduino Holding’ will become the single point of contact for the wholesale distribution of all current and future products, and will continue to bring tremendous innovations to the market.” Does this mean that Arduino will shift its focus toward for-profit and more closed designs? In other words, will the hardware arm of the project maintain the project’s fully open culture? There have been signs that things have been closing up on the software side as well since Arduino LLC seem to be be in no hurry to answer questions regarding whether the code for their new SaaS IDE will be open sourced or not.
Hybrid applications seem to be gaining traction now. In what follows, I’d like to present thoughts on an alternative to the emerging standard hybrid app architecture.
The conventional hybrid architecture
In this model, which to the best of my knowledge is used by Electron, NW.js, and others, the user interface is rendered as HTML using whatever HTML, CSS, and front-end JS frameworks you desire. The use of Web technologies for the UI is an explicit goal of this architecture.
The UI is tightly bound in a one-to-one relationship with the app engine.[^1] The app engine is implemented with a Web back-end technology, typically Node.js. The app engine makes system calls through the engine’s baked-in features or through generic child_process.exec()-like calls. This means custom and platform-specific behaviors that the app may require will need to be implemented as external child_process.exec() callable units.
This architecture does a good job of leveraging Web technologies to create secure conventional desktop apps. In addition, frameworks like Electron and NW.js have matured to the point that developing hybrid apps that use many desktop app conventions is relatively easy.
An alternative hybrid architecture
In what follows, I present what I believe is a more flexible approach to developing hybrid apps—one that requires more carefully considered design but that yields greater flexibility.
In this model, the tightly bound user↔app engine connection is replaced by a REST API. Thus the app engine becomes a REST server, possibly embellished with some needed superpowers for accessing host resources. When the app interface is API driven, any REST client technology can be used for the interface, including HTML/CSS/JS clients, native mobile clients, terminal clients, etc. In addition, the client need not be local, making remote-controlled apps almost trivial to implement. Adequate measures must be taken to assure secure and authorized communication with the REST server.
The other change in the above model is that the REST server is implemented in C++. When this is the case, interacting with the host system can be done directly using a wide range of C++ libraries written for this purpose. The choice of C++ here is somewhat arbitrary; it can be any language that supports ready-to-roll support for the system manipulations that your app requires.
The two changes outlined above are decoupled—meaning that either can be adopted in the absence of the other.
One downside to using C++ (or Java, or Python…) for the server part of this approach is that the server must be able to run on the host platform. This isn’t a significant issue with desktop deployment: only recompiling the REST server for each target platform will be required. But it does currently present a problem for mobile deployment as few mobile platforms provide native support for C++ and its oft used libraries. If you plan to target mobile apps, implementing a REST server in a more universally supported language will likely be required.
It’s a little early and so I may regret posting this, but I will do so anyway.
The Verge today is carrying a piece by Walt Mossberg that argues nothing is really open or really closed so, meh, don’t worry about it y’all ok? Because AppleGoogleMicroplex has your back.
His premise is that the debate between open and closed involves a false dichotomy because the terminology is fuzzy. I’m pretty sure Walt is smarter than that. I have a hard time interpreting this premise as anything but plain old FUD.
For quite some time now, operationally valid and accepted definitions of “open source software” and “free and open source software” have existed. There’s no fuzziness in the terminology—if you understand the terminology. People involved in open source software have different motivations and philosophies for doing what they do, and this have led to different licenses that confer different rights and responsibilities to the licensee. They essentially break down into two camps: restrictive open source, where you must share all of your code modifications and derivations, and permissive open source, where you don’t have to share anything (but you might be required to attribute the original source with a copyright notice or similar). Both permit use in commercial projects.
Supporters of restrictive open source often strive for platforms that are fully open. Many powerful voices in FOSS today advocate for a computing and technological ecology where the user (the owner) has full and complete access to everything the device can do. They advocate that everything the device can do be documented completely in published, independently buildable and vettable source code and that the user (owner) should she wish be able to change any aspect of what the device can do to fit her needs or desires.
In the realm of communication devices, many advocates (myself included) feel that open access to software needs to extend to the radio units, GPS units, etc. And some (myself included) feel that hardware designs should be open source as well.
Thus there is no fuzziness in what people who engage with software development and those involved open source software movements mean by “open”. There is some fuzziness in application because those who advocate for completely open platforms are constrained by the products that are actually available (which are often built by those who use “open” tools only as leverage in their closed operations).
The other source of fuzziness is the straw-man FUD injected into consumers’ minds by articles like Mossberg’s.
“Open” can have several levels of completeness. However, there is nothing open about a house you buy that gives you access to only one or two rooms and lets you decorate them using only pre-approved designs that come out of an approved catalog. Confusing that with anything resembling “open” is the a serious bastardization of the concept.
Communities build incredible product loyalty, and open source (in addition to its other benefits) is an incredibly easy way to build community. Here’s hoping that Microchip realizes this and leaves a good formula alone.
So there I was scratching an itch when I realized the scratch would make for a good Arduino library. AsyncTimer lets you create a timer that does something when you start it (or nothing if you prefer), then waits a predetermined time before doing something else. While it’s waiting, it doesn’t lock up your Arudino the way the delay() function does—it just schedules the time-out action to take place some time in the future.
If you’re not the RTFM type, you can just get what you need from the GitHub repository.