[RELEASE] ESP8266 / Arduino servo controlled smart blinds

Here we go! This is a re-think of the simple smart blinds created by @C_Hobbs. The code now supports positioning the blinds, not just open and close. You can also add a switch to the blinds for those times that you just want to move them a bit manually. I used a custom designed gear box I printed on my 3d printer to connect the servo to the shaft that controls the window blind angle.

This is my first SmartThings project. I will clean up this first post as time allows and I get some pictures taken.

For the servo I used a $4 TowerPro clone from AliExpress model MG996. I found that the D1 Mini WeMos board fit easier in the window blind header than the NodeMCU. Both should work.

The largest window I have in my house is a picture window that is about 6’ and this setup works for that. Any smaller window should work even better! The red and white gearbox has the rotation shaft offset which fit my newer blinds that were purchased within the last year from Home Depot. This gearbox slides in from the end or can be put in between string spans if you have super narrow blinds.The yellow gearbox pictured fits older blinds and slides in from the end only. The older style blinds have the rotation rod centered and were made back in 1996 or so I believe.

Gearbox: http://www.thingiverse.com/thing:2071225
SmartThings and Arduino code here: https://github.com/jetpuf/SmartBlinds

Video of the whole thing in action here:

Pictures of the gearbox:


Pictures of my earlier design installed:


17 Likes

2nd post saved for any additions I need to add.

can you post a parts list and walkthrough for assembly (at least on your blinds) including the programming of the module and ST. You’d be my hero. lol

1 Like

That is quite impressive.

But I do get a compile error with your ESP8266 code.
Apparently there is an empty character constant.

I’ll double check it. I modified it from my working code to remove my wifi SSID.

I check and compiled the code using the ESP8266 V2.1 library. Compiled just fine.

Here is the board manager URL:
http://arduino.esp8266.com/stable/package_esp8266com_index.json

I compiled it against the WeMos D1 R2 & mini.

A parts list for your setup would be awesome. Also, how are you powering this? Batteries, wall plug?

This looks great, especially the gear box! (Might have to try using it myself)…

I so want to do this for our blinds… have to take it down and see what I’m dealing with. How is the setup for the manual switch to open close? Also, interested in how you are powering and routing wire if using a wall plug. So many questions… :slight_smile:

I have a little more work to do before it is 100% wife approved. She’s likes the convenience. Right now it’s powered by an old cell phone charger to the micro-usb on the D1 or NodeMCU depending on the window. You will need a big enough power supply (2A or more) to run a 6’ picture window.

My plan is to install a USB power outlet in our kitchen where three of these are installed. Run the wire up to the first blind use a JST connector to then solder a connection for the other blinds and then horizontal run to the second and third. I will probably mount the wire on the window frame to hide it a bit behind the blind.

1 Like

I have tried with V2.1 and V2.2 and V2.3 and I always get the same error at the same place.

What are your board settings??

I have also updated the Thingiverse post to include a gearbox for older window blinds with the rotation shaft centered. I do not believe it will work correctly if you have to move it to the middle of the blind however it should work on the end as a cartridge just fine.

I will have a more through build guild setup hopefully this weekend.

This is great but I have one issue. I try putting the arduino on a different subnet and smartthings can’t reach it. I can through the web browser.

Not sure what you mean by “board settings” Everything is setup properly and I can load, verify and use a bunch of other codes. I just get the same error with yours, whatever library I use.

Can you post the error or a screenshot of the error?

Sure:


                                                                         ^

sketch_feb06a:181: error: too many decimal points in number

[convertHexToInt(hex[0…1]),convertHexToInt(hex[2…3]),convertHexToInt(hex[4…5]),convertHexToInt(hex[6…7])].join(".")

                                                                                                     ^

sketch_feb06a:19: error: ‘import’ does not name a type

import groovy.json.JsonSlurper

^

sketch_feb06a:64: error: ‘def’ does not name a type

def on() {

^

sketch_feb06a:71: error: ‘def’ does not name a type

def off() {

^

sketch_feb06a:78: error: ‘def’ does not name a type

def setLevel(percent) {

^

sketch_feb06a:84: error: ‘def’ does not name a type

def runCmd(String varCommand) {

^

sketch_feb06a:136: error: ‘def’ does not name a type

def parse(String description) {

^

sketch_feb06a:166: error: expected unqualified-id before ‘private’

private String convertIPtoHex(ipAddress) {

^

sketch_feb06a:171: error: expected unqualified-id before ‘private’

private String convertPortToHex(port) {

^

sketch_feb06a:176: error: expected unqualified-id before ‘private’

private Integer convertHexToInt(hex) {

^

sketch_feb06a:179: error: expected unqualified-id before ‘private’

private String convertHexToIP(hex) {

^

sketch_feb06a:183: error: expected unqualified-id before ‘private’

private getHostAddress() {

^

sketch_feb06a:64: error: ‘def’ does not name a type

def on() {

^

sketch_feb06a:71: error: ‘def’ does not name a type

def off() {

^

sketch_feb06a:78: error: ‘def’ does not name a type

def setLevel(percent) {

^

sketch_feb06a:84: error: ‘def’ does not name a type

def runCmd(String varCommand) {

^

sketch_feb06a:136: error: ‘def’ does not name a type

def parse(String description) {

^

sketch_feb06a:166: error: expected unqualified-id before ‘private’

private String convertIPtoHex(ipAddress) {

^

exit status 1
empty character constant


Are you trying to compile the .groovy file in Arduino? That is a SmartThings device type. The .ino file is for Arduino.

I tried compiling the .groovy file in Arduino and got the same errors.

That is exactly what was happening :astonished:

Sorry about that.
Back to your regular programming. Nothing to see here.

And it does work by the way :sweat_smile:

1 Like

I found a decently priced 10ft usb cord but it’s a little stiff. Now looking into getting 3d print locally.

I’m curious how much that ends up costing. It’s less than $1 of PLA plastic if I remember correctly.

Edit: For those curious I am still working on putting together documentation on building this.

3dhubs local quote about $9.69 just for the centered geared servo stl.

Hi

Thanks for this project.

I wanted to ask you what are the power requirements? I am using a MG995 Tower Pro servo and have a Wemos D1 setup using your code. When I try and click on any buttons on the port 80 wemos webpage the servo does respond but then dies down i.e. nothing happens. I though it could be a power issue?

Also can I power the servo from 9V and connect its data pin to Wemos D1? Would that work or would it fry/kill my Wemos D1 because the pins of the ESP8266 are 3.3V.

Thanks.