Skip to main content

Room automation

[This is my 2nd "catching up" post - I started this project in summer 2009 and am just getting around to documenting it]

After finishing my 4 channel light dimmer, I wanted to create a comprehensive room automation system, inspired by fellow MIT student Zack Anderson's MIDAS project.

Having just been introduced to the world of Arduino, I chose to use an Arduino as the central microcontroller. In order to make the automation more useful, I hooked the Arduino up my server (a Dell PowerEdge 2500 deskside server I picked up for free on Reuse - MIT's recycling/reuse mailing list) so that I could integrate a web interface and more sophisticated control logic. More on this later.

The first step to the automation system hardware was getting all of my lights computer-controlled. I piggy-backed my 4-channel light dimmer to the Arduino's serial pins such that messages from my computer would go to both the light-controller and room-automation Arduinos. Next, I needed a way to turn my room's built-in fluorescent lights on and off. I decided that replacing the wall switch with a relay would probably get me in trouble with my dorm's facilities manager (not to mention the risk of electric shock since I couldn't access the circuit breaker), so I was constrained to physically flipping the switch externally. I built a servo mount that screws into the switch plate and holds a servo next to the switch - the servo's arms are then able to flip the switch on or off. Pretty simple. Unfortunately, this covered up most of the switch, making it hard to manually turn on the lights, so I attached a GP2D02 IR distance sensor so that I could wave my hand in front of it and the servo would flip the switch. Cool, now I've got a computer-controllable, hands-free light switch.

Next I wanted to motorize my window shade. I have a theory that I wake up more pleasantly and in a better mood if sunlight is slowly let into the room in the morning rather than using a jarring alarm clock. I made a trip to American Science and Surplus
(an awesome surplus store with all sorts of electronics junk that you don't need) to browse for a decent motor to use. I found a neat motor+gearbox that spun at about 100rpm (a little slow, but not bad) and had a built-in microswitch for counting revolutions for $5. I hooked it up to the arduino with a TA7291P motor driver, and wrote a simple program that would rotate the motor to a specific position. To my dismay, the whole gearbox assembly was fairly loud when spinning at full speed, which was a problem if I wanted to peacefully wake up by opening the shade. I tried PWM, but that caused the motor to "whine" and even then I couldn't get the motor to go very slowly before it would just stall. Luckily, the TA7291P has built-in voltage control, so I hooked up a transistor which allowed the Arduino to switch the reference voltage and be able to drive the motor at a low voltage. By driving the motor at a lower voltage, I achieved a slower speed than possible with just PWM, while also avoiding the "whine." At the low speed, the window shade takes about 10-15 minutes to fully open, which is perfect for a gentle awakening.



[Funny anecdote: I stopped by Microsoft's booth at the career fair and happened to mention my room automation - the recruiter chuckled and let me know that one of their normal interview questions is how to design a remote controlled window shade.]



--- The main control board. Notable components from left to right: filter cap (since servo is on 5V supply), 5V regulator, transistor for switching window shade motor speed, TA7291P motor driver, and at the very end (but not visible) an Arduino USB board.


I guess now would be a good time to mention how my computer fits into the picture. One of my big requirements for this system was the ability to control my room over the web from my phone or iPod Touch. There's an Ethernet shield for the Arduino, but since I already had a server running in my room 24/7, I just hooked the Arduino up to that via USB. I wrote a backend server in Java that handled the serial interface to the Arduino and exposed a socket interface to the rest of the computer. The web frontend was made with PHP, which opens a socket to the Java backend in order to send commands to the Arduino. This allowed me to turn on/off my room light, dim 4 other lights, and control my window shade all from a simple web interface. I also wrote a "wakeup" cron script that opens the shade slowly every morning.

Now that I've got the basic pieces in place, I'd like to abstract the idea into a simpler all-encompassing system. I envision being able to select moods or activities rather than setting the brightnesses of each light, and I'd like to integrate music and movie control as well. By next year I want to be able to click a single button on my iPod touch, and watch as the lights dim, the window shade closes, and a movie starts playing.

Comments

Popular posts from this blog

OpenSCAD Rendering Tricks, Part 3: Web viewer

This is my sixth post in a series about the  open source split-flap display  I’ve been designing in my free time. Check out a  video of the prototype . Posts in the series: Scripting KiCad Pcbnew exports Automated KiCad, OpenSCAD rendering using Travis CI Using UI automation to export KiCad schematics OpenSCAD Rendering Tricks, Part 1: Animated GIF OpenSCAD Rendering Tricks, Part 2: Laser Cutting OpenSCAD Rendering Tricks, Part 3: Web viewer One of my goals when building the split-flap display was to make sure it was easy to visualize the end product and look at the design in detail without having to download the full source or install any programs. It’s hard to get excited about a project you find online if you need to invest time and effort before you even know how it works or what it looks like. I’ve previously blogged about automatically exporting the schematics, PCB layout , and even an animated gif of the 3D model to make it easier to understand the project at a glanc

Scripting KiCad Pcbnew exports

This is my first post in a series about the  open source split-flap display  I’ve been designing in my free time. Check out a  video of the prototype . Posts in the series: Scripting KiCad Pcbnew exports Automated KiCad, OpenSCAD rendering using Travis CI Using UI automation to export KiCad schematics OpenSCAD Rendering Tricks, Part 1: Animated GIF OpenSCAD Rendering Tricks, Part 2: Laser Cutting OpenSCAD Rendering Tricks, Part 3: Web viewer For the past few months I’ve been designing an open source split-flap display in my free time — the kind of retro electromechanical display that used to be in airports and train stations before LEDs and LCDs took over and makes that distinctive “tick tick tick tick” sound as the letters and numbers flip into place. I designed the electronics in KiCad, and one of the things I wanted to do was include a nice picture of the current state of the custom PCB design in the project’s README file. Of course, I could generate a snapshot of the

Using UI automation to export KiCad schematics

This is my third post in a series about the open source split-flap display I’ve been designing in my free time. I’ll hopefully write a bit more about the overall design process in the future, but for now wanted to start with some fairly technical posts about build automation on that project. Posts in the series: Scripting KiCad Pcbnew exports Automated KiCad, OpenSCAD rendering using Travis CI Using UI automation to export KiCad schematics OpenSCAD Rendering Tricks, Part 1: Animated GIF OpenSCAD Rendering Tricks, Part 2: Laser Cutting OpenSCAD Rendering Tricks, Part 3: Web viewer Since I’ve been designing the split-flap display as an open source project, I wanted to make sure that all of the different components were easily accessible and visible for someone new or just browsing the project. Today’s post continues the series on automatically rendering images to include in the project’s README, but this time we go beyond simple programmatic bindings to get what we want: the