230V Air Conditioner and HomeKit, part 3: Raspberry Pi

Warning: For the rest of this series of blog posts about this project, I’m going to take a “golly gee-whiz” approach. If you’re an experienced Maker, computer programmer, electrician, or human being you may be bored by them. However, please feel free to read on and (a) laugh at my ignorance, and/or (b) warn me that I’m about to burn down my home.

In the previous post in this series, I went over why I though it was difficult to replace my air conditioner, and so (with substantial help from Dr. Sam Groveman), I planned to create my own Homekit-based controller to turn my A/C on and off.

The first step in the project was to set up a Raspberry Pi, a small computer designed for use in home projects. I purchased the latest model, a Raspberry Pi 3 model B+, as part of a package from Canakit. This included some nice accessories like a case, an HDMI cable (which I never used; see below), and the Raspberry Pi installation software (NOOBS) on an SD card.

I had no problems following the instructions that came with the kit, and inserted the Raspberry Pi in its case:

RPi assembeled

In the picture, you can see that I installed the optional aluminum heat sinks
on the processor and Ethernet/USB controller; those are the gray vertical ridges you see in the central area of the board. They help keep the chips from overheating during intensive computer tasks. This is not a computationally intensive project, but I decided to play it safe.

Next comes the installation of the Raspberry Pi’s operating system, Raspian. The SD card that came with the Canakit had the software, but I needed a way operate the Raspberry Pi during that installation: a keyboard, mouse, and computer monitor.

There are four USB ports in a Raspberry Pi, and I had plenty of spare USB keyboards and mice that I could take out on loan from work. However, for video display the Raspberry Pi only has an HDMI port, and all the available spare monitors at work were old and only had VGA ports. Foreseeing this, I purchased an HDMI-to-VGA adapter.

When I cabled up the Raspberry Pi to all these devices, it looked like this:

RPi hooked up for initialization

In the lower right is the adapter, with a VGA cable plugged in (the adapter doesn’t come with one). The adapter’s power comes from a USB connector plugged into the Raspberry Pi’s right-hand side, along with the USB keyboard and USB mouse. On the bottom of the Raspberry Pi, the HDMI connector from the adapter is plugged into the HDMI port. The last connector on the lower left is the Raspberry Pi’s power cable, which connects to a power dongle that fits into a standard power outlet.

Again, there were no problems with the software installation. It took a few minutes for NOOBS to install Raspian:

Raspian installation

Edit: It later turned out that it might have been a bit easier if I did a Raspian image install instead of using NOOBS; see part 6.

Following the directions in the Canakit, I logged into the Raspberry Pi and connected it to my WiFi network.

For such a small computer, I was pleasantly surprised at the amount of software that came preinstalled in Raspian. At work I use CentOS and on a Mac there’s Darwin. Raspian is based on Debian, with which I have much less experience. Still, I knew enough to navigate around the directories, look for configurations files, and install my favorite text editor, emacs.

As nice as the Raspian graphical interface was, I wanted to program the Raspberry Pi by connecting to it via ssh from my desktop Macintosh. I enabled the SSH service via one of the preference menus, and noted the IP and MAC address of the Raspberry Pi:

ifconfig.jpg

I got the above by running the Terminal program and typing ifconfig on the command line. (If you’re sharp-eyed, you’ll notice that I created a ‘seligman’ account to use instead of the standard ‘pi’ account. I won’t go into how I did this [since most folks will probably be happy to use ‘pi’] but you’ll see why I did this below.)

The output above told me that my WiFi router had assigned the IP address 10.0.1.10 to the Raspberry Pi; it’s the number after the ‘inet’ in the ‘wlan0’ paragraph. I went to my desktop Mac and verified I could connect to the Raspberry with either ssh pi@10.0.1.10 or ssh seligman@10.0.1.10. That was fine, but of course I wanted more.

