Introduction: ESP8266/Arduino SmartThings Relay for Christmas Lights
SmartPlugs SmartPlugs Everywhere...except when you run out of them and Wifey wants the 'Motorized and Lighted Santa Scene' she just bought to fire up with the rest of the Christmas lights and tree at the same time. ENTER ESP8266 and ARDUINO!! (And a few other technologies).
We have a Samsung SmartThings Hub controlling lights and plugs all over the house already. I also have TONS of ESP's and Arduino goodies stockpiled and always ready for action. For this project, an ESP8266 ESP12E, Single channel relay, a modified extension cord, and some SmartThings expertise saved me a trip to the hardware store for a new SmartPlug.
Check out this Video of it in action and the steps ahead to start building.
HAPPY HOLIDAYS EVERYONE!
If you are new to the Arduino world, check out Programming Electronics Academy. This is where I got started blinking by first LED and HELLO WORLD!!
Step 1: What You'll Need - Hardware (Tailored for ESP8266-ESP12E...others WILL Work!)
- ESP8266 ESP12E NodeMCU1.0
- Single Channel Relay
- Mini Breadboard
- Jumpers
- Generic household extension cord
- Container to hold components
- Samsung SmartThings 2.0 Hub
Step 2: What You'll Need - Software
ASSUMPTIONS: Comfortable working with Arduino IDE, Libraries, SmartThings IDE and GITHub.
- Arduino IDE
- Samsung SmartThings IDE
- SmartThings Android App
- GITHub
Step 3: Hardware Setup & Electrical
Extension Cord Modification:
- Split the 2 wires of the cord apart with a utility knife or similar. Choose a location along the length that makes sense for your setup/configuration.
- Look at your extension cord’s plug: one prong is larger than the other. Cut the wire that runs to the smaller prong, and strip 1" off each side.
CUT TIP: The correct wire is the one without ridges running along its length.
For more detailed steps on this step, take a look here. It got me on the right track with using relays in such a manner.
Controller/Relay Connections:
ESP8266----------------------Relay--------------------Cord--------------------Appliance
5V--------------------------------5V
Grd-------------------------------Grd
D1--------------------------------Data
Common--------------Thin_Blade Cut_1 NC or NO-------------Thin_Blade Cut_2
Wide_Blade-------------Plug
Step 4: Software Setup - All of It - Final Step
ASSUMPTIONS: Comfortable working with Arduino IDE, Libraries, SmartThings IDE and GITHub.
- Login to your respective SmartThings IDE and GITHub accounts.
- Follow ALL steps shown here by Daniel Ogorchock. AKA Ogiewon.
I connected the relay to the D1 pin ON THE ESP, and use the (switch1) device in the SmartThings App. It has been added without issue to SmartThings rules and scenes. The pic attached shows some of the devices added when using his included sketch ST_Anything_Multiples_ESP8266WiFi
Use one of the many Arduino starter kit plastic boxes you probably have laying around as a container for it. It worked for me...another pic attached to see it.
I know there is a lot of information and configuration but it is worth it. PLEASE feel free to ask any questions you may have along the way. In addition, the SmartThings Forum for this project is a GREAT place for tips and advice.