Saturday, 24 May 2014

If only I had a time machine


It's been a while since I've updated this blog. It's always a poor excuse to use the word "busy" and I don't know many people who would accept it, but I'm afraid it's the one I'm going to use.

Xbox One

I indulged. I'd been thinking about it for a while and kept saying I didn't need an Xbox One, my Xbox 360 was console enough and anyway, I didn't even play that enough.

That lasted a while until, one day, I found myself walking out a shop with a smug grin on my face and a heavy bag containing and Xbox One console, Titanfall, Forza 5 and Battlefield 4.  
My Xbox One setup

I love it. It's an amazing entertainment system. I have it hooked up to my sound bar and my TV. Saying "Xbox On" turns the whole lot on and it has boosted what was already a gadget busy living room into an even more "intelligent" one.

I'm not a big gamer, I like to play games occasionally but I rarely ever play online, I'm happy enough playing single player. What I like about the Xbox One is that it is so much more than a games console, which suits me perfectly.

Voice Control

The voice control is incredible, I don't measure it's success but I'd struggle to believe it was less than 98% in my apartment. If I'm watching a loud action movie, it's probably not going to hear me shouting at it, although inevitably if I shout "Xbox Mute", it usually obeys, allowing me to then whisper further commands. I've even sung commands to it "Xboooox Ooonnn" in a booming voice - the bloody thing even understands that. Don't judge me on the singing... 

You can control most things on the console with voice control. Even saying "Xbox sign in as Mike" works nicely. 

Smart glass

If Voice Control doesn't work, you can't be bothered to use it, or you are watching a loud action movie, then Smart Glass, available on all platforms, is your next best friend. It's a great little app allowing you to control the Xbox from any app, game or just the home screen. I use it on my iPad mini. It's great for using with apps like Youtube or Internet Explorer.

Gestures

Probably firmly in the "novelty" category, the gestures are pretty good but not exactly that quick. You spend much more time waving your arm around, clenching your fist and pushing imaginary buttons than you would need to using a controller, smart glass or your voice, but they are at least fun.

I use the gestures to browse through films in Netflix sometimes, which is actually a great use for it.

Sky

Routing my Sky+ box through the Xbox is great. I can go from a game to Sky in seconds, I can snap sky to the side of a game i'm playing or webpage I'm browsing (or vice versa). The picture quality seems to be just as good through my TV and it just brings everything together.

Figuratively One

It's just a name. A brand, if you like. I needed a Working Title for my projects. It just feels neater that way. It gives me a logo to use with my projects and a consistent theme to stick to. 

There is no particular reason for the name but if any of my projects take off in any way, it'll be the brand name for that project.

Time

One of the problems I face with Figuratively One, is how much free time I have, or rather, when I do get free time, having the energy to do anything. Working in the Technology industry means that when I need some downtime, I tend to want downtime away from programming of any kind. 
Figuratively One:
Rosie Home Automation

Maybe I should focus my efforts on building a time machine ... or a way to increase energy after a hard day at work?

Raspberry Pi

My production Raspberry Pi is working really well. The Rosie home automation system has had a face lift (sample on the left) in line with the Figuratively One brand and is working brilliantly. I can snap Rosie onto the Xbox whilst watching TV and control the lights using gestures, Smartglass or a controller too.

The voice control module is currently offline. I need a separate Pi to run both for reliability and sound performance reasons. I have a second Pi but it's linked up to some motors at the moment so I'm dawdling and procrastinating. Voice Control is working well with Rosie though so once I get round to it, I'll be able to turn my lights on and off once again using my voice. Rosie for lights, Xbox for entertainment - sorted.

Technology

Apple MacBook Air and the Microsoft Surface

Microsoft have announced the Surface Pro 3, which apparently is targeted less at the iPad and more at the MacBook Air. 

I own a MacBook Air and I like it. I went through an HP Netbook and Microsoft Surface RT before landing on the MacBook Air and I'm sorry to the Apple haters but, it's the best laptop I've ever owned. It just works. It wakes up immediately, it lasts 10 hours, it operates silently, it's light and it's fast/powerful.

I'm able to do my work on it from anywhere and as Apple computers are much more popular these days, I have no compatibility issues. If I did have, I could install Bootcamp and run windows on it.


When I owned the Surface (albeit an RT model), it was a very nice looking device, it was actually a great size for a tablet and I really wanted it to be the right device for me, but I found, very quickly, that I was forcing myself to use it, rather than using it because it was the right device. Needless to say, just a few weeks into owning it, I had sold it. 

If I had to choose between paying ~£800 for a MacBook Air or a Surface Pro.... I'd find it difficult to justify the Surface. You just can't use the Surface as a fully functioning computer, unlike the MacBook Air. 

Windows still have some ground to make up in my opinion.

That said, it seems as though they are heading in the right direction, so maybe the Surface 4 or 5 will be cheaper and will close the gap. Oh, and they should get rid of RT, that is so restrictive, it's just not worth using.


Sunday, 19 January 2014

Efficiency: Coding and German

Rosie, AJAX and JSON

I've been working in modernising the software side of Rosie. At first, I wanted a module which would tell me whether my lights were on or off. As a rudimentary first attempt, I just had a module which loaded the current state of each light and visually displayed it at the top of the page. I then used some JavaScript to refresh it every second.

