Remote AC Control

So I guess I hacked Scotty’s account… or he just gave me access because he’s a top bloke. Either way I decided I better make good use of his blog space and post something constructive.

I thought I’d start with a couple of simple projects I completed. Today I’ll delve into my Air Conditioner Controller. Sometime next week I’ll show off my Arduino powered GPS Speedometer that won me $50 bucks from Jaycar.

So this little project came about over summer. We were getting some very hot days and I have a ten year old swampy on the roof of my house (an evaporative cooler). One of the multitude of problems with coolers like this is that the take ages to actually start bringing the temperature down. So after a long hot day away from home it takes a good thirty to forty minutes to bring the temperature down to something reasonable.  I can’t leave the thing going as a swampy requires the windows and doors to be open otherwise you end up with condensation over everything after two or three hours and a timer means I’m on some kind of time limit to get home. Bugger that.

So remote access it needs to be. If I’m at my parents in law, it’s a forty-minute trip, enough time to bring down the room temperature.

I already have a server running at home which I have remote access to, so getting into the home network isn’t an issue. What I need is a robot arm to push a button that I can control over the home network. I contemplated the idea of an Arduino with an Ethernet shield running some form of a relay in lieu of the robot arm, however after having a look at the bastardised versions of SSH on Arduino, it just didn’t float my boat. I needed something that had GPIO outputs, could run SSH and probably Python and preferably supported WiFi. Raspberry Pi!

A Raspberry Pi running Raspbian (Debian) was perfect. SSH in built, Python with a GPIO library and of course GPIO outputs – as well as WiFi support. I needed to do a couple of things though, not only do I need to be able to turn the thing off and on, I need to know what state it’s in. After starring at the AC control pad for a minute I realised something obvious, there’s a lovely power LED on the front of the unit. I had a spare Light Dependent Resistor (LDR) lying around and some other components – if I could get some baseline readings it could tell me if it’s on or off.

I did some shopping on eBay an found myself a 5 Volt relay. I also picked up a spare Arduino development shield, I like these as they have a common ground and positive rail, which makes building an LDR circuit (amongst others) nice and easy. It’s a fairly simple circuit, LDR, resistor and a capacitor while using a GPIO pin on the rPi to get the reading.

After ripping the AC controller off the wall I found the solder points for the physical switch, subsequently I soldered a couple of short wires to it and inserted the LDR into the case behind the power LED.

I found some Python code online (I’ve only just started playing around in Python), which had been used for opening and closing a garage door, I cleaned it up a little and managed to get my relay working quite nicely.

The only major issue I found was actually in my LDR Python code. When the LED was off it was taking a large amount of time to return the values (as it was completely dark in the enclosure). A simple exception handler worked here, it functioned on the basis that if no response was received form the LDR in ‘X’ seconds it reported the unit as off – it also displayed how it got its response. I did this as in the instance that the system was on it received a reading in less than half a second or so.

So here's the command line output:



I have SSH apps on all my portable devices, which means I can now turn my AC on or off as well as check its status no matter where I am in the world.

Overall I was really happy with this project, I managed to get it together for less than $100 and on the odd occasion when I feel like playing with a Raspbian interface I log in and enable VNC and screen share from my AC controller to my lappy. I should mention that the case does have a clear cover, it’s just hard to get photos with it on!

Finally, the finished project, mounted on the wall (the one visible black cable is the power cable):



Comments

Popular posts from this blog

Installing OpenGD77 on an Retevis RT3s

Installing DD-WRT on a TP-LINK TL-WR842ND

Baby Monitor LCD Repair