Skip to main content

Synchronizing a ZWave lamp with monitor power state in Windows 8+

It's nice to have three monitors for a lot of screen real estate but the lights from the screens can often be overwhelming, especially at night. I installed a 3 x 10-inch LED strip behind the monitors which give a nice ambient light behind the screens.

I wrote a very simple app, vera-monitor-backlight, that runs in the background and watches system monitor state in Windows 8+. When the monitors turn off, it sends a command to Vera to turn off the light. When the monitors come back on, the backlight is turned on again. The code is hosted on Github.

Tested with a VeraLite home automation controller. You will likely need to change the IP address and DeviceNum parameters in the OnUrl and OffUrl variables to match your setup.

Also serves as an example of how to use RegisterPowerSettingNotification, GUID_CONSOLE_DISPLAY_STATE, WM_POWERBROADCAST, and PBT_POWERSETTINGCHANGE, and POWERBROADCAST_SETTING in C#.

vera-monitor-backlight on Github

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

Customizing the Asus Zenbook UX31A touchpad

I recently started using the Asus Zenbook UX31A. Overall I've been pleased -- it's a solid machine with decent battery life, the screen is vivid and I'm using touch more than I expected to.

My only real complaint has been around the touchpad which has a few quirks. An updated driver and a few registry tweaks have made things much more familiar. The result is a trackpad acts and behaves much more like a Macbook touchpad (no taps, click to select; no right button, two finger click for right click).

  1. Download and install the Elantech drivers. I'm using 11.6.8 from Acer.
  2. Make the following registry changes under HKEY_CURRENT_USER\Software\Elantech\Smartpad.
    • Make a click on the right lower corner the same as a click anywhere. Set ClickPad_RightCorner_Click_Func to 0.
    • Disable tap-to-click. Set Tap_Enable to 0.
    • Map two-finger-click to right click. Set ClickPad_TwoFinger_Click_Func to 1.
  3. Adjust sensitivity under HKEY_CURRENT_USER\Control Panel\Mouse by setting MouseSensitivity to 14.


• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

Automating web page capture with Internet Explorer

For a side project I've been working on I needed a way to take the rendered content of a web page and save it to an image file. I needed this to happen in a completely automated manner so that it could be set up to run as a scheduled task for regular updates.

I couldn't find anything that did exactly what I needed so I ended up writing one instead. I needed to use IE (some sites relied on integrated auth in an NT domain) and I wanted to be able to specify the exact dimensions of the resulting image.

For a side project I've been working on I needed a way to take the rendered content of a web page and save it to an image file. I needed this to happen in a completely automated manner so that it could be set up to run as a scheduled task for regular updates.

I couldn't find anything that did exactly what I needed so I ended up writing one instead. I needed to use IE (some sites relied on integrated auth in an NT domain) and I wanted to be able to specify the exact dimensions of the resulting image.

Next we can look at how this tool can be used with and a Raspberry Pi to drive large displays.

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

Building a simple GPS logger

In the spirit of "there's no data like more data" I've been looking for ways to generate a relatively high fidelity geospatial log of my location and travel behavior. There are commercial products on the market for this too but none did quite what I have in mind. The current unit is very simple and doesn't even have a separate microprocessor although I will likely need one as I add more functionality.



Install the DC converter in the enclosure. It's an unnecessarily large converter (physically as well as current) but was cheap and easy. The OpenLog fits nicely down one side. Although not visible here there is a header soldered to the bottom side at right angles to the board sitting under the converter which provides some nice stability on insert/eject.

The Venus unit only requires three connections for this purpose (VCC, ground and TX). The TX line goes directly into the RX line on the logger. Both units are configured at 9600 bps 8N1 by default. Although not visible here the supercap has been soldered to the underside of the board to provide fast reaquisition of signal.

The Powerpoles make it easy to install/remove the unit. I have this wired into the vehicle to receive power only when the ignition is on.

The magnetic antenna sits on the roof and enters the cab through a hole in the floor.


This project isn't finished by a long stretch. It's capturing data reliably now but still requires the unit to be opened up to read the card which is something I do about once a week or so. I'd like to add some vehicle info from the OBDII interface and also have the unit upload its data wirelessly when in range of my home wifi or Xbee network.

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

Fixing the VGA projector problem in Windows 7 on a MacBook Air

I've had a MacBook Air for the better part of a year now and been very pleased. With Bootcamp it's trivial to install and run Windows 7 and it's been one of the most reliable, predictable laptops I've had to date.

