Cheap and Easy Smart Home System
by EdwardF2005 in Circuits > Arduino
2727 Views, 7 Favorites, 0 Comments
Cheap and Easy Smart Home System
Hi there!
I am Ed I am a 15 year old with a passion for computing, programming and electrical engineering. Since I'm quite young I live in my parents house, This project started when I decided to move to the Attic/ Loft Room, In the proccess of designing the room with new furniture which I'll buy I decided that I would make this room a little different; And the Smart Room was Born!
Acquiring Parts
AmazonThere are different ways to do this, You can buy all the components cheaply,but the delivery takes about 30 days from china, Or you can buy the Parts on Amazon.
(All links UK I'm afraid)
NODEMCU 1x
ARDUINO At Least 2x Depending on how many modules you are using (Any Kind will do, but I used Pro Micros as I had them lying around)
8 Piece Relay Board 1x
Radio Modules (NRF24L01) at least 2x
Radio Adapters at Least 2x
Several Single Relay Modules depending on if you want to connect extra devices
MISC
Lots Of Jumper Cables, of different ends
Lots of Patience
ws2182b LED strip
Extra smart home items, eg. fan
Amazon Echo, of any type
USB cables for programming
Perf Board
Pin Headers
How It Works
When We Make this we first need to understand how it works.
Essentially there are 3 components to this Setup.
- The NodeMCU which receives commands from the amazon Echo Which Sends commands along the Relay
- The Arduino which Receives commands from the NodeMCU via the Relay Then sends more commands via Radio
- The Receiving Radio Arduino, which receives commands via radio and is attached to all the Lights
I know that there are better ways to get the arduino to comunicate with the NodeMCU than with Basic relay board Logic but I tried 3 other Solutions and this was the only working on in the end so I stuck with this.
Wiring the Parts (Transmitter)
First Wire the NODEMCU to the Relay,
D0-D6 should be wired to INPUT 1-7 on the relay
and the VIN and GROUND connected Accordingly.
Connect the Relay to the Arduino.
What we are trying to do is get the relay to be like a simple push button.
So connect the NO of the relay to a 5v current
Connect the COM of the relay to two different things, to the correct arduino pin and to GND via a 1Kohm pullup resistor.
You can either do all of this on a bread board or via perfboard with soldering
Connect the Radio Module.
First put the Radio module into its adaptor then wire it up
This is for pro micro
Adapter ------------arduino
MO - 16
CE - 7
CSN - 8
SCK - 15
MI - 14
That is all the wiring for the Transmitter function
Wiring the Parts (Reciever)
This Part Depends on how many receiver modules you plan on using, For me I am using a large amount just repeat this step.
Firstly,
Connect the Radio Module.
First put the Radio module into its adaptor then wire it up
This is for pro micro
Adapter ------------arduino
MO - 16
CE - 7
CSN - 8
SCK - 15
MI - 14
Connect the LED Strip
5v - 5v
GND -GND
DI- A0
The Code
Hi,
I'll admit right now that My C++ Knowledge/ Arduino skill is sub par.
Therefore I merged A lot of different people's code together
Credit to:
Rui Santos
How To Mechatronics
Arduino Examples
FauxMoESP creator
Essentially the NodeMCU code uses a wonderfull libary called FauxMoESP,
which emulates a WeMO Switch.
From there it is fairly simple to use, but I still used and modified Rui Santos' Code, Sorry!
It Controls each relay to do a certain command and that's it.
The Arduino Transmitter Code identifies patterns and then sends radio signals, again, it wasnt entirely my code, but I modified it.
The Arduino Reciever code again, wasnt entirely mine but I modified it, it listens for codes then turns on/ off LEDs
Code linked below
Alexa Setup
The Basis Of the commands is routines.
The alexa knows how to do 7 things; Turn on and off each relay, by setting the FauxmoESP switch to 10%,20% etc. That's not enough though. So we use routines to do all of those things in order so that we can command the LEDS.
This process may take a while but have patience!
Thank You
Thanks for taking the time to look at this instructable, it means a lot to me! If you build this then good luck with it, otherwise have a great day, comment, like or follow if you enjoyed this, and be sure to ask any questions that you may have!