Smart home Project
Who has the time anymore to get up and turn on switches for your lights and fans? Just a few devices and transmission protocols put together can give you a home that seems straight out of a science fiction movie – an smart automated home. Wonderful, right? Let’s not waste any time and start the project! Home automation with Raspberry Pi and Arduino devices.
Devices Required
Let’s start collecting the hardware materials you need to create an automated home:
- Arduino UNO
- Raspberry Pi 2 Model B or latest
- Jumper Wires
- Breadboard
- Light Dependent Resistors
- PIR Motion Sensors
- Relay
- Siemens Contactor (3TF32 00-0AP0)
- Miniature Circuit Breaker (1P C16A)
Overall Configuration
Now, that we have the necessary devices that we need, it is important to understand the basics first.
The flow of communication will take place in the following way:
Room devices—> | Arduino UNO—> | Raspberry Pi |
This shows that the Raspberry Pi will serve as the primary device. It will request the information collected by the Arduino UNO from each device placed in different rooms. If there are 3 rooms, 3 Arduino UNO will be put to use. The communication between the Arduino UNO and the Raspberry Pi to create an automated home will be done by the I2C protocol. The Arduino UNO would also have connected one PassiveIR (to detect human presence in the room), LDR (to detect light intensity near room window) and one temperature sensor (LM35 to collect room temperature)
Schematic Overview
Here we have the schematic diagram as to how each device has to be connected to Arduino UNO and finally to the Raspberry Pi board to complete the circuit for a given room. You can refer to the diagram and connect your devices as per the diagram. If you wish to use more than 1 Arduino for a room, you can use an I2C strip.
Now, that you have your Arduino UNO and Raspberry Pi in place for your automated home, let’s start with the software programming.
Software programming
Since our project uses Raspberry Pi and Arduino UNO, we would require Visual Studio 2015 with C# downloaded along with Windows Universal XAML.
Our software would cover the following points:
- Raspberry Pi 2 and Arduino communication protocol
- Class Structure that allows Raspberry Pi to maintain such complicate devices and rooms
- User Interface
Refer following schematics to understand protocol defined for this project:
(‘X’ is random value or ‘0’,which will be neglected while communicating)
Focusing on the class for the project, since it covers the entire home its OOP structure requires the following class configuration:
The Primary class home consists of the multiple room objects as a list. The home class provides static method to load and save home object on the Pi. Consequently, the room consists of devices as a list and sensor structures to condense all of the sensors into 1. Finally, the devices hold details about them and their functions to turn them on and off using I2C. The room object holds the entire sensor data and also refreshes it occasionally using I2C Mode 0.
Finally, after setting up the protocol and class, you need to design the software’s UI. You can design your UI as per your choice. Ultimately, With minor configurations of your software, you can operate devices directly using this Raspberry Pi 2. And there you have it! Your home is now completely automated.
Final Product i.e Smart Home Project Result
Now, you have your fully automated home setup using Arduino UNO and Raspberry Pi 2.
You can use the following Arduino Code to program it: https://create.arduino.cc/projecthub/code_files/35547/download
Let us know what you think about smart home project “Home automation using Raspberry Pi and Arduino” in the comment section below.
If you like this post subscribe our YouTube Channel for IoT video Tutorials. You can also find us on Twitter, Facebook, and Instagram for more updates.
Start your IoT journey with IoT Basics from IoTDunia.
Reference and Image credits:
Leave a Review