I went into my WiFi router’s configuration and told it that the MAC address of the Raspberry Pi (it’s after the word ‘ether’ in the above picture) was always to be assigned the IP address 10.0.10.0. That assured me that the Raspberry Pi would always have the same IP address no matter how or when I rebooted it (unless my router went down, in which case I’d have much bigger problems than fiddling with the Raspberry Pi). Then I edited the contents of a configuration file on my desktop Mac:

sudo emacs /etc/hosts

…adding the line

10.0.1.10 rpi

This meant that from now on, my desktop Mac would interpret the IP name ‘rpi’ as the IP address ‘10.0.10.0’. Now I could login to the Raspberry Pi with ssh seligman@rpi.

Good enough? Of course not! Fortunately, with ssh, if you don’t supply an account name, it assumes the same name as the account you’re using to issue the ssh command. On my Mac, that account is ‘seligman’. So I can login to my Raspberry Pi with:

ssh rpi

Is that good enough? Almost. I still have to type the password for the ‘seligman’ account on the Raspberry Pi every single time I login. Since my network is private, why go through that hassle? I set up passwordless ssh from my Mac’s ‘seligman’ account to the Raspberry Pi’s ‘seligman’ account. Now all I have to do on my Mac is type ssh rpi and I’m on the Raspberry Pi, ready to work.

Since I configured remote access to the Raspberry Pi, there’s no need for the keyboard, mouse, and monitor to be attached to it anymore. Here’s the Raspberry Pi, all configured, accessible, and ready for the next phase of the project:

About the size of a deck of playing cards

I included the deck of cards so you can get an idea of the size of this small computer.

Next up: Homekit and GPIO

230V Air Conditioner and HomeKit, part 2: The Air Conditioning

In what turned to be Part One of an adventure in the Internet of Things, I talked about wanting to control my air conditioner via Apple’s Homekit.

One option I contemplated was replacing my existing air conditioner. To get some idea of what it would take, I removed the front cover, which I’ve done every mumblety-mumble years to clean the filter. Here’s what I saw:

AirConditioner 2018

It’s old and rusty, just as I remembered. It looks like replacing it might be a good idea. I had investigated the procedure for replacing a through-the-wall air conditioner; the instructions begin “Lift the old air conditioner out of the sleeve.” No way. The air conditioner is rusted into place.

To replace the air conditioner would require hiring a contractor. My guess is that it would cost $2000 minimum. I don’t begrudge contractors their money; I charge $120/hour for computer consulting, and that fee is on the very low end. But it’s more than I can afford to replace an appliance that works well, and whose only flaw is being old and unattractive. If we replaced everything that was old and unattractive, I’d find myself in a landfill sooner or later.

Another web site I checked said that old air conditioners were more robust than modern models. The site suggested that you could take an old unit through a car wash to restore it. I’d consider that if I could get the unit out of the wall. But if I could do that, I’d replace the unit anyway.

You can see in the picture that the A/C is missing the knob that controls whether the air exchanger is open or closed. I wrote in my previous blog post that the switch was frozen shut. I tried turning it with a pair of pliers, and it rotated easily. All I need is a new knob. I ordered a cheap knob; if it doesn’t fit, it’s no big deal.

I saw something I hadn’t noticed before: the sticker with the model information for the A/C:

AC Model

Now I knew that I had a Fedders model 4320W. I did a web search, and found nothing. You can give it a try, but I have a hunch that the only significant positive search result you’ll find is this blog post.

That fit in with what I suspected: This A/C has been in the apartment since the complex was built in the 1970s.

The label also gave me some pertinent information for using Homekit switches: Its maximum draw is less than 11 amps and 2100 watts. It also provides about 12000 BTU; no wonder it does such a good job cooling a 400-square-foot living room! I can’t tell whether it’s using 230V or 208V, because apparently it can handle both:

AC Voltage Instructiongs

I don’t want to fiddle with that switch. The only way to know for sure is to use a voltmeter on the outlet providing the power, and that’s difficult for me to reach.

