Raspberry Pi Home Automation

Using a Raspberry Pi was one of the more prominent areas in my college course. In addition, I already used one in frequently at home and in secondary school prior to the course. I was familiar with how to use a Pi and what each hardware aspect was capable of. Above all, this gave me a slight advantage when it came to starting this Raspberry Pi Home Automation project.

Pi Home Automation System image close up

Configuration

To begin this project, before I began using it for home automation and robotics, I had to set it up, update it, install packages that I needed for our upcoming work and made sure it was connected to the network. Some of the applications and commands I ran on a Pi were:

  • sudo apt-get update && sudo apt-get upgrade -y.
  • git.
  • Apache webserver
  • python 2/3.

I also put the Pi in a case to protect it from dust, I left the GPIO pins exposed so I could access them for connectivity to an external breadboard. This was one of the larger projects within the course, it had many stages before it became the final version. In addition, I had to learn about electronics and physical components that needed programming to certain pins on the pi so I could receive an output on my finalised software.

Hardware

The Raspberry Pi Home Automation build consisted of a physical breadboard attached to the pin headers on the Pi. The board contained all the parts which run the simulated home automation system, the only part missing is the lcd1602 LCD display. One of the first versions of the home automation system ran in a graphical user interface with TKinter. TKinter is a Python3 GUI framework that allowed code to be executed via the use of button presses either within the GUI or via the hardware buttons.

The full parts list consisted of:​

  • Single colour LED: [4]
  • RGB LED: [1] – An RGB colour selection interface on the website adjusted this LED
  • Variable Resistor: [1] – This is used to control one of the single colour LEDs, it allows analogue PWM signal control to vary the brightness of the light. In other words, it is a dimmer switch.
  • Light Resistor: [1] – This assisted in simulating an automated lighting system. This sensor provided the value which differentiated between light and dark environments.
  • Electronic Buzzer [1] – This was to simulate a doorbell when a specific button was pressed.
  • HC-SR04 Ultrasonic Sensor [1] – This is a distance sensor which measures the proximity of objects and things blocking the ultrasonic beam’s path.
  • HC-SR501 PIR Sensor [1] – This is a motion sensor which triggered a light switch and text output within the program to replicate the type of sensor used on an automatic door.
  • Button [2] – 1 used as a doorbell button, the other as a light switch.
  • 100v 1uf capacitor [1]
  • GPIO Extension Board [1]
  • Bread Board [2] – both were merged and configured to allow more electronics for the project,
  • Numerous assorted cables and resistors.

The final piece

In conclusion, the final software consists of a web interface that sends python commands back to the running program using Bottle (A lightweight python web framework). The program then returned values to on-screen variables shown in the web interface. Additionally, I designed the website in HTML and JavaScript from scratch. The only assets I imported were CSS from the Material design which looks like stock Android.

Finally, the live test page demo can be found on the button below and all revisions of the application can be found on my GitHub repository.

Pi Home Auto boot up sequence
Pi Home Automation System user interface