In this post we are going to build a beginner friendly home automation circuit using Arduino microcontroller board which can control up to 10 devices independently and wirelessly at 2.4 GHz band with range of 1 KM.
We will see:
What is Home Automation?
Dark Side of Home Automation.
Extended Range nRF24L01.
Pin configuration of nRF24L01 module.
Understanding Relay Module functionality.
How to operate the proposed project.
There are tons of home automation projects on the internet which are either using Bluetooth or Wi-Fi. The home automation projects involving Bluetooth are limited to few meters of range and the projects involving Wi-Fi are mostly limited to the same Wi-Fi network (Not all Projects).
Not all electronics enthusiast have Wi-Fi at their home, moreover home automation projects using Bluetooth and Wi-Fi involves in development of App for Android or iOS which is not recommended for beginners in Arduino and in home automation field.
In this project we are going to overcome the limitations mentioned above and build an easy yet effective home automation project for your home or for your college project.
Before that let’s understand what home automation is and its pros and cons.
What is Home Automation?
Home Automation means connecting all your home electrical and electronic appliances to a network, which provides the users complete control over the connected appliances via smartphone or tablet or a remote.
Home automation is more complex than just turning ON and OFF the gadgets. We can automate certain things like timing the lights to go OFF automatically or turning ON the heater at morning at set temperature automatically or turning on the porch lights automatically at evening, home Automation even involves controlling the surveillance system installed at your home.
The above mentioned points are not only the possibility of a home automation system; you can come up with many useful ideas which could potentially make people’s life easier, for example: Scheduling the door to open automatically for your pet dog at morning.
The home automation devices grants control to your gadgets within your home network or from anywhere from the world depending what you have chosen and increasing in functionality will also raise the cost of your system.
The smart home automation systems are usually connected to internet 24/7 which continuously monitors and controls the gadgets at your home. These days many home appliances at market arrive as “internet ready” which can be added to your existing automation network and controlling these devices are accomplished with user friendly Apps.
Now you know what home automation is all about. But one important thing that many won’t discuss is about the dark side of the home automation. Let’s explore this…..
As this project is focused for beginners in Arduino and home automation, we are staying away from Bluetooth and Wi-Fi but, replacing with equally good communication protocol by which we can control our home gadgets up to 1 KM away from home.
We are utilizing the same 2.4 GHz band which an ordinary Wi-Fi router also utilizes for connecting smartphones and computer to internet, but we are not using any router or modem in this project.
We are using point to point communication, there will be a receiver circuit which controls 10 relays and a remote control circuit with 10 buttons for controlling each relays independently. A LED is provided with remote which will lights up only if the receiver actually receives the signal from remote circuit.
If the receiver is out of range the LED won’t glow when a button is pressed, by this you can know whether you really switched your connected device or not.
We will be using nRF24L01 2.4 GHz module to connect the remote and receiver, let’s explore this now……
Illustration nRF24L01 Module specification:
nRF24L01 module is designed for duplex wireless communication between two or more microcontrollers or microprocessors. It can transmit and receive data up to 2Mbps. The ordinary nRF24L01 (without extended antenna) can transmit data up to 100 meter in open space and the extended range version can cover up to 1 KM.
Now let’s see the specifications of nRF24L01:
The nRF24L01 module works at (2.4 GHz) ISM band or Industrial, scientific and medical band; we no need a license to use this frequency.
It can transmit data at the rate of 250 Kbps or 1 Mbps or 2 Mbps; we have to select any one of the baud rate at transmitting and receiving end, we are going to use 250Kbps because of less data requirements for this project and we get the best range at lowest data rate.
It consumes around 11.3mA while transmitting data and consumes around 13.5mA while receiving the data at 2Mbps.
It uses SPI protocol for communicating between a microcontroller and the module.
nRF24L01 module works from 1.9V to 3.6V, normally we use 3.3V. Powering the module with 5V supply will lead to malfunction.
The pins are 5V tolerant; meaning we can use this module with a microcontroller which outputs data pulse at 5V, but we should always power the nRF24L01 module with 3.3V only.
It utilized GFSK modulation for air to air communication and it has 126 channels.
It is a battery friendly device due to its lower power consumption.
Now let’s see about the 1Km range nRF24L01 module which we will be using for this project.
Extended Range 1KM nRF24L01:
The above image illustrates the extended range nRF24L01 module with a detachable antenna.
The difference between the ordinary and extended range version is the addition of power amplifier chip and an antenna. Due to the increment in the range it need more power.
It consumes around 115mA peak during transmission and consumes around 45mA peak during reception.
Rest of the specifications are same as the normal version of nRF24L01 module.
Pin configuration of nRF24L01 module:
There are 8 pins and their naming are provided above, we need to connect 7 pins to make this module work, we are not using the IRQ / interrupt pin. We need to connect this module to hardware SPI pins of the Arduino.
The same pin configuration applies to extended range version.
Understanding the relay module’s functionality:
We are going use ready-made relay modules to switch the connected 230V/120VAC appliances. These relays are isolated with opt-couplers for better isolation from low voltage side to high voltage side.
We need to supply 5V to relay and an input signal from Arduino, which determines the relay’s state. The relay can be “Low Level trigger” or “High Level Trigger”.
Let’s see the difference between the both:
Low level trigger: Relay gets activated when low signal is inputted i.e ground signal.
High level trigger: Relay gets activated when high signal is inputted i.e (usually) +5V.
You can know whether your relay is Low or high level trigger by looking at the flip side of the relay module or just look at the label from where you purchased.
The above relay module is low level trigger, we have to apply low signal to activate the relay from N/C to N/O.
NOTE: We have provided two program codes for receiver circuit: one for high level trigger relay and another for low level trigger relay. Please upload the correct program code to Arduino depending on what kind of relay trigger you have.
Circuit Diagram for Remote:
The above circuit is for remote control and it consists of 10 push buttons, an Arduino board which is the brain of the project, one nRF24L01 extended long range or a normal module and a feedback LED which will let you know that the receiver got the signal.
Rest of the circuit is self-explanatory just connect the circuit as per the schematic.
NOTE: Use 9V battery for powering the remote with an on/off slide switch, which is not shown in the diagram. Turn it off when not in uses.
The receiver consists of 10 relays; you can opt for 10 channel relay or single channel relay 10 of them or 2 channel relay 5 of them, according to the availability of these relay modules in your locality.
The relay must be powered externally with 5V; Arduino cannot power all the 10 relays at an instant from its 5V output pin. The Arduino should be powered from external 9VDC supply from AC mains.
Left most relay is relay #1 and the right most relay is relay #10
You can use “high level trigger” or “low level trigger” relay, but be sure to upload the correct code from the below two.
Program code for Receiver: High Level Trigger Relay
With completely constructed hardware setup upload the correct program code for the receiver and remote.
Press the push button S1, the feedback LED will light momentarily and the relay #1 gets activated.
Pressing the switch S1 again will deactivate the relay #1 and feedback LED will glow momentarily.
This is same for all the relays and its corresponding switches.
Note: If you control your home gadgets with in your premises you can opt for normal nRF24L01 module. But if you want to control your gadgets from much longer distances you can go with nRF24L01 extended range version.
Dark Side of Home Automation / Disadvantage of Home Automation:
Every time when new a technology arrives at market, it not only brings comfort to the general population but also brings some opportunity for some really bad guys who knows technology; yes we are talking about the black hats.
Connecting all your gadgets to internet may provide you control, but we must also remember that we are risking our home’s security to some extent.
Assume you Wi-Fi is got hacked by someone which is connected to your home automation system, the black hat not only steals sensitive information from your home computer/smartphone/servers but also leave your house in cold pitch dark.
The black hat may try to physically access your house and he may use your connected gadgets for his tactical advantage. If you use home automation system, it is your responsibility to secure your wireless network from these bad guys.
If you have any questions regarding this project, feel free to ask us in the comment section, you can anticipate a guaranteed from us.