11 amps is well within the capabilities of typical Homekit-style switches and relays. I had a discussion with Dr. Sam Groveman, and emerged with a plan and a Bill of Materials to order. Those parts should arrive during the coming week. I’ll describe the project and assembly in future blog posts.

If you’d to get some idea of what I’m doing without being exposed to my verbosity or waiting for those posts, here’s a description of a similar project. The main difference between that and what I plan to do is that Sam recommended I don’t bother with an Arduino for my setup.

230V Air Conditioner and HomeKit

I could use some advice from anyone with electrical, appliance, and/or construction experience.

I’ve got an old air conditioner in my apartment. It’s the same one I had when I moved in, so it’s at least 30 years old. I’ve also got Apple Homekit set up for other devices in my apartment (light bults and fans).

The goal: control my air conditioner through Homekit. The dream: Before I go home, I turn on the A/C remotely so the apartment will be cool when I get there. Double dream: use Homekit to connect my thermostat to the A/C so that it would turn on if the apartment temperature got over 85 degrees, to keep my pets comfortable.

There are plenty of Homekit devices that plug into conventional wall outlets. Here’s one that I already use.

For those of you keeping score at home, most home plugs and outlets are NEMA 5-15:

This old A/C uses a NEMA 6-15 plug, I think; it’s pretty grungy after 30 years. It looks like this:

AC plug

A new plug of this type looks like this:

The outlet looks like this (it was the best I could do sticking my iPhone behind a bookcase):

AC outlet

This looks like a NEMA 6-20 outlet, but it doesn’t match what’s in use today. A current NEMA 6-20 outlet looks like this:

Again, for those like me who are keeping score at home, this means that my A/C can draw up to 15 amps of current at 240 volts.

The studliest Homekit switch I know of is the Eve Energy Smartplug. It can handle up to 250V, it’s rated for 11A at the most. With my current A/C, even if I could solve the outlet compatibility issues, either a circuit breaker would trip or a fuse would blow if I used it for my air conditioner.

So now we get to the advice I need from people who know what they’re doing:

  • Is it possible to set up some kind of relay so a 15A/120V device can control a 20A/240V device? My web searches suggest that it’s possible, but you need to have electrical experience to construct one and no one has put up any “how to” plans yet. Can you think of something?
  • As I said, my current A/C is over 30 years old. It is certainly not energy efficient. It’s not remote controlled (so devices like Tado won’t work). The latch that lets in air from the outside froze shut 20 years ago, so I can’t use just the fan to vent in cool air when it’s hotter inside than outside. And you can see the picture of the plug above; I’m not sure it’s safe anymore.

    So I’m willing to consider buying a new one. There are Homekit-compatible air conditioners coming onto the market. That leads to contractor-style questions:

    • They make plenty of wall-mounted air conditioners with NEMA 6-15P plugs. I can’t seem to find one that’s Homekit compatible. Do you know of any? (Translation: Is your web-fu better than mine?) Or will I have to accept a Tado-like solution?
    • Alternatively, modern air conditioners draw less current than my old A/C. My living room is about 400 square feet. A decent wall-mounted air conditioner like this one draws less than 5 amps. So it’s theoretically possible to use the Eve Smartplug, if I can solve the outlet compatibility issue.
    • Is it worth solving this problem a different way, by replacing that old NEMA 6-20 outlet with a NEMA 5-15, with a suitable downgrade in voltage? Then an unmodified Eve Smartplug would work. I’m certain that a modern A/C with a NEMA 5-15 plug could handle 400 square feet.
    • How difficult is it to replace a wall-mounted air conditioner? My preliminary web search says that it’s not that difficult, but I’m clumsy when it comes to this sort of work. Is this the sort of thing that I’d have to hire a contractor to do?

      Before you ask: I’ve got a good relationship with my superintendent. He doesn’t mind me doing this sort of work in my apartment, as long as I don’t get him and the landlord involved.

I’ll gratefully listen to any advice, even if that advice must be “Suck it up, Homekit-boy, and live with what you’ve got.”