Introduction: How to Control Your BLINDS With Cayenne IoT and Make a Sun Natural Alarm Clock

Picture of How to Control Your BLINDS With Cayenne IoT and Make a Sun Natural Alarm Clock

Hi! I'm Neoxelox, and today I will show you how to control your BLINDS (Pull up/down and stop) with Cayenne IoT, and with it's schedule manager make an Sun natural alarm clock!

We need:

- Cayenne Acccount

- IR Emitter (Mine is KEYES IR Emitter)

- Arduino (Obviously)

- Ethernet Arduino Shield

- Blinds that can be controlled through IR

- IRremote library: http://www.mediafire.com/file/noes8859gos4ka4/Arduino-IRremote-master_%281%29.zip

Step 1: Connect the IR Emitter to Arduino and Also the Triggers

Picture of Connect the IR Emitter to Arduino and Also the Triggers

Connect the IR Emitter to Arduino board.

Pinout:

IR Emitter / Arduino

pin "-" ---> pin GND

this pin doesn't have any letter so, the middle pin ---> pin 5V

pin "S" ---> digital pin 3 or other digital pin (It cannot be pin 0,1,2 or 13)

Triggers:

I was thinking what is the easiest way to do this project, and I realized if we connect a wire through digital pin 9 to 8 and digital pin 7 to 6 is the best way to do it, so:

Connect Arduino digital pin 9 to Arduino digital pin 8, repeat with 7 to 6.

Step 2: The Code

Picture of The Code

Just copy that (Obviously you need to change the line 33 with your IR Emitter digital pin.

And also you have to know what speed you IR Emitter works with (mine 38 khz).

And one thing important is that you have to know what are your Blinds IR Raws, I mean the numbers that represent the action "Pull Blinds Up/Down and Stop". If you don't know this, you can dumb your remote control with this library and with a IR Receiver (In the library you have and example of "Dump", just execute that and press the buttons of your remote control).

/*
Cayenne Button Widget Example

This sketch shows how to set up a Button Widget with Cayenne.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps: 1. In the Cayenne Dashboard add a new Button Custom Widget. 2. Select a digital pin number. Do not use digital pins 0 or 1 since those conflict with the use of Serial. 3. Attach a digital output device (e.g. a LED) to the digital pin on your Arduino matching the selected pin. 4. Set the token variable to match the Arduino token from the Dashboard. 5. Compile and upload this sketch. 6. Once the Arduino connects to the Dashboard you should be able to control the digital output device with the Button widget.

Notice that there isn't much coding involved to interact with the digital pins. Most of it is handled automatically from the Cayenne library.

For further examples of how to receive data from Cayenne see the example sketches under Actuators. */

#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space

// If you're not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples. #include

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard. char token[] = "********";

#include #include IRsend irsend; IRrecv irrecv(3);

int khz = 38; unsigned int PullBlindsUp[] = {6000, 4200, 560, 760, 560, 560, 360, 1690, 560, 560, 860, 560, 560, 560, 560, 560, 560, 260, 560, 1690, 560, 1890, 560, 560, 560, 1390, 160, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; unsigned int PullBlindsDown[] = 6000, 5600, 860, 760, 560, 560, 360, 2690, 560, 560, 860, 660, 560, 560, 460, 560, 560, 560, 560, 1690, 560, 1890, 560, 560, 560, 1690, 160, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; unsigned int StopBlinds[] = {2000, 3200, 960, 760, 560, 560, 360, 1790, 560, 560, 860, 560, 760, 560, 560, 560, 560, 960, 560, 1690, 560, 1890, 560, 560, 560, 1490, 160, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560};

void setup() { pinMode(8, INPUT); pinMode(6, INPUT); Serial.begin(9600); Cayenne.begin(token); }

void loop() { Cayenne.run(); if(digitalRead(8)==HIGH){ irsend.sendRaw(PullBlindsUp, sizeof(PullBlindsUp) / sizeof(PullBlindsUp[0]), khz); while(digitalRead(8)==HIGH){} }else{ irsend.sendRaw(StopBlinds, sizeof(StopBlinds) / sizeof(StopBlinds[0]), khz); } if(digitalRead(6)==HIGH){ irsend.sendRaw(PullBlindsDown, sizeof(PullBlindsDown) / sizeof(PullBlindsDown[0]), khz); while(digitalRead(6)==HIGH){} }else{ irsend.sendRaw(StopBlinds, sizeof(StopBlinds) / sizeof(StopBlinds[0]), khz); } }

Step 3: Set Up Cayenne IoT Buttons

Picture of Set Up Cayenne IoT Buttons

Set Up Cayenne IoT Buttons as the images show.

PD:

You DON'T need a third button called "Stop", because when you are NOT pressing any of the other buttons the blinds will STOP.

Step 4: Test It and You FINISH!!!

Picture of Test It and You FINISH!!!

Test it and you will finish!! Hope you like it!!

PD:

There is more below :D

Step 5: (OPTIONAL) You Can Make a Sun Natural Alarm Clock

Picture of (OPTIONAL) You Can Make a Sun Natural Alarm Clock

You can make a Sun natural alarm clock with Cayenne's Scheduler manager, just click option button in the Pull Blinds Up, and press Schedule. Then modify it as you want. The blinds will Pull Up, and all the solar light will enter into your room. :D

Comments

About This Instructable

410views

22favorites

License:

More by Neoxelox:How to make an Universal TV Remote Control with Cayenne IoTHow to Control Your BLINDS With Cayenne IoT and Make a Sun Natural Alarm ClockHow to Control a ROBOSAPIENS Robot With Cayenne IoT
Add instructable to: