Creating a HomeKit Driveway Sensor

It’s one of the quirks of the house that I live in is that I cannot easily see the end of the driveway from inside the house. This means it’s hard to tell when someone might have arrived, whether expected or unexpected. The Guardline Wireless Driveway Alarm has been a good solution to that problem, as it gives us a nice, loud, BING when its beam is crossed. It’s not perfect — deer and even neighborhood cats occasionally set it off — but I’m happier with it than I was without it.

Having other home automation projects I’ve undertaken using HomeKit (more on that another time), I decided that it would be nice to know if the alarm goes off when I’m not at home. My first inclination was to connect it to a Raspberry Pi, since I have those lying around, and I’ve used them successfully for other home proijects. The Guardline has relay connections, and I wondered if I could wire it up to a Pi and read the change in state from a GPIO pin. Clearly if the answer was no, I wouldn’t be writing this.

It turns out to be fairly simple. I chose to wire the Normal Closed contact to a pin on the Pi (GPIO board pin 37), the sensor pin and the common to a ground pin.

Guardline relay contacts wired to Raspberry pi

From there I could detect events on the sensor pin:

def motion_detected(pin):
    print("Motion detected!")

sensor_pin = 37

GPIO.setmode(GPIO.BOARD)
GPIO.setup(sensor_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(
    self.sensor_pin,
    GPIO.BOTH,
    callback=motion_detected
)

Once I knew that I was getting state change, I built a simple HomeKit accessory using HAP-Python:

import logging

import RPi.GPIO as GPIO

from pyhap.accessory import Accessory
from pyhap.const import CATEGORY_SENSOR


logger = logging.getLogger(__name__)


class GPIOSensor(Accessory):

    category = CATEGORY_SENSOR

    def __init__(self, *args, sensor_pin=3, **kwargs):
        super().__init__(*args, **kwargs)

        self.sensor_pin = int(sensor_pin)

        logger.debug('Setting up GPIO input')
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(self.sensor_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
        GPIO.add_event_detect(
            self.sensor_pin,
            GPIO.BOTH,
            callback=self.__motion_detected
        )
        logger.debug('Subscribed GPIO events')

        serv_sensor = self.add_preload_service('MotionSensor')
        self.char_detected = serv_sensor.configure_char('MotionDetected')

    def __motion_detected(self, pin):
        logger.debug('Motion detected')
        sensor_state = GPIO.input(pin)
        self.char_detected.set_value(sensor_state)

    def stop(self):
        super().stop()
        GPIO.cleanup()

Which was easy enough to then run using the HAP-Python example. Once it’s set up in HomeKit, I get handy notifications like this:

HomeKit driveway sensor notification

Reading List for a Nuclear Crisis

My brief recommended reading list for a nuclear crisis, in order:

  1. The Making of the Atomic Bomb, by Richard Rhodes
  2. Hiroshima, by John Henessy
  3. One Minute to Midnight, by Michael Dobbs
  4. Essence of Decision: Explaining the Cuban Missile Crisis, by Graham Allison and Philip Zelikow
  5. Nagasaki: Life After Nuclear War, by Susan Southard

My also-brief recommended reading list for North Korea, in no particular order:

Replacing the Fujifilm X-T1 Grip

I have had a Fujifilm X-T1 for a little bit over a year now. I am a huge fan of what Fujifilm are doing with the camera controls and sensors. I’ve been able to capture some images that I really love with the camera.

Rip Van Winkle Bridge

I’ve used it to great success for both prime focus astrophotography and wide-field with Fujifilm’s fantastic lenses.

The Great Nebula in Orion Cygnus widefield

However, I’ve had two recurring problems after using the camera in the desert heat and summer humidity: the bowed connection cover door, and expanding and peeling rubber skin/grip on the body. Both of these have been mentioned and discussed on various forums around the Internet, so I won’t dwell on them here. What I do find missing is the process of replacing the grip, and I hope others might find this helpful.

I decided to try to replace the rubber grip on my own. I ordered the parts from Fujifilm North America’s parts department. Interestingly, the new pieces I received this time seem to be made of much different material, which I hope will make them less susceptible to the problem repeating itself. More on that in a moment. There are four grip pieces on the camera, and each piece and tape (they are separate) costs rough $20 each.

To start with, the existing grip has to be peeled off, and all the tape residue on the camera body removed. Because the grip was already peeling, this part was fairly easy, and happily the tape, by and large, came off with the rubber. All it took was simply placing a fingernail under a corner and pulling.

Front of camera Back of camera Old and new grips

Once removed, I noticed something interesting about the old rubber grips versus the new ones. Not only are the new grips made of a different material, but the back of the grips where they adhere to the tape are textured on the old ones, but smooth on the new ones. I suspect that the texturing is one part of the problem with the old grips, and I’m happy to see that fixed.

Back texture of old grip Back texture of new grip

I cleaned up residual adhesive from the camera body with isopropyl alcohol and cotton, and made sure the surface where the new adhesive tape would go was as clean as possible. It was now time to figure out how to adhere the new grips to the camera body.

Fujifilm didn’t provide any instructions, and I haven’t seen anything online specific to Fujifilm’s grips and/or the X-T1. So, here goes:

The tape is provided separate from the grips. One one side, it has a large piece of plastic, and on the other side the plastic is cut to the same size as the tape, with a slight overhang. Looking at the shame of the tape, the camera body, and the adhesive left on the old grips, it was obvious that the tape is intended to peel from the large squares of plastic and adhere to the body, then the fitted layer of plastic is removed, and then the grip as adhered.

Tape

I started with the smallest piece, and what I assumed would be the easiest piece, the rectangle above the connection cover door on the left side of the camera.

Small side grip tape Small side grip installed

This piece was easy enough. I moved around the camera from there, doing the piece around the focus mode selector and PC sync port, and then moving on the right hand grip on the front.

Camera front right tape Camea front right grip installed

The right hand grip on the front actually came with two separate pieces of tape and the second, that wraps around the hand grip, has the potential for causing problems.

Front grip tape

In the photo above, I attempted to illustrate how the tape should be applied to the camera relative to the grip. The photo is wrong. The larger piece of tape should be flipped horizontally and rotated 90º clockwise from what you see here, more like the photo below.

Corrected front grip tape

I didn’t take an in-between photo of this one because I actually screwed it up the first time and had to carefully peel it back off. Which leads me to my biggest piece of advice in this process.

When placing the tape on the body, do not press down until you’ve it positioned correctly. It will peel off again if it’s not quite right, as long as you don’t press it down.

front grip

After a bit of a stressful moment then with the right front grip, the rear (where I had initially noticed the peeling) was simple enough as well.

rear grip

And that’s basically it!

Overall I am exceptionally happy that I did this, and I’m happy to see that Fujifilm has attempted to address the core problem with the grip by changing materials. The new material is significantly less “grippy” than the rubber that my X-T1 shipped with (it feels more like the plastic of the connection cover door on the left side). However I feel more confident that it will remain in place for much longer. The grip looks good and feels good. I do hope this helps anyone else who has the rubber grip expanding and peeling issue with their X-T1 and wants to replace the grip.

One word of warning: never, ever, under any circumstance attempt to stick the old grip back on with adhesive you couldn’t remove if you had to. As you can see from some of my photos, there are screws under the grip that you may need to be able to get to at some point in the future. Replacing it is not hard.

Slow Motion Messier Marathon, Update 3

The slowness of my Slow Motion Messier Marathon continues to impress me. Since my last update I have a few new photos and few do-overs:

New ones:

  • M1, the Crab Nebula.
  • M78, a reflection nebula in Orion.
  • M96, M105, a couple of spiral galaxies.
  • M97, M108, the Owl Nebula and a barred spiral galaxy.

Do-overs:

  • M31, the Great Galaxy in Andromeda.
  • M42, the Great Nebula in Orion.
  • M45, the Pleiades.
  • M51, the Whirlpool Galaxy.

Here is the updated list of Messier objects I’ve captured so far, with the do-overs in their places.

The full table (including all the missing objects) is also available on my website.

Slow Motion Messier Marathon, Update 2

My Slow Motion Messier Marathon continues more slowly than I anticipated. But since the last update I have two new photos:

  • M33, The Triangulum Galaxy, taken on November 15, 2014. I like this image (in fact, I think it’s my favorite that I’ve taken of a galaxy).
  • M45, The Pleiades, taken on March 19, 2015. I’ve wanted to capture the Pleiades for a while now, and finally had the opportunity. I didn’t get as many exposures as I’d like to have because they sank below the very high tree-line I have to the west, but that’s okay. I like this one.

Here is the full list of Messier objects I’ve captured so far. These are all, with the exception of M57, taken with the same telescope, an Orion ED80, with a focal length of 600mm, giving a field of view of approximately 4º or 240 arcminutes. This means that these images should give an idea of the relative sizes of these objects in the sky.

I’ll include this table in future updates:

The full table (including all the missing objects) is also available on my website.

Slow Motion Messier Marathon, Update

Since I declared my intention to begin a Slow Motion Messier Marathon I haven’t gotten as far along as I had hoped. I do have some updates, however:

  • M94, taken on April 20, 2014. This is a disappointing image on a number of levels. You don’t get any real detail in the galaxy at all, and it’s one of the longest stacks I’ve ever done too — 45 minutes! Oh well, it’s checked off the list for now, and I’ll revisit it later.
  • M27, The Dumbbell Nebula, taken on September 8, 2014. This is a satisfying image overall; the dumbbell is a fairly small target for my 80mm refractor. Really, I cheated a bit on this and used the same exposures I used for the next one, so I could use the same dark files.
  • M31, The Great Galaxy in Andromeda, taken on September 8, 2014. Since I can’t seem to get M8, the Lagoon, because of my observing location and some trees, this is my consolation prize. M32 and M110 are also in this image.

In addition, I’ve done some more post-processing on my image of M51 from April 16, 2014. I’ve also dug out a (poorly tracked) shot of M57 that I took about ten years ago with a Meade LX90.

Here is the full list of Messier objects I’ve captured so far. One thing to note is that these are all, with the exception of M57, taken with the same telescope, an Orion ED80, with a focal length of 600mm, giving a field of view of approximately 4º or 240 arcminutes. This means that these images should give an idea of the relative sizes of these objects in the sky.

I’ll include this table in future updates:

The full table (including all the missing objects) is also available on my website.

Ostracization

I’m finally reading through the Supreme Court’s Town of Greece, NY v. Galloway ruling, and it’s a dismaying and infuriating combination of disdain and ignorance toward non-Christians and atheists.

Should nonbelievers choose to exit the room during a prayer they find distasteful, their absence will not stand out as disrespectful or even noteworthy. And should they remain, their quiet acquiescence will not, in light of our traditions, be interpreted as an agreement with the words or ideas expressed. Neither choice represents an unconstitutional imposition as to mature adults, who “presumably” are “not readily susceptible to religious indoctrination or peer pressure.” Marsh, 463 U. S., at 7921

Clearly Justice Kennedy has never actually refused to bow his head during a prayer, much less left a room. He thinks that self-ostracization is a perfectly acceptable solution.

There are two very different sensations I’ve personally experienced during public prayers. First there’s the pronounced internal feeling of exclusion: everyone around me is participating in a ritual that I am not a part of, that I cannot be a part of because I simply cannot believe. I cannot accept the fundamental basis for the ritual. Second is the shrinking sensation when people around me notice that I haven’t participated.

Now, most of the time I’ve experienced this have been in situations I’ve had the option not to place myself in, where I had full awareness that there would likely be prayer (my experience has been Christian and Jewish). It was my choice to get a degree from a private college with a Catholic history, which had a prayer at the commencement ceremony that I was under no obligation to attend, for example.

However, if there is prayer at public, government functions that I must attend if I wish to exercise my democratic rights… that’s another matter altogether. Justice Kennedy, with the help of Justices Roberts, Alito, Thomas, and Scalia, has gutted the first two clauses of the First Amendment, condoning the ostracization of nonbelievers while insultingly suggesting self-ostracization as the solution.

Slow Motion Messier Marathon

It’s been a long-time goal of mine to do a Messier Marathon. I missed my window of opportunity again this year, and the reality is that the time investment required during the month of March is probably not realistic for me in the coming few years.

So I’ve decided that instead I’m going to try to photograph the Messier Catalog over the next year — it’s like a marathon, only stretched out to 12 months.

I’ve already started, although not by intention, with the following:

Clearly I need to step up the pace a little bit. It’s not every object that will put a second one in the same frame, after all. But it will be nice because there are still quite a few I’ve never taken the time to actually look at.

I will be trying to use Tony Cecce’s Twelve Month Tour as a guideline, with modifications because of the tall trees that get in the way of some of them.

Watch this space (the puns!) for updates!

Just Because You're Paranoid...

In his interview with Charlie Rose, President Obama is quoted saying:

…They’ll say … when you start looking at metadata, even if you don’t know the names, you can match it up … and you can yield all this information. All of that is true, except for the fact that for the government, under the program right now, to do that it would be illegal. We would not be allowed to do that.

Of course, telephone and internet metadata are useless to intelligence or law enforcement, that’s why their acquisitioncollection is (or, was) such a zealously guarded secret and why the reaction to their collection being made public was so ferocious. I mean, who wouldn’t be outraged at the revelation of a secret mass surveillance program of absolutely no intelligence value?

Telephone metadata is useless, as German politician Malte Spitz has demonstrated:

Malte Spitz's telephone metadata

No useful information there at all. Your recurring travel habits, both everyday and out of the ordinary, are of no value, obviously. And that’s before you get to who and when you called and how long you talked.

And neither is your email metadata:

Jacob Goldstine's email metadata

And it hardly matters that this information will be retained “not in perpetuity”. It wouldn’t be useful in the future, of course, even if the government has a reason to use it.

This is assuming — since Obama made the distinction between what is legal and what is illegal — everything about the program is legal. And we have no need to doubt that, do we?

The Universal Declaration of Human Rights

I have created an eBook, in ePub format, of the United Nations’s Universal Declaration of Human Rights. Hopefully it can be useful as a reference to have handy. It includes both the full declaration as well as summaries of each of the articles.

  • Download UDHR.epub
  • Last Modified: March 29, 2013
  • For: Any ePub 3-capable eReaders (iBooks, Nook, Kobo)