Introduction: App and Timer Controlled Automatic Blinds


UPDATE 14-01-2016 -I've now also shared the MIT app inventor 2 app file for those who want it.

Hello boys and girls!

Feeling like making something today? Own a 3d printer but mostly been printing phone cases, miniature yodas, toothbrush holders and spare parts? Now its time to really make good use of that 3d printer and make a useful and fun product that nobody else have!

What we'll be making today are fully automatic app controlled blinds.

Why? Because we can. And it's also quite handy and cool.

It can be particularly handy if you have many blinds, in cumbersome positions such as ceiling windows or if you pull them up and down often (sun on computer screen, using a projector and so on).

But the main reason for me was that I prefer to sleep in complete darkness but waking up in the same complete darkness makes me tired and glues me to the bed in the morning. This is where the app comes handy.

When i set my alarm at night I also set the timer of the blinds, I usually set it 15 minutes before my alarm so when I wake up the room is full with daylight. Pretty nice.

Step 1: General Outline of Project

Skills needed for this project.

  • Basic knowledge of electronics and experience from a couple of arduino projects. I will not go into detail on how to solder a cable or what you should connect your GND cable to.
  • Basic CAD skills. Depending on your window/wall you might have to adjust one of the parts so it suits your needs. I will share a general mounting bracket for this which you can adjust to your needs. The last thing you will need to make yourself is the control box. Depending on how many blinds you wish to control, the components you want use and where you want to place them (wall, floor..) will make it impossible to find one component housing that will fit all solutions. This box however doesn't have to be near the blinds so it can be hidden, so it doesn't really matter what it looks like.

Before ordering any parts make sure you have;

1. Android phone with Bluetooth

2. Soldering iron

3. Multimeter

4. About a day to print, build and install this. Best case scenario is about 2-3 hours but those scenarios are quite rare.

Got it? Good! Start by downloading my app and install it. You might have to go into settings and enable apps from unverified sources or something similar. Nothing fishy with the app, promise. Start the app. Does it start and displays "Connect to bluetooth"? Good! Now we know it works on your phone before you order any parts!

How it works

Before we jump into the details I want give you a rough outline of how it works.

We will use cheap ikea blinds but replace the mounting brackets with our own. One of them will only hold the curtain in place and the other one will house a step motor which will rotate the curtain axle.

This step motor will be connected with a cable to the component box placed on the ground or wall containing stepmotor drivers, Bluetooth receiver and a arduino.

When the user starts the app it will connect to the Bluetooth device. The first thing the user does is to calibrate the blinds (this only needs to be done once). This process will start to roll down the blinds and when they are fully extended the user presses "stop calibration" in the app.

