Archive

General

For some just beginning their programming journeys a common example to conquer is blinking an LED, which usually goes something like this:

digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);

For me, I decided to try a much harder approach, in a fiddly effort that could be regarded as virtually pointless. Nevertheless, I persisted, because I thought it would be cool.

The idea: blink a Blinkt LED on Server Pi whenever it serviced a request from the outside.

For those unfamiliar with my little family of Raspberry Pi minions, here is a brief overview:

  • Server Pi – A Raspberry Pi 3 running three Node.js processes for various Pebble apps (News Headlines pin pusher, Tube Status pin pusher, unreleased notification and discovery service).
  • Backlight Pi – Another Raspberry Pi 3 with a single Node.js Express server that allows any device in the house to HTTP POST a colour to be shown behind my PC.
  • Monitor Pi – A Raspberry Pi Zero W (W, as of today) that pings the three processes running on Server Pi via the GitHub Gist discovery mechanism to give me peace of mind that they’re still up. It also checks the weather for ice and rain, and whether or not Greater Anglia have fallen over before I’ve taken the trouble of leaving for work at 7AM.

Maintaining this small fleet is a joy and a curse (one or both of “my own mini infrastructure, yay!” or  “It’s all fallen over because Node exceptions are weird, noo!”), but since I started versioning it all in Git and adding crontab and boot scripts, it’s become a lot easier. However, for this particular task, I found only one process can usefully control the Blinkt LEDs on top of Server Pi. Since this is a parameterised (services only) instance of Monitor Pi, it must be this process that does the blinking when a request is processed.

Since I’m already a big fan of modular Node.js apps, I just added another module that sets up a single-endpoint Express server, and have each of the other three Server Pi processes POST to it whenever they service a request with their own Express servers. Neat!

An hour of synchronising and testing four processes locally and on-device later, and I now have a blue blinking LED whenever a request is serviced. Sadly the activity isn’t as high as it was in the News Headlines heyday when it was tasked with converting news story images to Pebble-friendly 64 colour thumbnails and an experimental analytics service late last year, but with the interesting tentative steps the unreleased notification service is taking, Server Pi may end up seeing a bit more action than simple status checks and app news lookups in the future.

With all this work done, it’s also time for another diagrammatic mess that I like to call my infrastructure…

Back to work! This means I’ll be developing stuff in my spare time rather than all day. I know, it’s sad news.

Things to expect eventually (in the weeks range):

  • More Pebble SDK 2.0 Tutorial sections. A list of planned ones can be seen here.
  • A new UI for Watch Trigger &+ that better resembles Holo, but with that distinctive red theme. I’m also working on portrait shooting, but the Camera API hates me. It works, but the layout always seems to make the Preview View stretched and distorted. Here’s a sneak preview:

Screenshot_2014-01-05-00-10-50

  • Toying with ideas for a ‘canned’ SMS responses app that can be customised on the phone, then set to the watchapp. We’ll see.

Hopefully Watch Trigger on the Play Store is stable enough to fend for itself for the time being. If not, let me know.

So now the semester has finished, I can get down to some real coding and tutorial writing. Things to expect over the next few weeks:

  • More parts of the Pebble SDK 2.0 Tutorial.
  • Information on a basic Pebble rendering engine.
  • A small post on my recently acquired Spark Core.

In other news, the latest versions of Watch Trigger (2.3) and Watch Trigger + (1.5) have been sent to Google Play, fixing xx-hdpi display issues and a bug when opening the front camera on the LG Nexus 5.

Stay tuned!

I’ve embarked upon my fourth and final year at university, and so a lot of my time is taken up with the course and associated course-work, including a mammoth individual research project.

The good news is that a large part of that project will involve writing software in C++, which I’ve never used before. I have, however, used C so the leap is not too far. Thus over the last week or so I’ve been gaining familiarity with using the OpenCV image processing library and after the initial teething troubles installing and linking the library it looks very promising for what I hope to achieve.

In the free time remaining when I’m not doing other life stuff, I’ve been working on a much more polished GClient using the knowledge I obtained working on Watch Trigger, as well as trying to figure out why zoom isn’t working in a test build of Watch Trigger +. Yet more wresting with the finicky Camera API.

Hopefully I’ll crack it soon!

Lots going on at the moment, so here’s a list of what’s coming soon (also a personal reminder!):

  1. Pebble SDK Tutorial Part 6 is written, just needs images. 2 Way Communications.
  2. Java <-> Pebble text bridge Android Service.
  3. Raspberry Pi obtained, working on Java <-> Pi text bridge using Pi Python.

Got to do my best not to lose sight of a current project!

So while the exams are going on, I don’t have a lot of time for long coding sessions, but I am working on a small side project that builds on earlier work, and therefore requires minimal effort.

The idea is this: Modify the Java server to run cmd commands from my Android phone. First stage is creating a networking class for Android use. This could be useful for commands such as shutdown without having to use the slow TeamViewer app, for example.

Here we go!