SmartThings Community

[RELEASE] ESP8266 / Arduino servo controlled smart blinds

motorizedblinds
arduino
blinds
esp8266

#1

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:



[RELEASE] Absolute Simplest ESP8266 Smart Blinds, no mqtt, rest, bridge, or broker, just your board and your hub
Blind options
How to motorize vertical blinds
Zigbee Roller Shade Solution
Ideas for controlling blinds based on weather?
Twist rod blinds
Smart Blinds Compatible with Smartthings? (2018)
Building a house and smart blinds
[RELEASE] Absolute Simplest ESP8266 Smart Blinds, no mqtt, rest, bridge, or broker, just your board and your hub
#2

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


( Cosmo) #3

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


(Paul Champagne) #4

That is quite impressive.

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


#5

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.


(Ben Lebson) #6

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)…


#7

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:


#8

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.


(Paul Champagne) #9

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


#10

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.


(Garrett) #11

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.


(Paul Champagne) #12

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.


(Evan) #13

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


(Paul Champagne) #14

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



#15

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.


(Paul Champagne) #16

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:


#17

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


#18

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.


#19

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


(Bachoo786) #20

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.