Now the arduino knows how much to be rolled in/out every time. (so you don't have to stop it manually).

I mentioned earlier that there is also an alarm. When you set the alarm time the app will also set the current time to the arduino so it can keep track on the time without the being connected to your phone. This means you can turn off the app/bluetooth/phone after you've set the alarm and it will still trigger the alarm.

Sounds reasonable? Lets get going!

Step 2: Parts

Parts you need

You can use components of your choosing, just make sure you use a powerful enough Nema 17 sized step motor so it fits the mounting bracket. I had the parts laying around at home but the supplied links are equivalent. Dx is probably the cheapest site I know for electronics but delivery usually takes about a decade. If you want to get started asap i suggest you use another site.

Nema 17 Step Motor 17 $ (4800g-cm, 68-70oz-in, could probably use less)

https://www.sparkfun.com/products/10846

Step driver 2A 6 $ (my setup never use more than 0.76A, make sure to check the temperature and use appropriate heat sink if needed)

https://www.pololu.com/product/1182

Arduino Pro Micro 9 $

http://www.dx.com/p/xghf-micro-5v-16m-mini-microco...

Roller blind Tupplur 20 $

http://www.ikea.com/us/en/catalog/products/5022840...

Bluetooth receiver HC-06 7$

http://www.dx.com/p/hc-06-serial-port-passthrough-...

Connection cables, solderless breadboard, cat5/6 network cable to connect component box with motor bracket, power supply (i used an old 12v, 2A adapter)

4 M3 screws and suitable mounting screws for your wall type.

Total: 59 $

If you wish to extend the setup to several windows you need to buy x of each listed above, except the arduino and Bluetooth receiver which you only need one of each, so about 40 $ per extra window including blinds. If you decide to go for a more high current/dual step driver you can simply parallel connect the motors for two windows using the built in "cable channel" in the mounting bracket. This minimizes wiring and cost further, down to just a 17$ step motor per extra window.

Step 3: Start Printing the Parts

Picture of Start Printing the Parts

Okay we're going to let the 3d printer fulfill it's destiny while we work on the electronics.

Start printing

1. Start by printing the motor mounting bracket (Motor_bracket.stl). Place the bracket with the screw holes touching the bed. Most printers should be able print this without support structures despite the small overhang near the top. If yours can't, print with supports and remove afterwards.

2. Print the cover (cover.stl). To minimize support structures you can print it standing.

3. Print the axle mount (Axle_mount.stl). Preferably with the largest diameter facing the bed.

4. Print the wall mounts. (Motor_bracket_wall_mount.stl and Wall_mount). The motor bracket wall mount is the one I've used due to the shape of my "window frame". Depending on how yours look you will probably reshape this file. If your surface is flat you can just extrude the backside so it has the same thickness. Note. Do not cut away the "thick part" it needs to be there (a screw will go in there later).

Check fitting & Mount the parts

When everything is ready make sure the parts fits together.

1. Insert motor into bracket and use 4 M3 screws to lock it.

2. Test the cover, does it slide on properly?

3. Now we're going to fix the axle_mount to the motor shaft. Slide a nut into the hole and screw in a screw from the side to fix it. Now press the axle mount into the blinds axle. It should be a really tight fit. When pushing it in, only push on axle_mount outer ring, not the motor housing as this might damage your motor.

4. On the other side of the axle is a plastic insert from ikea. We will keep this one, but drill a hole in it's center and push through a screw. This screw will go inside the Wall_mount and serve as our axle. Find a screw that fits the hole in the Wall_mount. It should provide some friction when rotating. If you don't have enough friction at this point your blinds will unroll themselves in the top position when the motor turns off. Too much friction and the motor wont be able to roll up the blinds. You can put rubber bands or paper around your screw to increase friction if needed. (initially i put a mini ball bearing in mine which allowed my blinds to accelerate to near lightspeed when the motor was turned off and snap off the brackets.).

Put nuts on the screw, on each side of the plastic insert, so you can fine tune the position later. Measure carefully how the whole assembly should be placed, drill holes and mount it.

All working? Great!

Now remove the motor housing and the motor, we need to test everything before we start attaching long cables to our walls.

Step 4: Connecting Power and the Step Driver

Picture of Connecting Power and the Step Driver

Now pull out your solderless breadbord! No need to solder or make fancy connections at this stage, first we only want to check that everything works.

I will not go into so much detail with the electronics and the app, I assume you know your stuff and also may have different components than I have. I will just explain what goes where.

Power to arduino (Assuming you have 12 V, 2A power supply )

You will power your step driver and arduino separately so make a parallel connection (4 cables) with your supply. GND1 to arduino gnd, VCC1 to VI on arduino (voltage in, not 5 V if you don't use 5 volt supply!).

Depending on what step driver you have, you may have a pin called "sleep". When we´re not using the blinds we will either set the driver to sleep or turn them off to keep power consumption down. In this project we will not use the sleep feature but instead turn the driver on and off just before we use it (in case your driver doesn't have the sleep feat). Waking the driver from sleep is faster than starting it, its usually around 1 ms but in our case that's not necessary.

Power to motor

See the attached image. We're going to start with our 12V supply. Connect VCC2 and GND2 to VMOT and GND. You can (should) also connect a 100uF capacitor between them.

Okay now the motor have power. Now we supply the driver with power!

Power to driver

Connect the other GND (the lower one in the image) to your GND. The VDD pin will power up the driver, this is the one we will turn on and off. Connect this to pin 16 on your arduino.

Okay step driver have power. Now we´re gonna give it some signals to work with.

Driver signals

Connect DIR to pin 14 on arduino. Connect STEP to pin 15 on arduino. Depending your step driver you might have pins like MS1, MS2, MS3. These are for "microstepping", this process enables your motor to make smaller steps. We're not interested in this as 200/400 steps per rotation is already above our needs. Microstepping usually enables by connecting the pin(MS1, MS2...) to VCC or GND. Check your stepper data sheet. Be wary that using smaller step might give you less torque (and might overflow the int variable in the code by counting super many steps).

Step motor signals

Okay we're now going to make a temporary connection between the driver and the step motor. This is to make sure everything works before we continue.

Since different steppers use different colors on the cables I will describe a method that works for all steppers. What we want to know is which cable goes where. The four cables are in pairs, two per coil (the motor have 2 coils). The easiest way is to take either a multimeter or a LED and connect them to two pins. Now rotate the motor shaft, if the multimeter reads a voltage you´ve found a pair! If you use a LED it will light up, make sure you switch the pins if it doesn't work (as LEDS only allows current to flow in one direction).

Now connect them in pairs to the stepper. Pair 1 goes to 1B, 1A and pair 2 to 2A, 2B. Later when we test them, if you discover that they rotate in the wrong direction you can change the position of the pairs.

Calculating the current and adjusting the Vref

Depending on you step driver type, check out this url or check your datasheet.

http://reprap.org/wiki/Pololu_stepper_driver_board

If you plan to use one driver and two motors, make sure to calculate the parallel resistance of the motors or you might burn your driver!

Brief explanation how it works

Arduino writes HIGH to the STEP pin for 500 micro seconds, delays and writes again repeatedly. The stepper interpenetrates this signal and activates the coils in the step motor in a sequence to make it rotate 1 step.

The DIR pin is either HIGH or LOW depending on which direction we want the stepper to rotate.

If your motor is freaking out and all the connections are correct you might want to try changing the 500 micro seconds to a higher/lower value in the arduino code.

Not working at all or is the motor just making weird sounds?

  1. If you rotate the step motor shaft by hand (disconnect power first) it should rotate freely and it should feel "clicky", one "click" is a step. If it doesn't you might have a faulty motor.
  2. Check connections, check connections, check connections.
  3. Check the step driver datasheet. First check if you've connected the phases correctly. Then check if you need to ground one of the microstepping pins (MS1, MS2...). Check if you can adjust voltage on the driver and do this very carefully, making sure only to touch the adjustment screw with your screwdriver (risking to short circuit the driver if you're not careful). Lastly check if it has a built in current limit that's somehow set too low.
  4. Change the write period in the arduino code (the 500 us part) or the delay time after the write.
  5. Still not working? Check with a multimeter or oscilloscope if you have access to one. Whats happening between the driver and motor? Whats happening between the arduino and the driver, are the pins writing correctly?
  6. Remove all connections, have a cup of coffee and assemble again. (works surprisingly often)
  7. Send me a message and I'll see if I can help.

Step 5: Connecting Bluetooth Device

Okay, time to go wireless

Connect gnd and vcc on your bluetooth device to your arduino (3.3V or 5 depending on your device). Connect bluetooth TXD to arduino RXD and bluetooth RXD to arduino TXD.

Using these pins can sometimes cause problems when uploading sketches to arduino (as they are data communication pins). If you get a problem while uploading, disconnect the power to the device using these pins and it should work.

Upload the sketch

Okay its time for the fun part, begin by downloading the sketch. If you don't have the time libraries, download them and put them in your arduino/libraries folder.

http://www.pjrc.com/teensy/td_libs_TimeAlarms.html

http://www.pjrc.com/teensy/td_libs_Time.html

If you don't use the arduino micro pro you need to replace all "Serial1.." with simply "Serial..". If you use the micro pro you don't have to change anything.

Upload the sketch, connect your power supply, turn on bluetooth on your phone and start the app. Connect to bluetooth and click on the device in the list. If it connects properly new menus should appear. Click "Calibrate", your motor should start rotating. If you click "raise/lower blinds" before calibration nothing will happen. Calibration sets the number of steps of a full cycle, before calibration that is equal to 0.

Hopefully everything worked, otherwise check your connections.

Extra

If you have the sun straight through your window in the mornings you might want the roll up process to be super smooth and slow, perhaps during 30 minutes or so, more like the Philips Wake-up light-experience. If that's the case you can change this;

In the void MorningAlarm(), after "steps++;" add delay(10). So after each write to the step driver, it delays the next step with 0.01 s. Start with this and increase the delay until you're happy. Your stepper will probably have 200-400 steps for each full turn so this value should be really low!

A smarter but more complicated way to set this time is to serial print the "steps" value after you have calibrated the blinds. Then you'll know how many steps its taking for a full cycle and can do division on how much time it needs to pause per step to end up at 30 min or what ever value you wish. You could also manually roll down the blinds and count how many turns it takes and multiply with your steppers value (usually 200/400).

Remember that longer delays are "ugly", they freeze the microcontroller completely, not being able to receive important commands like stop, so avoid using repeating delays longer than 300 ms. You can use millis() or the time library if you need longer pauses.

Step 6: Putting the Pieces Together

Picture of Putting the Pieces Together

Okay now we know everything works its time to make it permanent.

Design a little simple casing for your arduino + other stuff and mount on the wall or just on the floor. Connect the step motor driver and motor with a cat5/6 (network cable) of the appropriate length. You can use any 4 pin cable but most people have them laying around and they come in a nice package. Remove the 4 ends you don't need and connect the other ones to the motor and driver, make sure to remember which ones goes where!

I used RJ45 connectors on my cables (regular network cable connectors) and females in my component box. In hindsight it just wasn't worth it, clamping those connectors can be very annoying and the box is placed under my sofa anyways :D

First test in position.

Before you test drive it, pre drill a small hole in the motor wall mount and and use a small wood screw to secure the motor housing and wall mount together. If you don't do this your motor housing might get ripped out if the blinds roll down too fast.

Now that everything is locked into place we can finally test it. When calibrating make sure you press "stop calibration" exactly when your blinds are fully extended. If you stop before that, the blinds will roll down completely as soon as the motors turn off risking to break your mounts. If you for some reason don't want your blinds to extend fully, cut off a part of your blinds and glue it back on the cylinder.

If everything worked nicely you're done! Now make it permanent and good looking by soldering it together and placing the parts in the component box.

Good job and I hope you will enjoy using the blinds!

Comments

chloeS11 (author)2017-11-04

Hi! Thanks for sharing your project. I'm currently working on circuits and I have some questions regarding wiring. I wired arduino pin 16 to Vcc(arduino Vcc=5V) since it controls the on/off of the motor driver. Although I finished wiring and tested using an app, the motor doesn't seem to rotate. It just makes weird sounds... So I tested motor to find out if the motor has any problems, but motor worked fine while using other sample codes. I'm stuck here :( Can you help me??

(I'm using the same arduino board, A4988, bluetooth module, stepper motor // and here is my schematic!)

johanmoberg (author)chloeS112017-11-05

I don't understand how you can control on/off of the driver with that connection? The driver would always be ON regardless of what you set pin 16 to(?) but if set to LOW, it would short circuit,set off the internal fuse of the uC and both bt transceiver and step motor driver would experience a fast voltage drop and reset. If I were you I would start without using pin 16, and later if everything works, connect pin 16 to the sleep pin instead. But if I understand you correctly; everything works if you only change the software? If that is the case I would try;

1) Remove pin 16 connection.

2) Change the delay between the motor steps in the code – Try increasing the time by 100-500%. If it works you should get slow speed. Then reduce this timing to optimize motor.

3) Add some decoupling capacitors to this circuit to avoid any wired transient behaviors, especially if you are using a high impedance power source.