In fact, my only real complaint -- and it's a big one -- has been the low success rate when using the standard Apple Mini DisplayPort to VGA adapter with the various projector configurations at work. A majority of the time the machine simply won't drive the external display.

Finally, thanks to a thread on, I discovered a pointer to the Cirago Mini DisplayPort to VGA Active Adapter (DPA2011)

I'm delighted to report a 100% success rate so far!

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

The Raspberry Pi and decline in Computer Science applicants

The Raspberry Pi looks like a fun device: compact, cheap, and quite capable. I'm on the waitlist for the next round of shipments and look forward to receiving a board in the future.

Meanwhile I found the motivation behind the project on the About page to be interesting:

The idea behind a tiny and cheap computer for kids came in 2006, when Eben Upton and his colleagues at the University of Cambridge’s Computer Laboratory, including Rob Mullins, Jack Lang and Alan Mycroft, became concerned about the year-on-year decline in the numbers and skills levels of the A Level students applying to read Computer Science in each academic year. From a situation in the 1990s where most of the kids applying were coming to interview as experienced hobbyist programmers, the landscape in the 2000s was very different; a typical applicant might only have done a little web design.

Something had changed the way kids were interacting with computers. A number of problems were identified: the colonisation of the ICT curriculum with lessons on using Word and Excel, or writing webpages; the end of the dot-com boom; and the rise of the home PC and games console to replace the Amigas, BBC Micros, Spectrum ZX and Commodore 64 machines that people of an earlier generation learned to program on.

As one of those "kids applying as experienced hobbyist programmers", I had largely assumed that CS candidates coming up behind me would have been more versed in more technology having had earlier access to more powerful machines and richer tools and technologies. Sadly not.

I have no doubt there is real value (and fun!) in getting early exposure 'down to the metal'; I certainly learned a huge amount from the hours spent on these projects. I applaud the Raspberry Pi team for a creative approach to this problem.

fooMemories: Typing in BASIC games line by line on the ZX Spectrum and saving them to audio cassette. Connecting electronics directly to a BBC Micro and adding a ZIF socket for easy access.

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

Adding an XBee radio to The Energy Detective TED 1001

Several years ago I bought The Energy Detective, a two-piece kit for measuring electricity consumption. One unit connects inside the main electrical panel, the second plugs into a regular outlet and shows a display of power consumption in real time.

The device also comes with a USB port and corresponding Windows software to allow computer logging. The implementation mixes a Windows service (with unfortunate memory leak) and a Flash-based interface. There service hosts an HTTP API which makes it reasonably easy to pull current numbers.

Here's an example for pulling the numbers in PowerShell:

The stock solution has a few drawbacks: sometimes the numbers just stop getting updated, the memory leak requires regular restarts, and the level of granularity of the usage numbers of rounded to the minute.

Fortunately I came across a TED Modification for real-time data output which shows where to tap the PCB to get the raw output from the modem. The output is a simple 1200 bps 8N1 serial stream. With the case open it was clear that was enough room to sneak an Xbee 2mW Series 2 radio inside. The great think about Xbees is that they will happily transmit a serial stream over the air right out of the box.


Setting up the hardware interface was trivial. Just three connections are required:

Power: Ground is supplied by the third pin on programming jumper. A 3.3v supply for Xbee Vcc is conveniently available on the second pin on programming jumper.

The data line, connected to DIN on the Xbee is tapped off R20 on the PCB.


The Xbee is paired with a coordinator unit inside a ConnectPort X2 gateway. The gateway runs an embedded version of Python and Digi provides a framework called Dia which defines a pattern for interfacing with devices.

Writing the driver for the TED was relatively easy and is a subject for another post.


For reference here are some other interesting TED hacking sites out there:

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −

Building Python 2.4.3 on Ubuntu 12.04

The ConnectPort series of gateways from Digi run an embedded version of Python 2.4. Python 2.4 is no longer readily available in recent distros so here's how I installed it. Having had to do this painful exercise twice now so writing it down to make it easier next time.

  1. Download 2.4.3 source from and unpack.
  2. Install prereqs: sudo apt-get install zlib1g-dev
  3. Configure. ./configure BASECFLAGS=-U_FORTIFY_SOURCE -with-zlib=/usr/include
  4. Edit Modules/Setup and uncomment the line starting with zlib
  5. Build: make
  6. Install: sudo make install
  7. Remove new symlink that install creates. sudo rm /usr/local/bin/python. The symlink in /usr/bin/python will still point to 2.7ish.

Python 2.4 can now be invoked with python2.4.

• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −
• −    − •    − • •    − • − −     − − −    • −    • − •    • − • •    •    − • − −