DIY Blind Control Motor



  • I'm looking to control my vertical blinds using a stepper motor, an arduino, and the mysensors system. Essentially, all I want the system to do is to run the stepper motor in FWD or REV direction for X amount of time (X amount of revolutions is preferred but I don't know if steppers can do this) and control it using Vera.

    Is this doable? It seems pretty simple but I hope I'm not overlooking anything


  • Admin

    Should be doable. X amount of revolutions is also possible with a stepper.



  • @hek

    Thanks! I've also got a bit of a space constraint so I can't put the stepper motor directly in front of the gear which needs to be driven. Currently, a metal chain causes a wheel to turn which closes/opens the blinds. I was hoping to attach a gear to this wheel and then attach the servo underneath to that gear (if that makes sense).

    Is there a good resource to find motors which can be used with gears? Or a place you can recommend to buy the gears themselves?


  • Hero Member

    I have been working on something like this too. I'm using the EasyDriver V44 and a 2 phase 42mm stepper motor NEMA17.
    I have the sketch all done but are still missing some parts to mount it to my blinds.
    Here is the sketch just as an example:

    EasyStepper.ino

    What it does is just open or close the blinds locally using a push button or from vera using a window cover device.
    It only supports open or close position but if you are skilled with code you could probably make it go to any position 0-100% covered.
    There is also some code that can set a home position for the blinds. In my case home is the same as fully open blinds.
    There is another push button for the home function, basically it will back up the motor as long as you hold the button and when you release it will sync vera and the stepper motor so that both know it is now fully open.
    The current position of the blinds (open or close) is stored in V_VAR1 so vera contains the last known position. So if the stepper motor loos power it will get the last position from vera.
    I have not tested it that much so it might contain bugs but maybe my code will be helpful for your project also.

    Regards,
    Tomas



  • @korttoma
    Sounds cool! Do you have a picture of the physical setup?


  • Hero Member

    I really did not put much thought in to the physical setup, I just squeezed it in to as small a box I could. Here is some pictures. Still waiting for some parts to get it mounted.

    I forgot to mention that the "sleep" pin of the driver board is also connected to the arduino to enable the motor to spin freely when it is not being controlled from the arduino. I want it to be possible to use the original cord to open/close the blinds also (WAF).

    WP_20140606_001.jpg

    WP_20140606_002.jpg


  • Hero Member

    Nice work...Especially your platting of the wires! ( id need my daughters to do that!)

    What sort of torque can you get out of a motor that size? I bought some tubular blind motors ( sight unseen) on ebay...but the diameter of them is too big for standard internal blind tubes....bummer!

    Cant wait to see your creation in action and how you connect the motor the the blind...

    Great stuff!


  • Hero Member

    Platting is not that hard. If you are an engineer you just need the will to do something and then you just make it happen, one way or another (youtube).

    It said "Holding torque : 2.8 kg.cm" on the ebay site, whatever that means.

    I'll update with it in action as soon as I find a way to connect it to my blinds, still missing some parts so it might be a few weeks...



  • I'm not clear on why you need the EasyDriver V44 red board, can't the arduino board control the stepper motor directly?

    PS. Setup looks great! Looking forward to seeing the pictures of it all installed and functional!


  • Contest Winner

    @naveen

    likely the stepper motor's power requirements... Arduino outputs only 40mA on a pin



  • @BulldogLowell

    In the servo example sketch on the site there's no driver board - I guess the Arduino can support certain motors but not others?


  • Hero Member

    Like BULLDOGLOWELL said it is due to the current consumption of the motor.
    The motor I use needs up to 400mA so it is 10 times what the arduino can handle.



  • This post is deleted!


  • TL;DR:
    Tried using a 12V 2A power supply, caused issues with the EasyDriver (flashing LED). I found an old 12V 1.5A power supply from a WD External HDD and it works fine (the unedited EasyStepper.ino from @korttoma).

    Now I'm looking for a good power supply supplier to avoid this issue in the future...or can I buy some sort of regulator to regulate 12-20V 2A to 12V 2A?



  • I purchased: http://www.ebay.ca/itm/New-CNC-Nema17-Hybrid-Stepper-Motor-DC12V-2-Phase-4000g-cm-4-Lead-1-8-Degree-dvg/261449715274?_trksid=p2045573.c100033.m2042&_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D20140423084956%26meid%3D8553692874532777649%26pid%3D100033%26prg%3D20140423084956%26rk%3D2%26rkt%3D4%26sd%3D191109030885

    and the motor is turning extremely slow using the EasyDriver V4.4 . It says the motor is rated at 12V 1.3A but the EasyDriver is only up to 700mA. The EasyDriver gets very hot as well, could this be the reason? I'm thinking of switching to the Big Easy Driver but I'm not sure if it'll help


  • Hero Member

    @naveen Sorry for the late reply. I think it is safe to use the EasyDriver board on that motor because it has a current limiter. My guess is the EasyDriver board runs hot because you do not put it to sleep when not moving. Basically the EasyDriver board is holding the motor in its current position by feeding full current trough one of the coils. If you do not want it to hold it down by full force so it is impossible to rotate the motor you need to connect the sleep pin.

    I have a similar motor also that I plan to use with the EasyDriver but I have not had a chance to wire it yet.

    The Big Easy Driver board looks nice, I think I will order one of those to...



  • @korttoma

    The speed is also really slow, I can't get past about 400microsteps/second (which is 50 steps * 1.8deg/step = 90deg/sec) - that doesn't seem normal...right? I set the max speed and speed to 8000 and it doesn't seem to help.

    Would low current cause low speeds? It does turn the correct amount, though.


  • Hero Member

    @naveen could be that you are right and the 700mA current is just not enough for your motor. Sorry I can't be of more help with your problems.

    btw, I have updated my sketch to 1.4b1 and at the same time changed it so that I can basically send the blinds to any position between fully open and closed using the dimmer slider in Vera. And my setup has now performed flawlessly for over 1 month opening/closing twice every day.

    I will share the sketch file when I get home if I remember.



  • I've mounted a little Fubata servo motor to my blinds and it works just fine. I drive it directly from my Arduino so no need to an external power supply. I have a button that opens and closes it. Now Im looking forward to connecting a RF Receiver on my Arduino so I can control it from my Veralite.
    I like the servo motor better because it's smaller, cheaper and you can tell it exactly how many degrees it should turn (0 - 180).



  • @korttoma said:

    @naveen could be that you are right and the 700mA current is just not enough for your motor. Sorry I can't be of more help with your problems.

    btw, I have updated my sketch to 1.4b1 and at the same time changed it so that I can basically send the blinds to any position between fully open and closed using the dimmer slider in Vera. And my setup has now performed flawlessly for over 1 month opening/closing twice every day.

    I will share the sketch file when I get home if I remember.

    I pulled some of the pins to ground on the Big EasyDriver and it changed the number of microsteps and I was able to drive it faster, now I've got to find a decent gear to connect it to the blinds!



  • @rafael.brasilia said:

    I've mounted a little Fubata servo motor to my blinds and it works just fine. I drive it directly from my Arduino so no need to an external power supply. I have a button that opens and closes it. Now Im looking forward to connecting a RF Receiver on my Arduino so I can control it from my Veralite.
    I like the servo motor better because it's smaller, cheaper and you can tell it exactly how many degrees it should turn (0 - 180).

    Servo would be great if you're able to do only 180 degrees to open/close your blinds - like venetian blinds or something


  • Hero Member

    @naveen said:

    I pulled some of the pins to ground on the Big EasyDriver and it changed the number of microsteps and I was able to drive it faster, now I've got to find a decent gear to connect it to the blinds!

    Ahh, that explains it I checked the Big Easy Driver user guide and it seems that it is set to "Sixteenth Step" Microstep Resolution by default compared to the EasyDriver that is set to "Eight step". So what did you set it to? I did not try anything else than the default, guess I could sett it to "Full Step" just to see if it would run more quiet.


  • Hero Member

    btw, here is the sketch I'm currently running on 1.4b1 will be updateing to 1.4 soon.

    https://codebender.cc/sketch:44733



  • @korttoma said:

    @naveen said:

    I pulled some of the pins to ground on the Big EasyDriver and it changed the number of microsteps and I was able to drive it faster, now I've got to find a decent gear to connect it to the blinds!

    Ahh, that explains it I checked the Big Easy Driver user guide and it seems that it is set to "Sixteenth Step" Microstep Resolution by default compared to the EasyDriver that is set to "Eight step". So what did you set it to? I did not try anything else than the default, guess I could sett it to "Full Step" just to see if it would run more quiet.

    I've got it running on full steps right now and it seems to run pretty good. I might end up running it on half steps in the end.



  • So I finally got the blinds set-up and working. A few tweaks to be made but overall it is working OK. One thing that would be really handy is if I could alter the speed variable through Vera, is there any way to create a custom variable in vera and send it to the Arduino?


  • Admin

    @naveen

    Yes, it is possible! You have a couple of options.

    ##Poll configuration data from node

    • Select one of V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5 to use for your configuration;
      choose from your root or child nodes. You can use all five parameters per each of your root and child device. It is up to you how to design this;
    • Program your sketch to fetch variable from vera using gw.request(). You will have to take care to get reply later by yourself using in your callback method initialized in gw.setup(). See RelayActuator sketch for an example on how to handle incoming messages.
    • First run of your modified sketch to request parameters. Be prepared that you will receive an empty string because at this time we have just created empty variables at vera side;
    • Refresh your vera and go to particular child into Advanced Tab. You should be able to see your new variables named Variable1...Variable5. Variable1 corresponds to V_VAR1 inside your sketch etc.;
      fill free to change empty field on vera side to the value your needed, Save changes; forcase1.jpg
    • Check with you Arduino, it should receive correct data at this point;
    • You free to use whatever design you want. You can pull/request data at each start of you node or you can pull each 30 minutes like many z-wave devices do if they operate from battery. Other example can be if you need for your to nodes to communicate to each other and you need to tell a radio ID to one/both nodes to establish their communication. But for this one you probably want to use Push...

    ##Push configuration data from Vera to node

    Example: You need to push data from vera on event or using schedule and it should be initiated instantly by vera, not by node. For example you want your clock to show external temperature received by vera from the Weather plugin or from other sensor.

    forcase2.JPG

    • Choose from V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5 to be used for data push

    • Design your sketch to listen for incoming messages with desired variable. See RelayActuator for an example on how to handle incoming data.

    • Create a new scene on vera side. The scene should be run according to your goal. For example each 10 minutes;

    • Use Lua tab while editing scene to provide data for the push. For example this Lua is taking current temperature from Weather (vera id = 61) plugin and pushing it to the node (vera id for root device = 372) using VAR_5:

      local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 61)
      temp = temp*10.0
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="4;255", variableId="VAR_5", value=temp}, 372)

    SendCommand will push a message to your node. You can also call it with static values (without programming) using the Advanced tab in the scene editor.

    (This post was updated to 1.4 from from @axillent old tips page on micasaverde)



  • @hek

    Awesome, thanks! I'll give it a go.



  • This post is deleted!


  • This post is deleted!


  • Finally finished my setup, here is a picture. Works pretty well, it is slightly louder than I would have hoped but if you run it at 1/16th microsteps its almost silent. The only issue is that it won't run very fast at 1/16 microsteps.IMG_1795-2.jpg


  • Hero Member

    Pretty cool, would it be possible to get a video with audio of the final 'product'?



  • @ServiceXp said:

    Pretty cool, would it be possible to get a video with audio of the final 'product'?

    Sure! This is with eighth steps - and it seems to be as fast as the motor will go without reducing the microsteps.

    http://youtu.be/imQj-p-GoYQ


  • Hero Member

    @naveen nice!!


  • Hero Member

    @naveen

    Thank you! Gives me an ideal of speed and noise. Both seem very reasonable.



  • @ServiceXp

    A few things I should mention for anyone trying to undertake this project:
    -I'm assuming that the choice of stepper motor is important to control noise. It is possible that a different stepper would give an improved speed/noise ratio.
    -One of the most important factor in reducing noise is ensuring there is no hard surface for the motor to 'rumble' on. This is especially bad when using full stepping - the motor rumbles like crazy. The more microsteps, the less rumble and the less noise.
    -I coated the sprocket and bracket in silicon caulking to reduce noise, it seemed to help a little, but was nothing compared to reducing the microsteps
    -If you are looking to have the best of both worlds, you can add some code as follows in order to choose the microsteps based on the desired RPM. This way you can control the speed via vera and the arduino will actively choose the best microstepping mode. The regular EasyDriver has similar pins, but I believe the most microsteps is 8 and there are only two pins to control
    -I am using a 8Mhz 3.3V APM and it may be possible to increase the steps/second if you use a more powerful processor (for example, 16Mhz APM) - I will test it with a nano when I get a chance. @hek, the nano used for the gateway is 16Mhz, correct? It says 16M on the eBay page but I just wanted to confirm.

    void newnMicroSteps(){
      if(nMicroSteps==1){
        digitalWrite(MS1pin,LOW);
        digitalWrite(MS2pin,LOW);
        digitalWrite(MS3pin,LOW);
      }
    
      if(nMicroSteps==2){
        digitalWrite(MS1pin,HIGH);
        digitalWrite(MS2pin,LOW);
        digitalWrite(MS3pin,LOW);
      }
    
      if(nMicroSteps==4){
        digitalWrite(MS1pin,LOW);
        digitalWrite(MS2pin,HIGH);
        digitalWrite(MS3pin,LOW);
      }
    
      if(nMicroSteps==8){
        digitalWrite(MS1pin,HIGH);
        digitalWrite(MS2pin,HIGH);
        digitalWrite(MS3pin,LOW);
      }
    
      if(nMicroSteps==16){
        digitalWrite(MS1pin,HIGH);
        digitalWrite(MS2pin,HIGH);
        digitalWrite(MS3pin,HIGH);
      } 
    
    
      maxStepperSpeed = maxRPM/60*stepsPerRev*nMicroSteps;
      fullOpenSteps = fullOpenRevs*stepsPerRev*nMicroSteps;
      maxStepperAccel = maxAccelRPMPM/60*stepsPerRev*nMicroSteps;
    
      stepper1.setMaxSpeed(maxStepperSpeed);
      stepper1.setAcceleration(maxStepperAccel);
    }
    

    Edit: I just noticed that I calculated acceleration wrong. Here is the correct equation:

    maxStepperAccel = maxAccelRPMPM/60/60*stepsPerRev*nMicroSteps;

  • Hero Member

    @naveen

    Thanks for the update.



  • @ServiceXp

    Note: I tried the 16Mhz Arduino Nano and I seem to be able to get much higher speeds with high microstepping. I have almost silent operation with 8 microsteps and the blinds open in about 10 seconds. I assume if you get an even faster processor you can step it even more quickly.



  • For the next part of my project I'm looking to have two interlocking gears which grab and pull the string in order to slide the vines of the blinds to one side.

    I can attach one gear to the servo, but the other gear would require some sort of bearing? Does anyone have any idea what type of bearing I can use? If there's a name I can search for them on eBay (I assume they are available there).



  • @korttoma , did you ever try using the accelstepper run() command instead of runToPosition(). From my understanding the run() command is non-blocking and you put it in your main-loop. That way, if Vera sends a new commands you can set it to stop immediately using:

    stop();
    runToPosition();
    

    I gave it a shot and the motor didn't seem to move at all - I'm not sure if you ever experimented with it, thought I'd ask.


  • Hero Member

    @naveen

    Sorry, I have not experimented with other functions than the once I have in my current sketch since it is working according to my needs except for the problem with position updates to Vera I'm having.
    I guess some people would like it if it was possible to use up/down/stop if it is possible with the run() function but I have schedules running my blinds 95% of the time.
    I managed to workaround the position updates to vera problem by using the up/down instead of open/close, I will look in to it when I find some time and then I could check out the run() function too.



  • @korttoma

    I don't know what I was doing wrong before, but I got the non-block run feature working with your code. I have my blinds controlled by XBMC as well, so if I start and stop a movie in quick succession, I want to make sure the blinds end up in the right spot. I've attached the relevant snippets of code below

    void loop(){
    
     if (gw.messageAvailable()) {
      //Serial.print("New message from GW"); 
      // ot new messsage from gw
      message_s message = gw.getMessage(); 
      setRelayStatus(message);
    }
    
    stepper1.run();
    }
    

    and then when you get the message:

    if (message.header.type==V_DIMMER) { // 
         float IncomingControl = atoi(message.data);
     //Serial.print("Message: ");
     //Serial.println(IncomingControl);
     //Serial.println((100-IncomingControl)/100*-1*fullOpenSteps);
     delay(5);
     
     
     float incomingNewPosition = (100-IncomingControl)/100*-1*fullOpenSteps;
    
     stepper1.stop();
     stepper1.runToPosition();
     
     stepper1.moveTo(incomingNewPosition);
     
     
     int IncomingControlSend = IncomingControl;
     gw.sendVariable(CHILD_ID, V_DIMMER, IncomingControlSend);  
      
    }


  • @hek said:

    @naveen

    Yes, it is possible! You have a couple of options.

    ##Poll configuration data from node

    • Select one of V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5 to use for your configuration;
      choose from your root or child nodes. You can use all five parameters per each of your root and child device. It is up to you how to design this;
    • Program your sketch to fetch variable from vera using gw.request(). You will have to take care to get reply later by yourself using in your callback method initialized in gw.setup(). See RelayActuator sketch for an example on how to handle incoming messages.
    • First run of your modified sketch to request parameters. Be prepared that you will receive an empty string because at this time we have just created empty variables at vera side;
    • Refresh your vera and go to particular child into Advanced Tab. You should be able to see your new variables named Variable1...Variable5. Variable1 corresponds to V_VAR1 inside your sketch etc.;
      fill free to change empty field on vera side to the value your needed, Save changes; forcase1.jpg
    • Check with you Arduino, it should receive correct data at this point;
    • You free to use whatever design you want. You can pull/request data at each start of you node or you can pull each 30 minutes like many z-wave devices do if they operate from battery. Other example can be if you need for your to nodes to communicate to each other and you need to tell a radio ID to one/both nodes to establish their communication. But for this one you probably want to use Push...

    ##Push configuration data from Vera to node

    Example: You need to push data from vera on event or using schedule and it should be initiated instantly by vera, not by node. For example you want your clock to show external temperature received by vera from the Weather plugin or from other sensor.

    forcase2.JPG

    • Choose from V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5 to be used for data push

    • Design your sketch to listen for incoming messages with desired variable. See RelayActuator for an example on how to handle incoming data.

    • Create a new scene on vera side. The scene should be run according to your goal. For example each 10 minutes;

    • Use Lua tab while editing scene to provide data for the push. For example this Lua is taking current temperature from Weather (vera id = 61) plugin and pushing it to the node (vera id for root device = 372) using VAR_5:

      local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 61)
      temp = temp*10.0
      luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="4;255", variableId="VAR_5", value=temp}, 372)

    SendCommand will push a message to your node. You can also call it with static values (without programming) using the Advanced tab in the scene editor.

    (This post was updated to 1.4 from from @axillent old tips page on micasaverde)

    I'm moving on to add another stepper and I need a few more custom variables (4) - is there any way to add new variables? Or is he maximum 5?


  • Hero Member

    @naveen said:

    I'm moving on to add another stepper and I need a few more custom variables (4) - is there any way to add new variables? Or is he maximum 5?

    If you add another stepper to a node you will add another window cover device in Vera right? So shouldn't there be 5 more Variables for this new device right?



  • @korttoma said:

    @naveen said:

    I'm moving on to add another stepper and I need a few more custom variables (4) - is there any way to add new variables? Or is he maximum 5?

    If you add another stepper to a node you will add another window cover device in Vera right? So shouldn't there be 5 more Variables for this new device right?

    I wasn't planning on adding another device. I was planning on implementing the UP/DOWN functionality to control the sliding of the vertical blinds. While the V_DIMMER slider would control the 'tilt'


  • Hero Member

    Ahh, I see. Maybe it is an option for you to add another (dummy) device of some type just to get more variables.



  • @korttoma said:

    Ahh, I see. Maybe it is an option for you to add another (dummy) device of some type just to get more variables.

    That's actually not a bad idea. Seems like a pretty simple solution. Thanks!



  • Old thread, but is it possible to clean up enough to make a tutorial on this? All the info is quite confusing to a person who's not as good as you guys 🙂
    Is it also possible to adapt this method into making a door lock?


  • Hardware Contributor

    @naveen said in DIY Blind Control Motor:

    Finally finished my setup, here is a picture. Works pretty well, it is slightly louder than I would have hoped but if you run it at 1/16th microsteps its almost silent. The only issue is that it won't run very fast at 1/16 microsteps.IMG_1795-2.jpg

    Sorry, I know this topic is quite old, but where did you get that wheel (that translates motor force to the chain)? I was thinking about building something similar and thats my main problem.

    Looks 3D printed as well as the holder (I really have to get a 3D printer 😉 )..



  • Yep, both were 3D printed back then. The Toronto library actually has 3D printers so I built a CAD model and had it printed there. There are also have a lot of web-based companies who will print and ship out parts.

    Since then I've built my own 3D printer, it comes in handy and they're getting pretty cheap.


Log in to reply
 

Suggested Topics

  • 8
  • 90
  • 3
  • 1
  • 1
  • 7

61
Online

11.4k
Users

11.1k
Topics

112.6k
Posts