Friday, 31 January 2014

Venice Vacation

No blog today, or rather no content, because I'm in Venice.

I may show you some holiday snaps tomorrow..

Thursday, 30 January 2014

The Internet of Meeting Rooms

Today, I was yet again hunting for a meeting room in the huge office building I work in. Obviously, the meeting room number gives nothing away - adjacent numbered rooms could be on opposite sides of the floor.

It occurred to me that I'd like to be able to hold up NetMash in "look around" mode, and see all of the meeting rooms nearby - like X-Ray vision.

This would of course be driven by BLE beacons inside each meeting room, advertising the URL of their virtual room/place object. Assuming my phone is on the office WiFi, NetMash could fetch and render those place objects for me, plus all the contents.

An obvious object to have inside a room on the virtual wall would be a "card" describing the event - a meeting booking. This would be a 3D representation of a JSON object encoding an iCalendar event.

Of course, occupied rooms would also contain all the avatars of the people in them. I could find the room, then as I approached, ping a message to all of my colleagues.

There could be an object that captured the whiteboard work as an image that we could virtually take away with us.

And, obviously, there would be objects for lighting and heating. Being listed in the event object invitees, I could turn all the lights off and back on again as I approached, for dramatic effect.


Wednesday, 29 January 2014

The Internet of Farm Yields - from Monsanto?

With Google's acquisition of Nest fresh in our minds, this article now makes even more alarming reading.

Apparently, Monsanto are offering farmers a system that can measure crop yields over their fields by following them around using GPS while monitoring the rate of harvest at each point they cross. All this gets pushed up into Monsanto's servers.

The farmer then gets the payback: an automated planting system that adjusts the amount and type of seed planted at each point in the field.

But of course, the farmers have trusted Monsanto with their field, planting and harvesting data and are letting the company control their planting in unprecedented detail.

I suppose I trust Google enough with my personal life - perhaps I'll learn to regret that - but if I were a farmer, would I trust Monsanto?

I was going to search for some juicy stories about their unethical tactics, but found that just searching for "Monsanto" alone threw up enough material.


Open & Local Farming

Obviously, it would be perfectly possible to do all of this in an "open and local, not proprietary and cloud" way.

The farmer would get all the above benefits, plus control and privacy, plus the benefits of being able to work with other local and global farmers and keen technologists to create systems that do much more than whatever Monsanto want.


Tuesday, 28 January 2014

Slightly Better AR Microlocation Algorithm

There are two parts to Augmented Reality: knowing which way you're looking around you, and knowing where you are. I've started the first one, in one axis at least. I've also started the second, by jumping right up to the nearest object.

As I showed in that article, it's a bit rough: if the nearest object is the light, I only see the light, up close, without a surrounding place. Only if no beacon is near do I see the place the light is in, with that light and any other lights.

While waiting for the mathematical energy and inspiration to tackle proper trilateration, what I actually want is for the 3D AR view to always be in the place that the surrounding objects or Things occupy, rather than jumping off to the object alone.

Then when I move in to a beacon on a Thing, for the user object or avatar in that place, and their 3D view, to also move smoothly closer to the 3D representation of the Thing object within that place.


Tricky Algorithm

Now, it's not tested, but here's the algorithm I worked out on the train today:

  If the nearest object is a place:
    If already in that place:
      If looking up close at an object:
        initiate zoom to the middle of the place
    Else:
      jump to the middle of the place
  Else:
    If already in the place the object is in:
      If not already looking at the object:
        initiate zoom up to the object
    Else:
      jump to the middle of the place
      initiate zoom up to the object

Way more complex than I ever imagined! And that's not even close to a trilateration algorithm.

The action "jump to the middle of the place" is resetting the 3D view to a new place URL and putting the user in the middle, of the room, etc. Arbitrary, but on average not a bad choice, I hope.

By "initiate zoom..", I mean kick off a thread to move the user's avatar smoothly to a target destination position in the place. Since at this point I only have the URL of the target object, I also need to look up its position coordinates from the place it's in, or the coordinates of the middle of the place.

On top of that, for zooming up to an object, I need to stop before I hit its actual position. So I need to get its bounding box and turn that into a bounding circle radius, so that I can stop zooming that far back.

Only two weeks to go to the end of this ThoughtWorks exercise..


Monday, 27 January 2014

Simple but Effective Lighting Behaviour via the IoT

This last weekend, I replaced all those LED bulbs in the kitchen with dimmable ones, and put a dimmer switch in. They are still super-white bulbs, which is ideal for seeing while doing jobs.

But as soon as we first dimmed them down - we hit upon an obvious issue: they're still super-white, only dimmer.

What we would like is for them to go warm-coloured when they're dimmed!

You don't need pure white light if you're not using them to work by, and if you dim them, you normally want to set a softer mood, or make it suitable for relaxing and chatting. White light isn't the right light for that.


Object Net IoT Approach

