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.
|Camera module||€25.73 ($31.95)|
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:
Hardware -> Linux (Android kernel) -> Gecko (Browser engine) -> HTML5 UI
Stripping off the case
The big downside versus an Arduino or Raspberry Pi is that the phone still has a case. Lucky for us these cheap mobile phones are quite modular and only consist of three parts:
- Mother board with all sensors / chips soldered upon it
- Sometimes an external antenna
We found it’s also quite easy to open the casing and remove the mother board without breaking the phone. So far we managed to open any Firefox OS phone using normal crosshead or torque screwdrivers. Upon removing the outer casing you’ll be presented with something like this:
The motherboard of the Geeksphone Peak Firefox OS smartphone. Clearly visible are the camera, SIM card slot, SD card slot, touchscreen / display connectors, micro USB port and the flash light.
This main board can run outside of the casing and without the touchscreen connected. You will want to connect (solder?) a battery to the battery port as the phone cannot draw enough power from the micro USB connector to boot. After booting you can disconnect the battery, but the phone will shutdown because of lack of power when connecting to a WiFi network or using other connectivity features. Depending on the phone you pick (the cheapest phones that are based on Spreadtrum SC6821 platform don’t need this) you can also have an antenna connector (bottom right corner on the image above) that you need to connect to have decent connectivity. If you also need WiFi, you will need to connect a WiFi antenna, which you can source from the casing. In general it’s glued on to the outer casing and has to connect to two pins on the main board.
On the left: Removing the WiFi antenna from the casing using a flat screwdriver. On the right: Attaching the WiFi antenna to the board using anti-static tape.
What we’re now left with is a small computer with a ton of sensors that we can reprogram and then build into other assets. If you’re good at disassembling you might also have preserved the screen, which you can connect back to the board whenever needed. As you can see from below the board can be quite small.
The mainboard and screen of the Geeksphone Keon compared to a banana
Programming the board
- Can be flashed on any rooted Firefox OS phone.
- Has simple bindings for connectivity. WiFi & 2G/3G.
- Autodetects APN settings. Just plug a SIM card in, and it works.
- Comes with demo’s for devicemotion, bluetooth doorbell, security camera & GPS tracker
adb shell and access the embedded Linux that runs on the board.
Whenever you’re happy with the results it’s time to build it into something else, like we did with the Gonzo camera. Our current prototype consists of a Geeksphone Keon board, a battery and some soldering wires. Make sure to expose the USB port so you can debug it later on too.
First Gonzo prototype device we created for JSConf.asia. The battery is soldered to the main board and the antenna is visible at the top. The whole thing is mounted in a 3D printed case.
Something that you will want when working with IoT is GPIO pins. For this we’re re-using the volume up / volume down buttons, there is a lot less possibility here than with an Arduino, but it allows you for some basic connectivity. In a later blog post Thomas (our hardware engineer) will explain the steps needed to make this work.
It’s also a sign on the wall that other companies are going the same route. MatchStick is using a similar tactic to bring a very cheap HDMI stick to market, and they raised 470.000 USD through KickStarter. Using Firefox OS (JanOS?) for IoT solutions is not just a crazy idea, it’s a real low-cost opportunity.
I gave a presentation about the subject at JSConf.EU earlier this year.
If you want to get in touch regarding this blog post, drop me a line at firstname.lastname@example.org. If this post got you excited and you want a Gonzo device, click the button below and fill in your email address!