Smart Home Project – Home automation with Raspberry Pi and Arduino

Home automation with Arduino and using Raspberry Pi smart home project

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:

  1. Arduino UNO
  2. Raspberry Pi 2 Model B or latest
  3. Jumper Wires
  4. Breadboard
  5. Light Dependent Resistors
  6. PIR Motion Sensors
  7. Relay
  8. Siemens Contactor (3TF32 00-0AP0)
  9. 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)


home automation with Arduino and Raspberry Pi


home automation with Arduino and Raspberry Pi


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.


schematic overview smart home automation using Raspberry pi and with Arduino


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:

  1. Raspberry Pi 2 and Arduino communication protocol
  2. Class Structure that allows Raspberry Pi to maintain such complicate devices and rooms
  3. User Interface


Refer following schematics to understand protocol defined for this project:

(‘X’ is random value or ‘0’,which will be neglected while communicating)


smart home software programming


smart home response byte


Focusing on the class for the project, since it covers the entire home its OOP structure requires the following class configuration:


class diagram


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.


automated home results


You can use the following Arduino Code to program it:


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:


IoTDunia is working towards a vision of empowering the youth by providing them with great professional opportunities with Internet of Things to build world class ecosystem.