Let me know how it goes! Best of luck!

markb649 (author)2017-06-23

disregard my request for help with the time libraries, I got it! Found the older un bundled files on the official arduino site here http://playground.arduino.cc/uploads/Code/Time.zip

Extracted those to my arduino library folder and the code compiles without issue. Thanks again for a great tutorial Johan!

johanmoberg (author)markb6492017-07-15

Ok great! Thank you!

markb649 (author)2017-06-21

hello thanks for sharing your work on this, its a great project. I'm trying to set it up to raise and lower a projector screen with my phone. I love the little stepper controller from pololu, smaller and cheaper than a motor shield. I would have never thought to try it, the way they describe it. The problem I ran into is teensy is now putting the two necessary libraries bundled into a single installer, and when I try to compile the arduino code the libraries cannot both be found. Any way someone could copy me on the older files? Also may be helpful to me if someone could check the file path on their computer so I can verify I have them set in the right folder. I currently have them in c:program files/x86/arduino/ which is the only folder the teensy installer would allow during installation. Appreciate any and all help, I've got the hardware good to go unfortunately coding is being difficult on this one.

jared1523 (author)2017-02-16

Do you have a Research paper for this idea of your sir?

AndrésV55 (author)2017-01-18

Hi Johan

Really good post, Could you helpme answer a question please, I have a problem not with the code, when my blind is totally opened the weight of the blind makes tirns the motor and the blind slides, because the motor when is "turn off" doesn't have the strength to support the weight of the, Could you give me some idea of how can I solve this probl3m, thank for your answer and thanks again fot this excellent post.

