MY HOME AUTOMATION
Below is an overview of some of the home automation ideas I have created and described in this web site. At the heart of the system in a Raspberry Pi single board computer which is perfect for computer enthusiasts who want to experiment building software that interfaces with real world sensors. The Pi has built in interface to which you can directly wire sensors. However this is too restrictive for our use as most of the sensors are too far way to be directly wired. So the approach taken is to build a dedicated 2.4 GHz wireless network that the Pi will use to communicate with remote sensors.
In some cases sensors are built from scratch using low cost electric components that you can easily source from sites such as Amazon, Sparkfun and Adafruit (e.g. temperature sensors, motion sensors.). In other cases I wanted to interface the Pi computer with devices I already had. This is where the hacking comes in. For example, I already had a wireless front door bell, but I wanted to use it as an audible alarm to tell me when the mail has been delivered. Door bells and many other home automation devices (e.g. garage doors, smart power outlets) use the 433 MHz wireless frequency. So to complete this project I purchased a 433 MHz wireless transmitter to allow the Pi to send signals to the door bell. The tricky part is knowing what signal to send, i.e. the correct sequence of 0’s and 1’s that the door bell will interpret as a command to make it sound. The hack in this case was to also purchase a 433 MHz receiver and us this to listen and decode signal that the door bell push button sends out. Once you have this information you can program the Pi to mimic the door bell push button and send the same 433 MHz signal to the door bell.
I wanted to use a range of techniques to access my home automation system, and these are explained in some detail. This includes turning you Pi into a web server and building web pages that allow you to view and control your sensors remotely from any web browser e.g. your smart phone. I have also successfully built software for the Amazon Alexa Echo device, allowing me to control my home automation system using voice commands. Opening up your system in this way obviously raises security concerns which I have taken into account explaining techniques that will prevent hackers exploiting your system. I also experimented with the use of Bluetooth iBeacons. These battery low power devices can be used as proximity sensors using the Pi’s inbuilt Bluetooth interface to detect when the iBeacon is within reach and detectable. By keeping the iBeacon on my keyring the Pi knows when I return home and can automatically turn lights on etc.
HOW IT WORKS
Many vendors are competing to sell your their home automation systems and there are many different standards that make it challenging to integrate them together. The approach I describe in these tutorials and projects is based around several open platforms and software frameworks. The Raspberry Pi is an excellent device to act as the brains of your system (CONTROLLER) with many resource available on the web to get you started building your own software that will interface with your sensors. Sensors also need some level of intelligence and programming, and this is where the Arduino range of micro controllers are a perfect fit. A simple example is programming an Arduino to take a value from a temperature sensor and convert it to DegF prior to sending to the Pi. A more sophisticated example is programming an Arduino to read the signal from a sound sensor (microphone) and filtering out only sounds at the frequency sent out by a smoke alarm.
The tricky bit is connecting all our Arduino based sensors with your Pi, and this is where I have to give special praise to a group of enthusiasts who have built an open source software library called mySensors. This Arduino software library makes it easy to build a dedicated 2.4 GHz wireless network connecting together your Arduino SENSORS to a central Arduino GATEWAY which can then communicate with your Pi through a standard USB cable. The mySensors wireless network can be constructed using low cost wireless transceiver devices nRF24L01 to send/receive data between your Arduino gateway and Arduino sensors. Below is a diagram of the architecture of the complete system and further detailed description about each of the components.
- SENSORS. There are many different types of inexpensive sensors that you can buy from on line electronic sites such as Adafruit or SparkFun or Amazon (e.g. the DHT22 Temperature & Humidity sensor). However they tend to be simple device that output an electronic signal that needs to be interpreted. That’s where the Arduino range of micro controllers come in. These low cost devices have many input/output pins that provide flexibility to wire to any sensor. The Arduino organization also provides a programming tool that makes it easy to write your own C++ programs and download them into the micocontroller via USB. The code you build and run in your Arduino will process the raw data from the sensor. For example we could use a simple sound sensor to listen for a smoke alarm going off. But the sound sensor simply tells you the instantaneous volume the the sounds it is picking up. We can program an Arduino to specifically look for the frequency of a smoke alarm, normally 3.1kHz, and create an alert message if the volume at this frequency exceeds a set threshold. For most of the projects on this site I have used Arduino Nano’s which cost on a few $’s and provide lots of functionality.
- NETWORK (GATEWAY). The glue that ties the Arduino based sensors with the Raspberry Pi is an open source wireless communication framework called mySensors. This organization provides a free open source software library that can be loaded into Arduinos allowing you to send data between them over a dedicated wireless network. The mySensors framework provides several options for how the wireless data will be transmitted. In our projects I have used the nRF24L01 wirless transceiver as these have proved to be reliable inexpensive devices. They operate on the 2.4 GHz frequency thus have similar distance capability to your home wireless network. They are configured in a star topology, i.e. one Arduino is configured as a Gateway that sends and receives data to multiple Sensor Arduinos. The Gateway is connected to your Raspberry Pi via a USB cable and passes the sensor data back and forth with the Raspberry Pi.
We will be using java script to program the Raspberry Pi and C++ to program the Arduinos. So a basic understanding of these languages is assumed. If you are new to these systems and programming languages then there are some useful resources at the bottom of this page. Below is a diagram of the components of your home automation system, how they are connected and how they will communicate.
The following web sites offer good tutorials if you need to update your knowledge on topics we will be using throughout the site.
|RaspberryPi Setup :||https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up|