• Compiling cwebp for Android with PNG/JPEG support

    TL;DR: Pre-configured git repo. Clone it and run ndk-build.

    In an earlier post I described that power consumption is our main issue with Gonzo. We need the camera to run for a month or so on a single charge, and everything you do with the camera eats power away. A major cost in terms of battery life is uploading the photos that the camera takes. The photos that we take are 640x480, encoded as JPEG at 70% quality. That gives an average file size of a bit over 50 KB, and that takes 13 seconds to upload over a 2G connection. If we can get that down, that means less transmission time, and thus less power consumption.

    There has been quite some fuss over new image formats that should compress better, of which BPG looked very promising. Unfortunately it’s built on top of x265, and licensing issues are withholding me from using it in any production system. Next thing: WebP, Googles image format based on VP8.

    Continue reading »

  • Firefox OS as an embedded platform: Adding a new API to read arbitrary files

    As described in an earlier blog post we’re using Firefox OS as the OS for Gonzo, our wireless camera. The big advantage is the great set of built-in APIs that we can use to leverage functionality around dialing/SMS/camera/power management. However there are a couple of things we missed from the platform.

    Because the way Firefox OS is architectured all user code, like the actual code that powers Gonzo, runs in a web context. That means that the code is isolated in a sandbox and we cannot execute code outside of the sandbox or outside our privilege level. For IoT or embedded purposes that is actually quite a shame, as all the functionality that you want to use needs to be built into Gecko (the JS engine that powers Firefox & Firefox OS). For normal developers this is actually great. If I want to monitor the value of the proximity sensor it is a lot easier to write:

    Continue reading »

  • Firefox OS as an Internet of Things platform

    When developing Gonzo, our wireless camera, one of the big questions that pops up is: ‘Why does it run Firefox OS?’. At first it indeed seems like a weird fit, a camera that runs an operating system for mobile phones. An operating system that is even mostly targeted at the developing world. But Firefox OS is a better fit for embedded devices than you might think at first glance.

    If we’re talking about the Internet of Things from a prototype / hobby perspective there are two major players that create development kits. Arduino and Raspberry Pi. Both are electronics platforms that allow you to connect sensors, and use the sensor data as input for your applications. While that seems as a great fit for embedded IoT devices, both solutions came out extremely expensive for a camera project like Gonzo. The least we need are a dev kit, a camera, a GSM shield and an accelerometer (leaving the battery out), which translates into the following bill of material.

    Module Price
    Arduino Uno €20.00
    Camera module €25.73 ($31.95)
    GSM Shield €69.00
    Accelerometer €12.02 ($14.95)
    Total €126.75

    This shows in other components as well. Adding a decent touch screen to the material list will set us back another $144.95. When you think of this it’s actually completely crazy. Why do I need to shell out ~126 euros on Arduino modules while I can get a full smartphone with processor, memory, touchscreen, GSM, bluetooth, WiFi and accelerometer for… TWENTY-FOUR DOLLARS. That’s right. $24 retail price for a full smartphone off contract. And even better, it runs Firefox OS. If you look at the architecture of a phone like this (actually any Firefox OS phone), it looks like this:

    Continue reading »

  • A live feed from the canals

    Yes, a live feed from the Amsterdam canals through Gonzo, for everyone to admire. Actually the moment we speak the sun is setting, and Gonzo is taking a photo every 30 seconds to capture that magic moment. To see the live feed from Gonzo in your browser: click here.

    Photo taken at 16:26 (GMT+1)

    Continue reading »

  • Power consumption

    My idea for Gonzo, from the very moment the idea sparked in my head last September (although that’s another story), was that we should aim for insane battery life. I want people to put up their Gonzo at hard to reach places without them having to worry to charge the device every week. That means that power consumption was our biggest concern when we started doing this project. How do you keep a device alive for at least a month? How much battery do we need to fulfill all our wishes, etc? The first thing we (and by we, I actually mean Thomas) did to achieve this goal was to set up proper power measurement equipment. A nice thing about reusing existing hardware is that a big portion of the work was already done for us by Mozilla engineer Jon Hylands. For power measurement you need a (3D printed) harness, a PCB to connect battery and main board, a power meter, and some software to read the data from the meter. All of that was already written up by Jon in a blog post on Mozilla Hacks.

    Although building the harness was easily done by Bjørn (it even fitted the battery for the Geeksphone Keon the very first time), we didn’t have any PCBs until two weeks later, so our first power measurement tool was professionaly soldered together by Thomas.

    Continue reading »

  • Timelapse

    Timelapse of the sky. Gonzo can function both horizontal & vertical position. It uses accelerometer data to rotate the picture automatically.

    Gonzo generates a lot of data. Our demo models currently make a picture every 30 seconds, mainly so we can see battery drain quickly, totalling at 2,880 photo’s a day. When you have to navigate this many photo’s you want to glaze over them as quickly as possible. To facilitate that we listen to the mousewheel event and change the photos using that which you can then use to quickly ‘fly’ over a stream. Something you learn when you interact with the stream that way is that when a Gonzo is stationary, you can create some pretty amazing timelapses. With that in mind I hacked my Friday morning away on a simple timelapse feature. First thing to do is of course to put one of our prototypes in front of the canals in Amsterdam.

    Continue reading »

  • Managing configuration on the device

    There is a variety of configuration options on the device that need to be managed, from the interval in which photos are made, to the API URL of the server. When you think over all the configuration options we have we can put them in three categories:

    1. Hard coded in the source code, e.g. the location of the API
    2. Local configuration, e.g. the PIN code of the SIM card in the device
    3. Remote configuration, e.g. the JPEG compression rate on photos

    In general you want your basic configuration file to look completely OK so when someone flashes the device everything works out of the box. Sometimes it is required that pre-build time you configure some options, like the PIN code or whether you want to roam on the SIM card. Other options need to be changable from distance, because you would not want to re-flash a device to change the interval it makes photos in.

    To accomodate for this we use a couple of techniques. First, we use architect, a dependency injection framework, to abstract away modules and their configuration on the device. We have a base configuration file that lists all the modules we have and we can specify options on a per-module basis. For example:

    Continue reading »

  • The significance of the 33$ Firefox OS smartphone

    This article is a reworked abstract from my book Firefox OS in Action. The first few chapters are currently available under early access at http://manning.com/jongboom/. You'll get 50% off with code 'dotd082714au' if you buy it on August 27.

    The launch of Firefox OS phones in India yesterday made a lot of buzz. Major reason: for the first time a smartphone was launched for a price under 2,000 rupees (¤25 or $33). This might seem insignificant in the 'first world', where every teenager runs around with a $700 iPhone in their pockets, but will make a huge impact in the third world. In this article I'd like to talk about the reasons why we have focused on breaking the price barrier, and about the choices in architecture that we made to facilitate this.

    While internet is a commodity for most readers of this article, this is not the case for the majority of people on this planet. At the moment of writing an astonishing 4.2 billion people do not have access to the greatest source of information that humankind has ever created. There are more people that do not have access to the internet, than those who do. One of the main goals (for me *the* main goal) of Firefox OS is to change this.

    Continue reading »

  • Building applications for Firefox OS using AngularJS

    When you start developing for Firefox OS you might be underwhelmed by the tools that are provided. There is no standard UI toolkit, or a JavaScript framework that all apps build on. This is not a situation that’s inherently bad because in essence Firefox OS is the web; and thus gives you complete freedom in the toolchain you use. This gives us the advantage to use any new technology that pops up also on Firefox OS. The downside is that you’ll miss out on things you might be used to on Android or iOS, like built-in templates; view transitions and UI components.

    Continue reading »

  • I wrote a book: Firefox OS in Action

    About 9 months ago an acquisition editor from Manning Publications first approached me, asking whether I was interested in writing a book about Firefox OS app development. Being a contributor, module peer for keyboard, and evangelist for Telenor, that actually made sense. Even when almost everyone in my environment that ever wrote a book said: "Yeah, it sounds fun, but actually its horrible". In a way they were right, especially the start was though; but during the process I actually had more and more fun. The fruit of the labour has now been bundled in an early access version of my book "Firefox OS in Action".

    Continue reading »