Andres

johanmoberg (author)AndrésV552017-01-18

Or you could just buy something like this

http://www.conrad.com/ce/en/product/275168/Brass-Steel-Worm-gear-set-Reely-Module-Type-075-No-of-teeth-60

johanmoberg (author)AndrésV552017-01-18

Thank you! If you want it to stop before being completely rolled down, I would suggest using a worm gear. They are self locking and would hold the load when the motor is powered down. You could grab and modify something like this for your purpose (not my design)

http://www.thingiverse.com/thing:28126

Good luck!

Dahniel75 (author)2016-12-19

Hej Johan,

I love what u created!! :)

Im totaly new in the arduino world.

So I bought the A4998 and the Pro Micro as u recommended.

Im a little confused when it comes to the wiring. In the picture one can see that VDD on A4998 is connected to Microcontroller VDD, but the Pro Micro doesnt have VDD but VCC. Would u mind sharing a more detailed wiring diagram?

Best regards, Dahniel

johanmoberg (author)Dahniel752017-01-18

Hi, sorry for the late response, missed your comment! Yeah Vcc and Vdd are the same, its just the A4988 sheet that decided to call it Vdd.

JuanM124 (author)2016-09-15

Hey this is actually pretty amazing, I respect so much people like you that invent and make amazing things with simple electronics....

