Room Automation and Raspberry Pi

Most people prefer to come back to a cozy room after a full day’s work. For many, this may not always be possible, unless someone turns on the AC at the right time. For those living alone, help is available in the form of a single board computer, the Raspberry Pi or the RBPi. In addition, the RBPi operates the blinds and you can control it from anywhere in the world – the RBPi is connected to the Internet.

For this project, you will need an RBPi with a suitable SD card, a Wi-Fi dongle, a stepper motor. You will also need a power source capable of driving the RBPi and the motor, a stepper motor driver board, an IR receiver, an IR LED and an NPN transistor.

Controlling the AC is a simple affair, with the RBPi simulating the infrared information the remote control normally uses. You need to use the LIRC library for the RBPi to record this IR information via the IR receiver. The infrared LED driven through the NPN transistor duplicates the signal sent by the remote control of the AC. Initially, you must let RBPi learn the IR codes by recording those using commands in the LIRC library. LIRC produces a configuration file that holds the IR codes for your AC. Playing back these codes through the IR LED allows you to control the AC just as its own remote does.

The RBPi and the motor driver board control a stepper motor for driving the blinds. The RBPi merely drives a GPIO pin to let the motor driver board know if it must operate the stepper. The driver board already has the necessary parameters stored within it for driving the motor. By default, the motor remains off so that it does not waste power when it is not needed. The software takes care of this by turning off the Enable pin on the stepper driver board. When you need to operate the blinds, a script on the RBPi turns the GPIO pin on and off.

To operate the unit from remote, you need to connect the RBPi to the Internet via a wireless network. Use the Wi-Fi dongle for this, configuring the RBPi to switch on the wireless connection immediately after booting. Web access to the stepper motor controller is through Nginx and PHP.

The entire setup works when the RBPi connects wirelessly to the network. You access a web interface and use it to send commands to the controller script running on the RBPi. Depending on the commands sent, you can access either the blind opener or the AC control. For opening the blinds, the RBPi sends on or off signals to the stepper motor controller board.

On the other hand, the RBPi sends the appropriate commands to the air conditioner via the IR link. Depending on the code transmitted over the IR link, the AC will switch either on or off. Additionally, with proper codes transmitted from the RBPi to your AC, you can even set the temperature of the room before returning at the end of the day.