Skip to content
  • 💬 Roller Shutter Node

    OpenHardware.io rollershutter current sensor relay blinds
    107
    2 Votes
    107 Posts
    38k Views
    jeremushkaJ
    My current roller roller Shutter switch are two pushed buttons up and down. No stop button. When release the push button up or down, the shutter will stop. WIll it be compatible with this board or will i have to change the buttons ?
  • 6 Votes
    19 Posts
    28k Views
    slartiS
    My ethernet gateway died and I made another one on a Raspberry Pi so I updated all of my sensors from 1.4 libraries to 2.2. Here's the updated sketch for these servo blind control nodes: // A sketch to control a servo with a button and MySensors messages //#define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <SPI.h> #include <MySensors.h> #include <Servo.h> #include <Button.h> //https://github.com/JChristensen/Button #define BUTTON_PIN 4 //Connect a tactile button switch (or something similar) //from Arduino pin 4 to ground. #define PULLUP true //To keep things simple, we use the Arduino's internal pullup resistor. #define INVERT true //Since the pullup resistor will keep the pin high unless the //switch is closed, this is negative logic, i.e. a high state //means the button is NOT pressed. (Assuming a normally open switch.) #define DEBOUNCE_MS 20 //A debounce time of 20 milliseconds usually works well for tactile button switches. #define LONG_PRESS_PERIOD 700 //How long to keep button pressed until sweeping starts #define MAX_DEGREES 180 //Servo limits. Whatever works for you. #define MIN_DEGREES 0 #define CHILD_ID 3 Button myBtn(BUTTON_PIN, PULLUP, INVERT, DEBOUNCE_MS); //Declare the button Servo myservo; enum {DECREASING, INCREASING}; //On a servo mounted on the left, with outer slat edge down as closed, // closing is going toward 180, opening toward 0 (on my fake futaba s3003's) boolean invertConversions = true; // false if opening toward 180 boolean servoDirection = INCREASING; //A variable that keeps the current servo direction int servoPin = 3; int servoPosition; int servoSpeed = 1; // The bigger, the faster. 1=slow 5=fast MyMessage msg(CHILD_ID, V_PERCENTAGE); void setup(void) { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Servo", "1.3"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_COVER); } void loop(void) { myBtn.read(); //Read the button if (myBtn.wasReleased()){ //If the button was pressed once sweep to end of current direction SweepToDirectionEnd(); send(msg.set(ConvertDegToPercent(servoPosition))); } if (myBtn.pressedFor(LONG_PRESS_PERIOD)){ //If the button is held down the servo will start to sweep SweepUntilStop(); send(msg.set(ConvertDegToPercent(servoPosition))); } } int ConvertPercentToDeg(int percent) { int degree; if (invertConversions) degree = map(percent, 0, 100, MAX_DEGREES, MIN_DEGREES); if (!invertConversions) degree = map(percent, 0, 100, MIN_DEGREES, MAX_DEGREES); return degree; } int ConvertDegToPercent(int degree) { int percent; if (invertConversions) percent = map(degree, MAX_DEGREES, MIN_DEGREES, 0, 100); if (!invertConversions) percent = map(degree, MIN_DEGREES, MAX_DEGREES, 0, 100); return percent; } void receive(const MyMessage &message) { myservo.attach(servoPin); if (message.type==V_PERCENTAGE) { int val = message.getInt(); SweepToPosition(ConvertPercentToDeg(val)); //In this case the value has to be inverted because 0 = open send(msg.set(val)); } else if (message.type==V_STATUS) { if (message.getInt() == 1){ SweepToPosition(ConvertPercentToDeg(100)); send(msg.set(100)); } else if(message.getInt() == 0) { SweepToPosition(ConvertPercentToDeg(0)); send(msg.set(0)); } } else myservo.detach(); } void ServoMoveUp() { if ((myservo.attached()) && servoPosition < MAX_DEGREES){ servoDirection = INCREASING; servoPosition += servoSpeed; myservo.write(servoPosition); delay(10); Serial.print("Servo Position: "); Serial.println(servoPosition); } if (!myservo.attached()){ Serial.println("Servo stopped while moving toward MAX, direction unchanged"); delay(100 * servoSpeed); } if (servoPosition >= MAX_DEGREES){ Serial.println("MAX reached, changing direction toward MIN"); servoDirection = DECREASING; delay(100 * servoSpeed); // Wait for the last movement to finish } } void ServoMoveDown() { if ((myservo.attached()) && servoPosition > MIN_DEGREES){ servoDirection = DECREASING; servoPosition -= servoSpeed; delay(10); myservo.write(servoPosition); Serial.print("Servo Position: "); Serial.println(servoPosition); } if (!myservo.attached()){ Serial.println("Servo stopped while moving toward MIN, direction unchanged"); delay(100 * servoSpeed); } if (servoPosition == MIN_DEGREES){ Serial.println("MIN reached, changing direction toward MAX"); servoDirection = INCREASING; delay(100 * servoSpeed); } } void SweepToDirectionEnd() { myservo.attach(servoPin); if (servoDirection == INCREASING){ Serial.println("Going to MAX and stopping there"); while (servoPosition < MAX_DEGREES){ ServoMoveUp(); } delay(20 * servoSpeed); myservo.detach(); } else if (servoDirection == DECREASING){ Serial.println("Going to MIN and stopping there"); while (servoPosition > MIN_DEGREES){ ServoMoveDown(); } delay(20 * servoSpeed); myservo.detach(); } } void SweepUntilStop() { myservo.attach(servoPin); while (myBtn.isPressed()){ myBtn.read(); if (myBtn.isReleased()) myservo.detach(); if (servoDirection == INCREASING) ServoMoveUp(); if (servoDirection == DECREASING) ServoMoveDown(); } } void SweepToPosition(int destination) { if (abs(destination - servoPosition) >= servoSpeed) //Don't move if destination is close to position myservo.attach(servoPin); if (destination > servoPosition && myservo.attached()){ Serial.print("Going to "); Serial.print(destination); Serial.println(" and stopping there"); while (servoPosition < destination){ ServoMoveUp(); } delay(20 * servoSpeed); myservo.detach(); } if (destination < servoPosition && myservo.attached()){ Serial.print("Going to "); Serial.print(destination); Serial.println(" and stopping there"); while (servoPosition > destination){ ServoMoveDown(); } delay(20 * servoSpeed); myservo.detach(); } }```
  • DIY 1" Blind Tilting Sketch

    My Project tilt 1.4b1 blinds
    14
    3 Votes
    14 Posts
    10k Views
    liningerL
    @thumper I am not sure about LiPo and Solar or battery power in general. I had to use two separate 5v power supplies, one for the Arduino and one for the servo. Otherwise the pro mini would reset once the servo kicked in to open/close the blinds. My sketch never sleeps it always listens for commands sent from the Vera, either manually or PLEG commands at dawn and dusk. Hardware List 1 - Arduino Mini Pro v3.3 1 - 220uF Capacitor (NRF24 across 3v and GND 16v+ rating) 1 - 470uF Capacitor Optional (Servo across 5v and GND 16v+ rating) 1 - Servo (Micro 25.0 oz-in [1.80 kg-cm] minimum) for selectblinds.com 1" Faux Wood Blinds 43"x38" 1 - NRF24L01 Wireless Transceiver Module (flat or antenna version) Beaware of power limitations when using the NRF24L01 antenna with LNA+PA 1 - Kimbrough Internal Rotary Drive Control System 500 NIB - connects servo to blind rod (may differ for you blind type and servo used) http://www.ebay.com/itm/291084936296?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649 1 - DC power supply you may need to step-up or step-down for the servo 5v and 3.3v for the NRF depending on the Arduino board you use http://www.ebay.com/itm/321408108698?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649 is the one I used to power Arduino and servo separately. If you are successful with LiPo and Solar combination, let us know, as it would be nice no to have the power wires hanging. Thanks

16

Online

11.7k

Users

11.2k

Topics

113.1k

Posts