Noob question, is the network cable used for transferring the data between the bluetooth card and the motor?

johanmoberg (author)JuanM1242016-09-15

Thank you! Nope, it's just the signal to the motor(created by the step driver) and any type of cable would work. The motor has two electromagnets inside so it needs 4 cables.

696s4m. (author)2016-06-02

do you mind sharing the app source code jogabonito_33@hotmail.com

johanmoberg (author)696s4m.2016-06-03

Hi! It´s attached on the first page (there´s only a MIT inventor file, no raw code).
Good luck!

notmydog (author)2015-05-21

How did u write the app? And do u mind sharing the source code?

johanmoberg (author)notmydog2015-05-21

I used the MIT app inventor 2. Sure no problem, just pm me your email adress and i'll send it.

notmydog (author)johanmoberg2015-05-21

Thank u very much. Hnlubbe@ gmail.com

johanmoberg (author)notmydog2015-05-21

Ok sent you the files now. Good luck!

prabawaa (author)johanmoberg2016-01-04

do u mind sharing .aia file to me too?

padhikara@gmail.com thanks

johanmoberg (author)prabawaa2016-01-05

Will do!

Sigeba (author)johanmoberg2015-11-15

Great tutorial! Is the measurement of the .stl files millimeters or inches? I'd love to take a look at the source code as well: abimaelleon@gmail.com Thanks!

johanmoberg (author)Sigeba2015-12-03

It´s in mm, usually with 0.3 mm tolerance. I´ve sent you the files now! Good luck

Akin Yildiz (author)2015-09-03

perfect..

favorite + follow

skibbons (author)2015-06-29

Great job. I'm gonna make this but would like to control it with an infrared remote.

johanmoberg (author)skibbons2015-07-09

Thanks! Should be a lot easier!

PedroP6 (author)2015-05-22

Hi.

I tried something similar a few months ago, but the nema wasnt powerfull enough to bring the blinds up all the way.

Do you know what could have been the problem? The driver I used was the one that came with the arduino starter kit.

Thanks

johanmoberg (author)PedroP62015-05-22

Hi! Could be many things. Is the step motor strong enough? I use 4800g-cm ones with 2A drivers. Can your power supply deliver enough current? Can you change the voltage on the driver? Perhaps your blinds are heavier? You say they don't bring the blinds all the way up? Maximum torque requirement should be in the bottom position so is it perhaps caused by some friction in your mounts? Check in your step driver data sheet, usually you have different torque depending on your step length, if your driver is set to micro stepping you could end up with less torque.

CLullham (author)johanmoberg2015-05-31

Hey, thank you for the recommendation, I will definitely check it out. I'm usually looking for a deal in hotukdeals.com but you never know. I may have to find one myself.

CLullham (author)2015-05-21

This is freaking amazing, man! I'm really into home improvement with all kinds of gadgets right now. I don't own a printer, though. I plan to buy one when the prices drop a bit.

tinaciousz (author)CLullham2015-05-22

You can get all the STL files printed via 3D Hubs. Click the "Print with 3D Hubs" button beside the STL file to be connected to a maker near you that will print it for a low price.

johanmoberg (author)CLullham2015-05-21

Thanks man! Been working on a fully automatic "herb wall" with individual lightning, soil moist sensors and adaptive watering for 18 different herbs for while now. Basically you fill 15 l water in a tank and you have happy herbs all year regardless of seasons, effort and green fingers. :) I think it will turn out pretty good looking too, something for the living room instead of the garage. There will be some 3d printing in that project so check back when you're up and running with your new printer! Btw check out the Vertex k8400, takes a while to build but its cheap (around 600 euro) and produces good quality prints.

emma_vg (author)2015-05-20

Smart idea

johanmoberg (author)emma_vg2015-05-20

Thank you!

tomatoskins (author)2015-05-20

Really cool idea! And excellent exicution!

johanmoberg (author)tomatoskins2015-05-20

Thanks a lot mate! Appreciate the feedback!

About This Instructable

20,551views

419favorites

License:

More by johanmoberg:Online Herb Hydro GrowMailbox notifierApp and timer controlled automatic blinds
Add instructable to: