Checking Tyre Pressures using Google Glass

Checking Tyre Pressures using Google Glass

Google Glass is an exciting new platform where we can develop our own apps called Glassware. So let’s make a useful app where we can check the tyre pressure of a car by stating its registration number.

To get started, there’s some helpful quick start projects in Java, PHP and Python. Using this in combination with the reference and documentation, we can develop our Glassware.

Ideally, what we’d like to be able to do is to say something like:

“OK Glass. Tyre Pressure. A B 1 2 C D E…”

to get our result. However, it doesn’t seem to be possible to use custom voice commands to initiate the Glassware1 . A workaround is to add a menu item to allow a user to reply which we can capture to provide the required tyre pressure.

So, the steps required are as follows:

  1. Authenticate user
  2. Insert welcome message timeline
  3. Add reply menu item
  4. Add subscription to notifications
  5. Act on voice reply
  6. Insert new result timeline

Let’s look at these in turn, shall we?

Authenticate user

This is fairly straightforward. The following code is taken directly from the PHP starter project (it makes use of some utility functions – see the starter project for more details):

Authenticate User

Insert welcome message timeline

We’ll insert a welcome timeline which introduces our Glassware and allows the user to respond. Though we could use plain text, HTML will provide better formatting, e.g.

Insert Welcome Message Timeline

Assuming we’ve set this content to the variable $html, we can create our timeline card:

Variables

Tyre Pressure Google Glasses Registration

This will appear something like this in your Glass:The default notification is an audible tone when a timeline item is added:

Default Notification

Add reply menu item

Now let’s allow the user to respond to our message by adding a menu item which will overlay over the timeline item we added above.

Reply Menu 1

We can also add a menu option which reads back the message prompt aloud:

Reply Menu 2

We can also pin this timeline card to the home screen, so it’s easily accessible:

Homescreen

Finally, we add these items to our welcome card:

Menu Item

Add subscription to notifications

We need to capture any voice notifications when the user states the registration number:

Capture Voice

Note that we can specify a callback URL. This file will contain the code to act on any voice response from the user.

Act on voice reply

We’ll use a fictitious number plate AB12 CDE. When the user states this number, callback.php is called. The notification will come in JSON format2 , so we’ll decode it:

Voice Reply

Now that we have the registration number, we can make a call to the Tyre Pressures API to retrieve the result. We’ll skip this part as this is beyond the scope of this article.

Display the tyre pressure result

The result contains some basic information on the car and gives a set of tyre pressures for front and back tyres depending on the tyre size.

Since the Ford Fiesta is currently the UK’s most popular new car3 , we’ll imagine that AB12 CDE is a Ford Fiesta hatchback. The table below shows one possible result:

TYRE SIZE FRONT TYRES REAR TYRES
195/50R15 V 82 2.1 BAR / 30 PSI 2.1 BAR / 30 PSI
195/45R16 V 84 2.2 BAR / 32 PSI 2.2 BAR / 32 PSI

As there is limited screen space, we have to be careful we don’t clutter the screen or, perhaps even worse, have our content truncated. Let’s see if we can fit the above onto one timeline card (the code will be the same as inserting the welcome timeline card):

Tyre Pressure Google Glasses Registration Lookup Feature

Hmm, perhaps not quite what we were looking for. However, we’re in luck as there’s a handy feature (bundles) which allows us to bundle related cards together. The cover card will contain the first tyre size and corresponding tyre pressures. Any subsequent sizes will be added to new cards:

Bundle

So we could have something like this:

Tyre Pressure Google Glasses Registration Final Mock Up

That looks a lot better, doesn’t it?

Final thoughts

This is only the beginning. There’s room for improvement as more features become available. An obvious enhancement is to use OCR which would automatically read the number plate. There’s currently no built-in support for this, but with facial recognition likely to come soon, it’s probably only a matter of time. However, it’s possible right now by taking a picture of the number plate, sharing it with the app, sending it off to an online OCR service to have it converted to text and then acting upon the result.

So there we have it. A nice simple app which allows us to easily get the tyre pressures of a car by stating its number plate. Thanks for reading.


Azzam Profile PicturesThis article is written by Azzam Sheikh who has industry experience writing news, content and press releases. If you would like to make contact with Azzam then you can do so by Email, also see Azzam’s Google+ profile.

Search by Tyre Size