DIY Smart Blinds using NodeMCU V3/ESP8266 and an MG995 Servo. Integration with SmartThings.
NOTE: I HAVE IMPLEMENTED ZERO SECURITY IN THIS CODE. USE AT YOUR OWN RISK
- NodeMCU V3 / ESP-12E Development Board - $2.75
- MG995 Servo - $3.08
- Micro USB Cable
The MG995 Servo can only rotate 180°. This video is a guide to mod the servo for continuous 360° rotation. At 1m 59s, he used a pair of needle nose pliers to remove the stop pin from the gear, but that did not work for me. I had to use a dremel to cut it off.
I used this video to get started uploading code to the NodeMCU. I'm using a mac so I used these drivers.
-
Clone this repo somewhere on your computer
-
Change the default wifi variables in the
smart-blinds.ino
sketch#define DEFAULT_WIFI_SSID "My Wifi Nework 5G" #define DEFAULT_WIFI_PASSWORD "MyWifiP@assword" #define DEFAULT_HOSTNAME "esp8266-smart-blinds"
-
Connect the NodeMCU and upload the sketch
-
If you go to
Tools
>Serial Monitor
, You will see something like this: -
From here you can access the website via
http://esp8266-smart-blinds.local/version
(or whatever you set yourDEFAULT_HOSTNAME
to be) orhttp://IPHERE/version
-
Now you need to clear your EEPROM by going to
http://esp8266-smart-blinds.local/clear
For some reason, every time I flash the code while the servo is connected, it won't work. So many sure you disconnect when you upload your code using USB.
- Connect the Servo connector so that the:
- Now go to
http://esp8266-smart-blinds.local/close
andhttp://esp8266-smart-blinds.local/open
to watch the servo spin in two different directions - To view the speed / duration configuration:
http://esp8266-smart-blinds.local/config
- To change the speed / duration configuration:
http://esp8266-smart-blinds.local/config?speed=2&duration=5000
, then go back to/open
or/close
to see the changes - To view the wifi configuration:
http://esp8266-smart-blinds.local/wifi
- To change the wifi configuration:
http://esp8266-smart-blinds.local/wifi?ssid=NEW+Wifi&password=blah
. After this, the NodeMCU will reboot and try to connect to the new network. If it can't connect to the new network within 60 seconds, it'll revert back to the defaults defined in the sketch.
The device handler is in smart-blinds.groovy
. This video does a good job showing how to add a device handler. After you add the device handler, you just have to add a New Device
and set the serverIP
preference to your NodeMCU's IP Address. You'll understand once you watch the video.
My blinds run on a ball chain, so I 3D printed this adapter to attach to the servo motor arm.