Last chance to back the AGENT watch Kickatarter, first chance to play with the code (bonus extra credit: custom device emulator with screen scaling) - Jon Galloway

Last chance to back the AGENT watch Kickatarter, first chance to play with the code (bonus extra credit: custom device emulator with screen scaling)

The Kickstarter funding period for AGENT (The World's Smartest Watch) ends Jun 20 at 1 PM. The project's almost at 10x the funding goal, so I really see this as a last opportunity to get an amazing watch for $100 off the $249 MSRP.

In addition to being a great gadget, this is a really cool thing for the open source .NET community. They're so so close to a million dollars, why not help them get there and get an amazing watch at the same time?

Hello AGENT

Like a lot of amazing gadgets, I first heard about AGENT from Pete Brown. AGENT is a smart watch that runs the (open source) .NET Micro Framework, so you can program applications and watch faces using C# code in Visual Studio. It will also immediately and irrevocably turn you into an athletic NYC hipster with lots of friends, as illustrated in the following video presentation.

I used to love watches, but stopped wearing them some time in the last decade when all the batteries ran out and I realized I just didn't care - I'd rather just read the time on my phone. They looked neat, but they didn't do anything useful.

Today's current crop of smart watches is useful. They connect to your phone via Bluetooth, so they can bring modern smartphone processing power, internet connectivity and app ecosystem to your watch without the hassle or expense of running another internet connected device. I've been keeping an eye on the Pebble, iPod Nano based watches, and other neat stuff. But I wasn't completely sold. They only worked with a few phone platforms, the battery life was just a few days, and the dev platforms did not look like a fun party at all.

The AGENT stood out to me for few reasons:

  • It supports the .NET Micro Framework, which does not make you "include ancient_goofy_language_lol.h"
  • It's got a really cool dual processor design which can get up to 30 days battery life (disabling Bluetooth when power gets low)
  • It supports Qi charging, so I can throw it on my Lumia charger every few weeks to power up
  • With Kickstarter prices in the $149 - $199 range, it's pretty affordable
  • The peppy promo video made me feel like I'd just lived through a Mentos commercial
  • It's by Secret Labs, the same wonderful people who have made the Netduino for years, so I have confidence in them actually shipping a quality product on time

The project founders have already shown amazing community focus over the past almost-a-month, with seven updates including announcements for additional international font support, included weather data and an app store.

Customizing a watchface

Unlike certain fabulous internet celebrities, I don't have early access to the AGENT emulator. Fortunately, it doesn't really matter. I looked at some code linked in the over 2000 comments and built some stuff using the .NET 4.3 Micro Framework and the built-in sample emulator.

Note: The official emulator's going to be released at the end of the Kickstarter period, so some of the below is just impatient playing around. I'm going to assume it gets even easier - but! - you can customize things quite a bit as well, so that's cool.

Another Note: The real display is 128x128 but it uses a really nice looking Sharp Memory display. Don't let my ugly emulator screenshots below deter you.

I started with Rob Chartier's sample code. He's doing some pretty cool things and his code is cleanly factored for multiple watch face support. But for whatever reason, I was getting a blank watchface in the emulator.

I next looked at Jeff Lefebvre's sample code. It's pretty simple, which is probably fine for getting started. Here's an example:

In order to run Jeff's code - or do any AGENT coding - you'll need to install the .NET 4.3 Micro Framework. It's a small download and installed pretty quickly.

Loading new fonts

I thought I'd start simple, by modifying his "fuzzy time" watchface to use some cool (free) fonts. I started by grabbing a few I liked from some of Smashing Magazine's recent free font roundups (disclaimer: before shipping any of these I'd double-check the licenses, etc.). I picked Digitica, Titilica and Deibi. The point is that I'm showing a single font, but you can bring in any you like as long as you make sure you've got the distribution license.

.NET Micro Framework uses .tinyfnt font files, as "the .NET Micro Framework uses the .tinyfnt file format to work with fonts. The .tinyfnt format uses a fixed-point bitmap-based font system for a simpler way to render fonts." You can convert standard fonts to tinyfnt format using the TFConvert file that's shipped in the SDK as "%programfiles%\Microsoft .NET Micro Framework\v4.3\Tools\TFConvert.exe". That involves creating font definition files, a few commandline options, and some trial and error. Fortunately Jan Kučera created the Tiny Font Tool GUI which lets you adjust the conversion parameters visually. I found that made a lot of difference in the quality. Each font is rendered at a specific size, so I created multiple Tiny Fonts for each font I wanted to use.

Next I added these as additional font resources to a copy of Jeff's Fuzzy face project.

Then I just updated the code references to bring in my new fonts and position them correctly.

This gave me the following watch faces (above code tweaked to turn on different fonts, of course):

  

Extra Credit: Building a Custom Device Emulator with Screen Scaling

Let's be honest, those screenshots don't look all that great. I'm going to blame most of that on the default emulator, which has some quite extremely tiny pixels. The built-in emulator doesn't let you scale at all, but since the whole thing is open source it's easy to build a new emulator with custom scaling. I opened the Emulator sample in %documents%\Microsoft .NET Micro Framework 4.3\Samples\SampleEmulator\SampleEmulator and made a tweak to the OnPaint method to scale up by 50%. The previous code looked like this:

I changed it to this:

Disclaimer: This is a very simple scaling approach, it's possible to resample and do wonderful graphics tricks when scaling up.

Building the emulator code automatically registers it in the .NET Micro Framework emulators list on the project properties dialog (you can see I also built an Awesome device which I'm not going to show you).

Now when I run this I get a much bigger watch face output which is both easier to develop with and looks more like the real device output.

So much more fun to be had

These are some really samples. I also played with a pong clock and the start of a hunt the wumpus theme. What will you come up with?

Other great stuff to read (after you've backed the Kickstarter!):

Published Wednesday, June 19, 2013 8:45 AM by Jon Galloway

Comments

# re: Last chance to back the AGENT watch Kickatarter, first chance to play with the code (bonus extra credit: custom device emulator with screen scaling)

Thanks for the shoutout! Awesome article, it was quite the journey for me (being relatively new to c#) to start off from a simple sample project, to learning how to import fonts and images, then a public github, then featured in an article!

Wednesday, June 19, 2013 2:58 PM by Jeff Lefebvre