Introduction: DIY Hacking Your Own Home Automation System
A home automation system should be able to turn on/off appliances such as lights, fans, entertainment systems, etc. A system that is wireless yet independent from the Internet, but most importantly, DIY and open-source because I want to understand how it works.
Why re-invent the wheel?
Someone was nice enough to do most of the work for us ;-)
The CoreConduit: Garden Controller System is a project I created that can easily accommodate home automation applications with an understanding of how it works and what changes need to be made. Remember to make every attempt to respect licenses and credit those for their hard work.
Step 1: Review the CoreConduit: Garden Controller System
The Coreconduit: Garden Controller System does more than we need for human living conditions so let's see what it is doing so we can make some changes. The author of the Instructable drones on and on about healthy plants requiring attention and boredom until,
"...I've programmed into the Arduino a function I called, "TheDecider" that makes decisions based on maintaining optimum environmental conditions for growing plants. I added 2.4Ghz Wireless Radio Transceiver modules and a modular receiver system so that data is transmitted to within 1000 feet."
Nice! We should take a look at this, "TheDecider"
Another plus for this project is:
"With safety in mind, I chose not to use relays that expose AC currents. Instead, I chose to use Remote Controlled Wireless Outlets for controlling lights, pumps, fans, heaters, and humidifiers."
Step 2: Download the Source-code
The Instructable explains:
"In the source-code I created a base foundation for managing, transmitting, and receiving "sensor" objects and "appliance" objects. This project could easily be modified to work with other environments in which control is achieved by reading sensors and operating appliances based on programmed rules. You'll need to make a few adjustments to the source-code in order for it to work properly with your wireless outlets. To make the changes, you'll need to find out what the codes are that your wireless remote control uses and the outlets are programmed to receive. I have included a sketch for installing onto your Arduino Uno* w/ protoshield - step you through the process of acquiring the codes. You will need to insert the 433Mhz Receiver module (as pictured) and upload this sketch, StartCore.ino to the Arduino Uno* and open up the serial console for that port so that you can receive data from the Arduino."
Let's make one!!
"After you complete the process of acquiring all of the codes from your remote you can copy and paste directly into TheDecider.h header file where I have indicated."
Step 3: Build the Controller
Parts: ( links provided as reference )
- Arduino Uno R3 ( this project can be extended using more units.)
- Arduino Uno Sensor Protoshield (the author uses a prototyping board designed for what looks like a Nokia LCD display.) We can use the same one, make our own, or use the Sensor Shield.)
- 10k resistor
- male pcb headers
- female pcb headers
- wire w/ connectors for the sensors
- 433MHz RF Transmitter & Receiver Modules
- set 5 pack of Wireless Controlled Outlets including source-code!!
- 2 or more - nRF24L01 2.4Ghz Wireless Radio Transceiver modules
- Arduino Uno R3* or Pro Mini*
- Real-Time Clock Module
- Optional: nRF24L01 Adapter with 3.3v regulator
- connector wires
- Display Option LCD w/ buttons Shield + Arduino Uno R3*
- 2 x 4-pin male header connector wires
- SD Card Option SD Card Shield + Arduino Uno R3*
- connector wires
Internet Connectivity Option
- Ethernet or WiFi Shield + Arduino Uno R3*
- connector wires - see https://www.instructables.com/id/Custom-Wire-Conne...
- conduit box w/ lid
Step 4: Some Assembly Required
Start by figuring out what codes your own particular wireless remote AC outlets use. The source-code assumes that there is a 433Mhz receiver on pins 2 (ground), 3 (Data), 4 (Vcc) and a real-time clock module connected via I2C using A5 (SCL), A4 (SDA), Vcc, ground.
Step 5: Going Wireless
Now that the controller is programmed with the codes for our AC outlets, we can add the nRF24L01 module.
Using the DuPont Rainbow ribbon with 2.54mm female connectors so that I can make custom wire connectors:
- Pin number on Arduino / Wire Color / nRF24L01 Pin
- Pin 9 : Orange / CSN "Chip Select"
- Pin 10: Yellow / CE "Chip Enable"
- Pin 11: Green / MOSI "Master Out, Slave In"
- Pin 12: Blue / MISO "Master In, Slave Out"
- Pin 13: Purple / SCK "System Clock"
- Vcc 3.3v* Red (if not using Uno, optional adapter board with voltage regulator)
- Ground. Brown
Wire color coding looking at the nRF24L01 component side with the crystal oriented on top - from bottom right, going up: Brown | Orange | Purple | Blue. Left from bottom going up: Red | Yellow | Green | NC
Step 6: Receiver Side
The Receiver source-code assumes that it is going to be compiled and executed on an Arduino Uno or ProMini connected to an nRF24L01, same as The Controller. As part of the Garden Controller System, the Receiver will send alerts via attached LCD Display and/or audible alert from a piezo connected on pins 2 (ground), 3 (signal), 4 (Vcc). For use in home automation projects, the alerts system can be removed or the rules customized according to the desired effect.
Step 7: Going Further...
Using Arduino Uno, Pro Mini, nRF24L01, and other open-source modules opens the door to many possibilities. We now have a wireless framework for sending data objects for sensors, appliances, alerts, etc, using a controller for remote AC outlets and sensor inputs and a receiver for exploring development of a user interface. TheDecider can be updated to perform any number of tasks based on sensor and user inputs. What the receiver does in response to the data it receives is up to you.