So obviously, that gets me thinking about the Object Network solution.

The ultimate IoT solution would be to have individual control over each bulb's RGB levels via some decent radio control such as ZigBee, Z-Wave, Bluetooth or 6LoWPAN. The state the dimmer switch was in - off, or on and the control level set - could be fed into the I/O ports of a Raspberry Pi which would also terminate all the radio.

The practical, DIY solution? You can buy GU10 RGB LED units that come with an IR controller. It only seems to have limited colour settings, however, but it may be possible to trace the protocol and set any RGB value. You'd need to have a dimmer box containing an IR LED to control the bulbs across the kitchen (don't stand in the way!), and a variable resistor for the control. These would all be wired into a nearby Raspberry Pi's I/O pins via some adaptor circuitry.

The R-Pi would be best in or near the dimmer box, so that it can have a BLE beacon advertising the URL of an object representing the state of the control. This object would sit within a place object (the kitchen) that also has the 3D light objects overhead. The lights may or may not be beacons, too, depending on their technology.


The Magic Bit

Then a simple Cyrus rule in the R-Pi would set all the bulbs to white at maximum control setting, but increasingly to warmer colours while decreasing brightness as the dimmer control is turned down.

You could of course override the control level in the app, or directly set any bulb colour as usual. From the coffee shop or down the garden.

Or you could fiddle with the rules to make the lights go blue and surge like waves instead, when you turn down the control..

Sunday, 26 January 2014

Android sensors for AR

I've added a simple class to NetMash called Sensors, that I use to pick up the phone orientation, to drive the 3D view. This is only active once I set the "Around" menu item. I currently only use "azimuth" to pan around the room.

That's something I learned doing this project: "azimuth" is panning around you - and is also called "yaw", "pitch" is looking up and down, and "roll" is tipping or rotating the device while looking at the same thing.

The Android documentation appears to have some rather odd axis conventions to the eyes of someone who hasn't taken the trouble to work out all the maths, but working code beats theory every time.

Obviously, the code was more-or-less copied from multiple StackOverflow posts, but there's not one post or article anywhere I could find that gave me complete code like the simple class I ended up with. The smoothing algorithm I invented is probably far too simplistic, but I can refine it.


Actual Positions

So now I can pan around my 3D place, it becomes pretty obvious that the room isn't exactly oriented square to North.  But more importantly, the positions of the lights bear no relation to their actual positions in the room around me.

Setting Thing positions to their actual locations in the room will have to be done manually for now, when I run NetMash on each Pi. They will then be notified to the place object which can pick them up in the initial discovery rule.

I'm still intending to video all of this working..

Saturday, 25 January 2014

Augmented Reality and Magic

I was out with my daughter today and we went to a garden centre.

To be more precise, I was out with both my daughters - one went indoor climbing with her friend, and the elder and I went off for a hot frothy milk and a coffee, respectively, in the garden centre.

Garden centres are strange places - for a non-gardner like me it's mostly just stuff for other people to buy - mostly, it has to be said, for a generation that arrived before I did.

But this one, like most, had a book section. Again, mostly gardening and cookery books and books about how the town looked 100 years ago. Aeroplane books and war books.

And children's books. Which is where I get to the point of all this.

We picked up this Augmented Reality Fairy book. Now, the daughter that nagged me to buy it is the kind that never gives up and gets very enthusiastic for a while, then moves on to the next opportunity very quickly. So I was a little reluctant at first.

But it was discounted down to only a fiver, and had marker-based AR, which I always find fun to see, and guessed the rest of the family would enjoy too. So I bought it.

Now I have to say that I was almost as excited to try it out as my daughter, and she and I sat together at the Mac and got it going. She was delighted, of course.

You point the webcam at the open page and it detects which page it is and creates a superimposed fairy scene. You can activate various things, like getting a fairy to appear and cast fairy dust around.

The grand finale is to hold a card disk in your palm and entice a fairy by hitting various keys to add fruit and flowers to a cup. So it's like you're holding this fairy in the palm of your hand.

When the family saw all this, there was plenty of "wow"ing and "ooh"ing.

But really, it was pretty basic - just a simple animated 3D scene. It was the fact that it keyed itself onto a physical thing - the book page or the disc - that gave it such a compelling edge. So engaging was this illusion, that my daughter apologised to the fairy when she turned the page and made her vanish!


Augmented Reality and Magic

For a long time, computers have lived in an abstract virtual place in our lives - only interacting properly with reality when printing something out on paper, or arranging for a package to arrive the next day from Amazon. Maybe video calling has a bit of that reality-engagement, too.

Smartphones are better at integrating into our physical lives, with their sensors for orientation and GPS and their cameras.

But when you combine those sensors and a 3D display within an AR app, you can create magic.

The kind of magic that is possible when the unlimited creative universe of the virtual can start to invade our physical environment in truly tangible and compelling ways.