Some fun or spooky Halloween automations with Home Assistant

It’s that spooky time of year again, but this time it can be extra spooky with the help of home automation.

Motion-activated jumpscare on TV

One classic spooky thing to do is have a TV do something scary when people walk by. This is easier than ever on any TV now that everyone has Raspberry Pi with HDMI output and z-wave (or other) motion sensors everywhere. Check this out:

Continue reading Some fun or spooky Halloween automations with Home Assistant

Authenticating and populating users in Django using a Windows Active Directory and SASL

I’ve been trying to get some Django stuff running that can securely authenticate users against Windows Active Directory and also populate some info (first/last name, email address, maybe groups etc.). There are lots of resources out there but nothing was fully complete or modern and it took me some figuring/hacking to get it done.

Resources I found include:

  • django-auth-ldap — the normal LDAP plugin. Problem: It does not natively support SASL and simple binds would send clear-text passwords. I think normal people would just activate TLS in this case but I didn’t want to do that
  • A relevant SO post — with an answer linking to a useful snippet that no longer works on recent django versions.
  • django-auth-ldap-ad — Someone’s entire different ldap plugin made specifically for this purpose. But it isn’t being maintained, is GPL-2, and doesn’t work directly in Python 3 or recent django.

Continue reading Authenticating and populating users in Django using a Windows Active Directory and SASL

I think my new motorcycle gloves “melted” my Oxford Heater grips

This may be a coincidence but about a week after I got new motorcycle gloves, my Oxford Heater grips started like, deteriorating away. Check this out:

They’re like melting

It has been hot recently, but this is still very odd. I got these Street & Steel V-74 gloves from RevZilla. Maybe it’s the Gel Palm leaking out and reacting with the grips? Who knows. Anyway it’s sticky and gross and annoying. Poor Oxford Heaters, I love those things.

Gloves that melt

Has this happened to anyone else!?

Multi-room audio over Wi-Fi with PulseAudio and Raspberry Pi(s)

NOTE/UPDATE: After an update this kind of stopped working and I struggled with it a lot. Now I actually recommend using snapcast instead of this solution. It works better!

I moved to a new place and it has more than one room. Naturally, I hooked up the stereo in the living room and tested it like my dad taught me: by playing “Money For Nothing” really loudly. It worked. But wait a minute, there’s an upstairs now… how will I get it playing up there? I could always use the wifi network and raspberry pis to beam audio around. Yeah, let’s do that!

Continue reading Multi-room audio over Wi-Fi with PulseAudio and Raspberry Pi(s)

The Hero Jr. personal robot from HeathKit: a 1984 product way ahead of its time

One of my first memories is a vision of lying near my dad in the basement in the mid-1980s while he endlessly soldered away at some big project. Later, I spent a lot of my childhood messing around with the product he was assembling: a Hero Jr. robot. This was a educational personal robot, intended to be your “friend, companion, and security guard.” Here he is:

Hero Jr. from 3 sides
My family’s Hero Jr.

Hero Jr. has a sonar, infrared motion sensor, light sensor, sound sensor, radio-frequency remote, drive motor, obstruction sensor, and a RS-232 serial port. His out-of-the-box features included a security guard mode, alarm clock, poetry, singing, and (my favorite) the ability to explore around the house, often while singing America, Daisy Bell, or Little Miss Muffet.

Continue reading The Hero Jr. personal robot from HeathKit: a 1984 product way ahead of its time

Idea: Communal voice assistant that chimes in during fact-based discussions

With all the AI voice assistants around today there are lots of interesting applications people are dreaming up. Here’s another one.

You could set your voice assistant on the table and start having a discussion or debate that inevitably involves bringing up facts about news or history or how something works. A lot of times when someone doubts what was said a phone will come out to do some fast wikipediaing or other searching. If a AI could somehow either know or be triggered to check something, that’d be an interesting new dynamic to the conversation. It could do things like:

  • Correct misquotes and other slight error in the discussion, e.g. “Actually, the NOAA temperature data were corrected in 1950 because the volunteer network switched from morning readings to afternoon readings.”
  • Fill in details about a headline someone read (person: “Didn’t I read a headline about radiation dose in beagles?”, AI: “The recent UC Davis study shows a correlation between dose rate and lifespan.”)
  • Look up details and say them when they’d help

It’d have to be a really smart AI to know when its utterances would be useful in a dynamic conversation. It could start by just lighting up when it thinks it has something to contribute and people could allow it to chime in, rather than having it chime in only when someone wakes it. Then eventually once it’s smart enough it could chime in on its own. The future is fun.

Secure remote access to a camera DVR with VPN and VLANs on an OpenWRT router

If you have a digital video recorder (DVR) hooked up to some cameras and you want to access it remotely when something happens, you can set up remote access to review things from wherever. Here’s how to do it.

Continue reading Secure remote access to a camera DVR with VPN and VLANs on an OpenWRT router

Helping an artist with a Morse code protest chant installation in Denmark

