Introduction: Automated Climate Control

I'm picky about how I like the climate in my room, especially in the winter. I like the fan on when I go to bed, because I like the white noise and the breeze, but I also like it to be humid, otherwise I get shocked every time I step on the carpet. Controlling all of these things on their own can be a real hassle, so I created a system to automate the process.

Step 1: Supplies

You're gonna need quite a bit here, but lucky for us none of these parts really break the bank.

For the fan and Humidifier, any old fan or Humidifier will do. The only requirements are that you can put them on a setting and can control them by killing the power.

Step 2: Controlling Your RF Outlets

Now, let's about how we'll control these outlets. The basic premise is this:

- We'll capture the RF Signal being emitted from the remote that controls the outlets.

- Then, we'll store those codes in our LinkIT ONE and emit them from our board, so the remote doesn't have too.

So, let's get started!

Step 3: Wiring Up Your RF Receiver and Transmitter

In order to catch the signals being emitted by the remote, we'll need to hook up the Receiver. Then, to emit the signals ourselves, we'll need to hook up the Transmitter. So let's just go ahead and hook up both right now so we get it out of the way.

Both the receiver and transmitter have relatively simple pin layouts. Hook it up just like the diagram attached.

Step 4: Catching the RF Signal From the Remote

Now we need to figure out the RF Signal code that is being emitted from the remote. These codes will be our secret keys to turn out outlets on and off. Once we know them, we can have the LinkIt ONE emit them instead of the remote and automate them going on and off!

In order to do this, we'll need to help of a library called rc-switch. This library, originally built for the arduino, will help us interface with our RF Transmitter and Receiver. Make sure you head over to the github site, download it, and install it.

Also on that website, you'll want to grab the example code ReceiveDemo_Advanced. This code snippet will be used to catch the different signals our RF Receiver gets. Deploy it to your LinkIT ONE and watch the serial monitor. When you click a button on your outlet remote, you should see something like this:

Decimal: 3932352 (24Bit)<br>Binary: 110011010101010000000011 
Tri-State: 011000001000
PulseLength: 168 microseconds
Protocol: 1

The Binary string is what we're really after here. This binary string (which could be converted to hexadecimal) is the special code that the RF remote transmits. You'll want to map out which string each button emits (there should be several on and off button mappings).

Step 5: Transmitting the RF Signals and Turning the Fan and Humidifier On

Now let's practice controlling our Fan and Humidifier with our remote outlets. Since we've mapped out all the binary RF signals already, with some help from the rc-switch library, this is actually quite the breeze.

Plug in the fan and humidifier to their own respective RF outlets. Go back to your map and figure out what signals need to be emitted to switch it on or off. Then, use the rc-switch library to emit those signals!

#include rc-switch<br>
RCSwitch mySwitch = RCSwitch();

void setup() 
  mySwitch.enableTransmit(10);  // Using Pin #10
void loop() 
  mySwitch.send("000000000001010100010001"); //Signal to turn on the Fan
delay(10000); //Wait 10 seconds to give it time to get turning

mySwitch.send("00000000000101010100001"); //Signal to turn OFF the fan<br>

Step 6: Tying the Logic to Our Temperature Sensor

Now that we are able to control our Fan and Humidifier, let's add some logic to tie it to our temperature sensor. This way when the air gets too dry or too hot, we can turn on our fan. I'll also download and install the TimeAlarms library so that I can create an automated alarm to turn my Humidifier on and off at certain times in the day (I keep mine going overnight, but off during the day).

Connecting the TMP36 is simple enough. You'll simple want to connect the middle pin to A0, and then the other pin to ground and 5 volt (look at the diagram above to discover which is which).

Now, we'll deploy code to read in the temperature and react! It's as simple as that!

The code attached is heavily commented to help you understand all the different aspects of it.

Step 7: Deployment!

Now you have your very own automated indoor climate system! You're free to enjoy the comfort of your own home without constantly worrying about the fan or humidifier!

Hopefully this instrcutable has taught you a thing or two, and introduced you to the powerful capabilities of the LinkIt ONE!