This works well, especially on wi-fi. You can't see the refresh and as soon as a light comes on or goes off, the little graphical bulb goes off. The problem is, a) it's horrendous for battery usage, especially on a tablet or phone, b) it doesn't work well over 3g, with the module visually disappearing and then reloading and c) it's an awful solution I'm definitely not proud of.

So I set to work yesterday to return an array encoded into json. Then I read that response back from my AJAX query and use that to update the lights. The response comes back as an array containing the ID of the light and the state it has switched to (on or off). I can then use this to update the styling of the particular light to show it as on or off.

Next I need to do an occasional check on the database to see whether another device is controlling the lights. This is rare but if I set a delay on the light e.g. in 5 minutes turn XX off, then I need to control that as well.

Motorbike

Today was a glorious day so rather than sitting on the sofa watching "background tv" whilst coding AJAX, JSON and PHP, I decided to get on my motorbike and go for a ride. I rode from Bramley, Hampshire to Streatley, Oxfordshire. I took a few pictures up there for around 30 minutes and then headed back, completing a circular route. It was a great route and great ride.


This week

This week is a bit busy. I'm practically touring Germany with a trip back to the UK in the middle. 

On Monday, I travel to Frankfurt. I am there all of Tuesday and travel back Tuesday night. I then go into the office on Wednesday morning before heading back to Heathrow Wednesday lunchtime to fly to Berlin. I stay in Berlin all day Thursday and then head back. Friday, I aim to stay in one place all day - Reading.

I have a feeling I'm going to be tired on Friday. It's not quite the craziest week I've ever had though and it's definitely going to be interesting. It'd be easy if I didn't have some heavy-going meetings whilst at these locations.

Fortunately, I use a great app called Trip Case for managing my trips. Usually, it's just handy to have the entire trip in one app, but this week it's necessary. Different airlines, times, hotels and terminals would have me thoroughly confused otherwise.

Netflix... conforming 

I, by default, am a non-conformist. I think there is 20% of me which naturally conforms (I'm not unfashionable, I like my house to be tidy, I follow social etiquette etc) but the other 80% likes to do my own thing.

For example, I tend to have the latest gadgets, but that's not so that I look cool in the street. Actually, I typically end up trying not to show them off because I only buy them because I love gadgets. 

So, what happens is I sometimes stay away from the latest fads, because I don't want to be one of a crowd. This has it's disadvantages, for example I am very late to Breaking Bad, I haven't watched any Game of Thrones (but now want to) and am late to joining Netflix. I have tried it this weekend and it's brilliant. I really like it. I'm using it through my Xbox 360 but since I can use it everywhere, I'm impressed. Whether I use it enough to justify it's cost is another question.


Sunday, 5 January 2014

Meet Rosie (Automating the lights at home part 3)

Meet Rosie
Introducing Rosie, my assistant. She manages my lights for me.


I can make a request of Rosie and, providing she understands it, she completes it.

Example:

Me: Rosie
Rosie: Yes Sir
Me: Living Room and Kitchen On
Rosie: Turning the Kitchen and Living Room lights on
Action: The lights come on!

Background

Rosie has existed for a while, only she had no name. I initially went with Ralf but then a couple of factors made me decide to go with female and Ralf no longer worked. I decided I wanted to increase the amount my lighting system could do and look to branch out from lighting control... and a name seemed like a good place to start!

How she works...

Beforehand...

As mentioned, Rosie has existed for a while. So let me recap on how she works.

Rosie is made up of:

A Raspberry Pi - Essentially, this is Rosie.
An RF Transmitter - This is used to switch the lights on and off
WiringPi - A really neat package that allows each control of the GPIO pins on the Raspberry Pi.
Strogonanoff - A great project I used which transmits the right signals to the Remote Control Sockets
Remote Control Sockets - The remote control sockets the lights are plugged into
Apache 2 - HTTP web server Software
PHP 5 - The programming language for the interface
MySQL - The database technology I like to use. This holds a database of lights, the schedule and groups them into programs.


That's all been working reliably for several months now, so it was time to extend the functionality a little bit.

The new components are:

VoiceCommand - Created by Steven Hickson, this amazing tool utilises Google's Text to Speech API allowing voice recognition to be used on the Raspberry Pi
Logitech Webcam - A webcam with built-in microphone so that Rosie can hear me
Portable speaker - A speaker so that I can hear Rosie

When I say Rosie, she responds with "Yes Sir?" (this is the default but can be configured). I can now say any command and Rosie will try to interpret it. With VoiceCommand I can choose whether I search Google for a result or look inside the config file. I've chosen to stick with the config file for now. I've added phrases for my lights and can ask Rosie to turn them on or off. 

For now, she's restricted to on and off commands but I'll be adding features to incorporate delays (Turn living room off in 10 minutes for example) and scheduling in future.

She's working pretty well but I'll be working on improving her in future. She's also currently restricted to about a 6 foot radius as the microphone and speaker only reach so far... so that needs thinking about too.

Of course there are times when I don't want to talk to Rosie or times when there is a lot of noise (TV on for example), so I still have the web interface which I access on my Phone, iPad or computer.