Automatic Blinds Opener
by wabarrineau in Workshop > 3D Printing
1103 Views, 11 Favorites, 0 Comments
Automatic Blinds Opener
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).
My project is an automatic blinds opener. There is a servo inside of the casing that has the 2 blinds strings attached to opposite sides, which are fed through the top of the encasement (which is actually the left side in the picture). By rotating the servo clockwise or counterclockwise, the blinds are opened or closed. The servo acts as an output with 2 buttons and an IR remote acting as inputs. This gives the user the option to either control the mechanism with the push of a button, or the click of a remote. In this instructable, I will demonstrate the breadboard setup, the Arduino sketch and the 3D printed parts.
The Arduino Breadboard
The Arduino breadboard setup can be seen in the attached picture. The servo is attached to the 10 pin, and the IR receiver is attached to the 11 pin with both buttons attached to the 2 and 4 pins. All 4 of the components are grounded and powered by the 5V pin. Resistors are used for both the buttons and the IR receiver.
The Arduino Sketch
Here is the fully commented sketch used for the breadboard setup. "//" denotes comments after the code and will be treated as such when the code is copied and pasted. All of the headers can be found at Makecourse.com.
#include <IRremote.h>
#include <IRremoteInt.h> //2 Headers for the IR remote
#include <Servo.h>
#include <Wire.h> //2 Headers for servo
Servo myservo; //Defines servo
int pos = 90; //Sets the initial position of servo
int RECV_PIN = 11; //Sets the IR pin as 11
IRrecv irrecv(RECV_PIN);
decode_results results; //Allows results to be displayed for IR remote
const int ButtonPinA = 2; //Sets Button A as 2
const int ButtonPinB = 3; //Sets Button B as 3
const int ServoPin = 10; //Sets servo as 10
int buttonStateA = 0;
int buttonStateB = 0; //Sets the button states to 0
void setup() {
myservo.attach(10); //Attaches the servo to pin 10
Serial.begin(9600); //For serial monitor
irrecv.enableIRIn(); //Enables IR input
pinMode(ServoPin, OUTPUT); //Sets servo as an outpout
pinMode(ButtonPinA, INPUT); //Sets Button A as an input
pinMode(ButtonPinB, INPUT); //Sets Button B as an input
myservo.write(90); //"Writes" servo as 90 degrees
}
void loop() {
if (irrecv.decode(&results)){
if (results.value == 16754775) { //Sets remote frquency for "+"
pos = pos+5; //Makes servo move 5 degrees clockwise when "+" is pressed
myservo.write(pos);
}
if (results.value == 16769055) { //Sets remote frquency for "-"
pos = pos-5; //Makes servo move 5 degrees counterclockwise when "-" is presse
myservo.write(pos);
}
Serial.println(results.value); //Prints values in serial monitor
irrecv.resume();
}
if (digitalRead(ButtonPinA) == HIGH) {
pos = pos+5; //When Button A is hot, the position moves 5 degrees clockwise
myservo.write(pos);
}
if (digitalRead(ButtonPinB) == HIGH) {
pos = pos-5; //When Button B is hot, the position moves 5 degrees counter-clockwise
myservo.write(pos);
}
delay(500); //There is a 500 ms delay on the buttons
Serial.println(pos); //Position is printed on Serial Printer
}
3D Printed Parts
There are three 3D printed parts required for this project, though this is very subjective to the creativity of the maker. I attached renderings of the 3D parts that I used, 2 for the case and the wheel that attaches to the servo. All of the other parts in the renderings are from the Arduino kit. All that is necessary for this to work is an opening for the blinds to go through, an opening for the two buttons, and an opening for the Arduino's USB to update the code based off of the length of the blinds. The wheel that attaches to the servo that turns the blinds is also subjective; a wheel is effective but anything that loops the blinds can be used.