Archive | November, 2012

The slow climb of HTML5

27 Nov12

The slow climb of HTML5

Many people I meet these days ask why I still use Flash as a base for development of applications and games. It is downright scary to hear that virtually all these people still don't know that you can author your apps in Actionscript and then easily cross-compile to very performant native code for iOS and Android. Targeting the desktop with Flash has been around for more than 10 years. Using AS3 as the language and Adobe AIR to export gives you great performance and access to really advanced tools that allows for proper debugging, even directly on the GPU.

Using this stack comes with an overhead, but I would say that it's only 5-15% slower than pure native code. Perception of speed is of course subjective, but my Arduino Companion app have now been installed on more than 60.000 devices and both major app stores show a 4.5 of 5 rating. This app is currently not using any form of GPU acceleration, but the users still love it. I am currently in the middle of a cross-platform game that IS using acceleration and I'm really happy with what I'm seeing this far.

When it comes to HTML5, I see lots of good stuff happening on the desktop. HTML5 has replaced Flash for many purposes on the desktop and I don't mind this. In fact, I encourage it. I've always been a huge fan of using the right tool for the job. That's why I switched Flashmagazine to HTML more than ten (!) years ago. Flash became big because there were no good alternatives and it's only natural that it's role should change.

HTML/JS/CSS is part of my toolset and it has always been that along with PHP for the serverside. However, if you are one of those that think that HTML5 is a good solution today, you should read this great article by Ben Savage of It summarises most of my experience from the mobile HTML5-game I made for NASA recently. My biggest problem with HTML-based apps is that they're slow and have little contact with the device they run on. I absolutely hate going to a website that asks me to install it "as an app". All this does is add a desktop shortcut and the poor developers can't even know if I already did install the shortcut. Due to the lack of this they keep nagging me with their stupid "install-me" dialogue every time I visit their site (yes - I'm looking at you Google Calendar).

I'm sure that omissions like this eventually will annoy enough mobile vendors so they create a way to reliably detect if a shortcut has already been installed. The problem is just that this is but one of many things that need to fall in place before HTML5 is really useful. I also got a shock recently when a friend bought a brand new MacBook Pro and Safari couldn't show the default HTML5 video. All he got was green flickering squares. The fix was simply to install Chrome, but this highlights a core point in Ben's article - browser vendors have no interest in making Browser apps really good.

My other experience is that doing an app as HTML5 adds development time. I've discussed this with others and their ballpark is about the same as mine. 30-50% extra time is required to make a good cross-platform HTML5-app. Most developers ignore mobile for this very reason, but come on… Isn't the whole point of HTML5 to get that extra reach? To actually make it work Mobile first and fully responsive?

So why do I still use the Flash Platform for apps and games? I use it to deliver on my promise of real crossplatform apps. I can use the very same code-base to make a game for iPhone, iPad, iPod, desktop, Facebook-apps, Web as well as all the funky flavors of Android. All I would want extra at the moment is Windows 8 support. That would make my toolkit complete.

Now if only Adobe could start telling the world how good this stack really is...


Dead HDD = a 3DP moment

19 Nov12

Dead HDD = a 3DP moment

It's Saturday eve and I'm sitting down to relax and play some games on my gaming PC. I turn the machine on, get something to drink and ... I see a bluescreen? I tried to reboot, but now I got just the boot sequence and then the dreaded message "insert boot disk en press a key". I tried and tried, but the 1 year old SSD was completely dead. This couldn't be true?

All the stores that could have a new harddrive closed an hour ago. Maybe I had something usable in my PC parts drawer? Yes! I found a new 250Gb drive that I never got around to use for it's intended purpose. I opened up my pimped out gaming-pc and expected to just shove it into some smart holder in the Lian Li case. Nope. Nothing like that. I had a 3 1/2 HDD and a 5 1/4 well to put it in. Bummer. I looked around but couldn't find any adapter, but then it struck me - I can just print one?

I checked Thingiverse and surely - there was a nice set of HDD adapters there made by MakerCubed. Brilliant! I printed the adapter, screwed it in place and installed Win7. And lo and behold - the screen went dead! Seriously?!?

I looked over all the cables and on the graphics card, one of the two (!) power supply cables were not properly connected? And after going over all the cables, the SSD suddenly started working again? So - there went my Saturday gaming eve. I hope yours was better!

In other 3D printing news - I'm organizing the second 3DP meetup in Oslo in a few weeks and the MakeyMakey-holder I made with Walter (my son) got featured on Thingiverse! Wheee!




How to update the official Arduino Wifi Shield

02 Nov12

How to update the official Arduino Wifi Shield

I spent most of yesterday eve at Bitraf trying to make the official Arduino Wifi Shield behave properly as there is a bug in the firmware that it comes with. One of the Bitraf members has a cool project that involves remote control of servos. He planned to use the Wifi Shield, but it kept loosing it's connection at random intervals - no pattern to it.

As I have the same shield, I tried to figure out how to download and install the new firmware from GitHub. I couldn't find any good description on how to do it, so here's how I did it on OSX. It'll be quite similar on Windows and Linux.

1st Download the files from GitHub

Go to and either download the ZIP, or use GIT if you're familiar with that. If you're using git, open terminal and navigate to the folder you want the repository in. Here's how I did it:

mkdir wifishield
cd wifishield/
git init
git remote add wifishield
git pull wifishield
git checkout master

The installer expects the files to be inside the Arduino-app folder. Copy wifiHD.hex, wifiHD.elf and the other files from the wifishield/firmware/binary folder into /Applications/ (or where you have your Arduino app).


2nd Grab the Device Firmware Updater

Next is getting the software we'll be using since AVRDUDE does not work with the 32UC3-chip in the wifi-shield. Check out this page for details on installing this on your specific platform. For OSX, it should have been easy like this:

sudo port install dfu-programmer

However, instead we got this:

Error: The installed version of Xcode (2.0orlower) is too old to use on the installed OS version. Version 4.1 or later is recommended on Mac OS X 10.8. So off we went to Apple to get the new version.

Apparently Apple thinks that minutes after releasing XCode 4.6 was a great time for maintenance. Yay… Some hours later, the download commenced and we got it installed. Next we had to install the XCode command line tools we were finally ready to go…

3rd Set the jumper

Plug the USB Mini cable into the shield. You should not upgrade the shield while it's mounted on an Arduino.

To program the shield, you'll need to enable a jumper. This puts the chip in DFU-mode that enables reprogramming it. There is no "J3" marking (mentioned in documentation) on the shield, but there is also only one jumper there so you can't go wrong. Just place it across the two pins and you're ready to go. If you fail to set this jumper, you'll see an error "dfu-programmer: no device present" since there is no programable device connected.


4th Upload!

You'll use a script from the GitHub download to do the actual uploading: Move to the correct folder and then run the script as below:

cd /Fra PC/arduino/wifishield/firmware/scripts/
sudo sh -a /Applications/ -f shield

Explanation: "sudo" means run as the computers registered superuser to avoid any permission-related problems. Your Mac will ask for your admin password when you run this. "sh" is short for "shell" and means that the following file-name should be executed as a script. "-a" and what comes after sets the path to the Arduino app and finally -> "-f" tells if you want to upgrade the shield-software or the main CPU it runs on. Unless something goes wrong, you'll see a message saying that says "Validating" and that it's no less than 101.44% finished :-)


5th Remove the jumper

Once the upgrade goes through, remove the jumper and set it on just a single pin. That's it. Not hard once you know how to do it and have all the required software installed. It's however a far cry from the simplicity we're used to with Arduino. Maybe they'll find a smoother way to solve this? Also something VERY interesting we discovered that isn't documented - if you have connection problems with this shield, make sure you don't use/set PIN 9! It's not documented as being in use, but something definitely goes on with this pin. The PIN also has it's own LED (marked L9) on the shield and it flickers weakly during use of the shield so something undocumented is going on there.

I have to say that while it's fantastic to have an officially supported Wifi shield, I don't really appreciate that it takes up the PWM pins 10, 11 and apparently 9 as well. I'd much prefer I2C or a more configurable solution like for instance the Adafruit Wave Shield offers. Marking what pins are used directly on the PCB is also a great help for users.

We also figured that the Atmega 32UC3 chips are not too expensive, but the WiFi chip on this shield is $20 even in fairly big quantities. While this makes the shield quite expensive, it's probably worth it's steep EUR 69 price. Keep in mind though - with an Arduino UNO, the total setup is 89 EUR ($115). A Raspberry PI and a wifi dongle is much cheaper. In fact - you can even get Adafruit's complete PI-kit for only $105! Have a look at the picture above comparing both solutions and you'll see that they're both small in size, so depending on your need - maybe it's not an Arduino you need?

Here's some useful links I found while researching this: (good info on the DFU programmer) (Official page on installing DFU for other platforms)

UPDATE: here's a link to Massimo's writeup