A few months ago, I got an email from a Sweden-based artist and teacher named Mary Coble asking if my Morse code laser post could be helpful for an art installation she was working on. She’s used Morse code in previous installations like one in Toronto where she sent coded light from a giant dome to people below who then relayed signals with flashlights. As a part of a new project, she wanted people to be able to enter protest chants into a website and then have a system convert the message to code and flash a light in a gallery window. Did I want to help? You bet I did!

I got super excited about the prospect of helping with this and knew that with a combination of things I’ve used before it would be really doable. The plan was to have a webserver accept messages from a form and transmit them to a Raspberry Pi (cheap mini-computer), which would then flip pins on a relay to blink the light, like this:

A diagram showing the flow from user input through a webserver through MQTT to a raspberry pi and into a relay connected to a light.
The parts of the planned system working together

After many emails and some ups and downs, everything worked! This really feels like how the internet is supposed to work.

Continue reading Helping an artist with a Morse code protest chant installation in Denmark

A (medium-length) primer on energy, greenhouse gas, intermittency, and nuclear

Thanks entirely to the efforts of local climate-related organizations in Seattle, I’ve now spoken at a handful of book stores, breweries, universities, and even Town Hall on climate and energy. Last week, I was honored to be on one such panel at a brewery in Ballard alongside Univ. of Washington oceanographer LuAnne Thompson and Governor Inslee’s senior climate policy advisor, Reed Schuler. My role was to provide background information on the human relationship with energy: what we’ve used in the past, what we’re using today, and what our low-carbon options are moving forward.  I touched on progress and challenges with intermittency, hydro, and nuclear. This post summarizes and expands upon these topics.

Energy is a replacement for the labor of human beings

The first part of my talk was easy. I threw up my favorite slides demonstrating how energy improves quality of life by replacing human labor. Between construction, farming, heating, water, laundry, and travel it’s a pretty easy case to make.

Picture of guy on oregon trail vs. jet flying over mt. rainier
Traveling with and without a lot of energy

Continue reading A (medium-length) primer on energy, greenhouse gas, intermittency, and nuclear

A fancy Home Assistant automation that checks the weather and figures out when to turn on your heater

So in the continuing saga with my mom’s home-automated furnace, it got extra cold recently and I noticed it wasn’t getting up to temperature in time for her to wake up. I figured I could come up with a formula to compute the time needed to come to temperature and turn on the furnace at a dynamic time in the morning so it’d be just right.

Graph of temperatures inside and outside
Temperatures at my mom’s house over a few days

Continue reading A fancy Home Assistant automation that checks the weather and figures out when to turn on your heater

Getting your Ubuntu 17.04 computer set up for the fast.ai deep learning courses

I’m becoming convinced that Jeremy Howard is right to predict that deep learning is going to be “more important and more transformational than the internet.” If you don’t know who Jeremy Howard is, he’s part of the duo behind fast.ai free and high-quality deep learning course series, which is dedicated to making deep learning accessible to everyone.

Deep learning takes advantage of certain graphics processors (GPUs) to be efficient. If you take the course, it’s recommended that you sign up for an Amazon Web Services machine with an appropriate GPU so you can just run the provided setup scripts and be on your way learning deep learning. But you may want to try to get everything set up on your own machine if you happen to have one. I just built a small server and added a modest GPU just for this purpose so I figured I’d give it a whirl. This is how I did it.

Continue reading Getting your Ubuntu 17.04 computer set up for the fast.ai deep learning courses

Mobile gas station to fill-up self-driving vehicles while they are in motion

You know how some airplanes can get their gas filled up while in the air by tankers (aerial refueling)? And how ships at sea do this too (underway replenishment)? And you know how self-driving cars and trucks are taking over everything soon? Well there’s going to be a need for mobile gas stations on the road.

A ship at sea refueling
Underway replenishment (Gregg Macready/MOD)

Think of it! Long-haul trucking will want to go non-stop, and to do so there can be little sections of road where a tanker truck drives alongside the main truck, hooks up a hose, and refuels it for 10 minutes while everyone’s moving. Then the self-driving truck carries on and the tanker truck crosses the road, services a truck going in the other direction, and repeats until it eventually has to fill up from a bigger tank nearby.

Another manifestation is a thing on a long rail that refuels you as you drive alongside it. The hose could be on a sliding coupler that maintains a hermetic seal.

This could happen with passenger vehicles too. Presumably people will hop in their cars at night and expect to wake up in Florida the next day so they’re going to need automated gas refilling as well. Ideally this would be underway but I guess if gas stations could just fill up cars that roll in that’d be acceptable too. It will be more comfortable and less disturbing if this happens while on the road though.

That’ll be a billion dollar industry soon. If they’re electric cars, these will be charging stations instead of refueling stations.

 

Building a NAS server/home server in 2017

I decided I wanted a network-attached storage (NAS) server because I needed some central and safe place to put all my big files. I’ve been using more and more hard drive space because I’ve been taking photos in RAW and collecting more digital video (camera, dashcam, digitized home videos from the 1990s, and drone). I also just enjoy fiddling with servers and stuff and thought I could use a home server for a variety of other things. My raspberry pi has been doing well for my home automation but a bigger server might make it faster. I’m trying to learn Blender and have been eyeing a Machine Learning course. Both of those require a nice modern GPU. Finally, I just enjoy learning things about computers.

Some parts
Some parts

Continue reading Building a NAS server/home server in 2017

The Total Solar Eclipse Experience in the Malheur National Forest

Viewing the Eclipse

On June 19th, my little sister sent me Annie Dillard’s essay about her experience viewing the 1979 total solar eclipse and stated that we were going to go see it in Oregon. She said: “This essay has made going to the Eclipse non-negotiable in my mind.” I had been moderately interested but somehow the essay made it sound way cooler that I had previously envisioned and so I got excited about it. There was already hype about how bad traffic would be down in Oregon, but she said she had been thinking about dispersed camping in Malheur National Forest. I looked at a map and it looked pretty good.

Continue reading The Total Solar Eclipse Experience in the Malheur National Forest

Easter eggs in Goodnight Moon

I read that it’s Goodnight Moon’s 70th birthday today. I have it on the bookshelf so I pulled it down to celebrate. Going through it after so many years led me to discover some nice hidden gems worked into the illustrations that I had never noticed before (like when I was 5). I’m sure parents everywhere notice after reading this hundreds of times, but it was fun for me to discover them.

The story takes place from 7pm to 8:10pm

The two clocks in the room are synchronized. They start at 7pm and end at 8:10pm. Each time the room is shown it’s 10 minutes later. I think everyone notices that the moon rises in each scene as well.

Continue reading Easter eggs in Goodnight Moon

Host your own contacts and calendars and share them across devices

I’m trying to learn ways to minimize my reliance upon large companies for handling my day-to-day personal data. So I figured calendar and contacts should be on my list of things to self-host. This post is about how I migrated all my Google calendars and phone contacts to my own server without losing any features I was using. I’m doing this mostly for fun.

My self-hosted calendar in the web client
My self-hosted calendar on the phone

Continue reading Host your own contacts and calendars and share them across devices

Downloading files from an Amcrest security camera with Python

I got a few Amcrest Wifi security cameras for my mom’s house at her request. They’re pretty nice overall (My only complaint is that the web-interface doesn’t fully support Linux). I set one up to save a jpg snapshot to memory every minute and then flew across the country. When I wanted to access them, I couldn’t just put the SD-card in a computer or anything, and clicking all 14,000 of them seemed like a pain, so I decided to figure out how to get them with a Python script.

Continue reading Downloading files from an Amcrest security camera with Python

Reading data from a DXL360 digital level onto your computer

There are some digital levels on the market that are really nice tools to have for a variety of purposes. I grabbed a DXL360 and am really happy with it so far. When I wanted to do an angle vs. time calibration measurement of my Barn Door Startracker over 10s of minutes, I really wanted to get the data from the level into a computer so I could plot and process it a bit.

The level has a USB port but the manual suggests that an optional attachment is required to get it into a computer, at least for this model. However, the manual also states that data comes out of it in RS232 format. I bet I could read that data with some more generic equipment that I have sitting around. And it turned out to be easy. This post shows how I did it.

Continue reading Reading data from a DXL360 digital level onto your computer

Making a cheap and simple barn-door star tracker with software tangent correction for astrophotography

I like to mix hobbies, so naturally I’ve been eying astrophotography for a while. I’ve taken a time-lapse here and a moon picture there but, inspired by the folks over at /r/astrophotography,  I wanted to take it to the next level. Since the Earth is spinning, any long exposure of the night sky has star trails, so you have to make your camera counter-spin if you want clear shots. In this post, you can read about how I made a simple barn door sky tracker to do this.

Barn door sky trackers have been made at home by lots of people for a long time. There are a variety of designs with different levels of complexity and precision required. I thought I’d make the simplest-to-construct one, a Haig mount. To correct he tangent error, I decided to use a cheap microcontroller (MCU) and have it speed up appropriately via software. Fun!

With/without tracker

The Math

The math behind this is fun mostly because it’s straight out of high school and you finally at long last get to use it. Here’s the basic design:

Cartoon of barn door tracker

Continue reading Making a cheap and simple barn-door star tracker with software tangent correction for astrophotography

Spam statistics from my email server

I use SpamAssassin on my e-mail server to flag spam messages that come to my addresses. It uses a series of checks on each message and determines a Spam Score. If the Score is above a user-defined threshold, it adds a header that says that it is spam. Then dovecot files it away into a spam folder instead of my inbox. It does a pretty good job but requires tuning sometimes. I wanted to see if I could change my threshold from the default (5.0) without getting too many false positives or negatives. To do that, I’d have to collect some stats from my messages.

Continue reading Spam statistics from my email server