Raspberry Pi, Arduino and Home Automation

20150806-094038-20150806_094039
Prototyping wires, used to build circuits on prototyping boards before building for real
Until recently I was a strictly software kinda guy. I have been a software developer all my working life and the idea of touching hardware has always worried me. I am fine with fixing computer hardware. I can quickly diagnose what is wrong and replace the offending part with confidence. But ask me to look at the electronics on the broken part to fix that and I would give you a confused look. Electronics, that is resistors, capacitors, transistors etc, have always confused me and I have always shyed away from them.

Well now all that has changed… or should I say… is now starting to change.

20150806-093858-20150806_093858
Programming a ESP8266 (blue board on right)
We are shortly moving into a new house and being the uber-geeks that Sally and I are we want to have a 21st century house, super energy efficient, with control over everything… lights, power use, car charging, doors, security and a whole lot more. So I started to look at what solutions exist today and to be honest, if you want anything turn-key and ready to install and use, there isn't a whole lot of choice and in any case, what is available is mighty expensive. However, I have had tentertive involvement with a number of Open Source projects and after some investigation I discovered Open Energy Monitor at http://openenergymonitor.org/. This looked like a viable solution for our power management and reporting but it looked like I would have to get down and dirty with electronics if I were to get the most for such a project. So started my voyage of electronic discovery.

20150724-160900-20150724_160900 (1)
Arduino with a small LED and temperatire sensing project
It looked to me that the Arduino was a good place to start. It offered a mix of what I am familiar with (programming) and interaction with the world of things (electronics). There are many Arduino starter kits out there to help the absolute beginner so I bought a starter kit and got building.

The kit has 15 basic projects to build an understanding of the basic functionality available and to also introduce me to electronics in general.

I have to say that this kit was a BIG success for me. In the space of just a few hours I started to see the potential that Arduino offered in a home automation scenario. It looked like would be possible to have Arduino-based sensors and actuators positioned discretely around the house all reporting to and linked in with a control and reporting system. I was hooked!

Anyone that knows me will not be surprised at my reaction – I don't just want to dabble… I want to learn as much as I can and build on my existing skills to eventually have a great home-built home automation and power management system but to do that I have a lot to learn.

20150806-093421-20150806_093422
Raspberry Pi 2 in transparent case
While looking at Arduino I also discovered the Raspberry Pi. The Pi is similar in many ways to the Arduino in that it has ways to interact with sensors and to control things but it is more than that. It is a full PC computer on a small, single board. It can run Windows but its native and best suited operating system is Linux and as such it can do most things that a full Linux computer can do. I could imagine several of these in control and supervisory roles in the system so I bought one and have started to get to grips now with the capabilities of the Raspberry Pi.

Finally then, in my initial education and investigation leading towards designing a building an intergrated system, I discovered the ESP8266. The ESP8266 is a little device which can provide wifi connectivity to the Arduino. It connects to the Arduino and allows the Arduino to interact with other devices on the network or internet. I bought one to see what it could do but with the intention of potentially of adding one to each Arduino deployed in the system but with the Arduino as the main processing device. I saw the ESP8266 as nothing more than providing WiFi capability.

Once I got the ESP8266 and started to investigate what it can do I started to realise that this little device can do a whole lot more than just provide Wifi connectivity. For a start it is programmable using the same language and software that is used for the Arduino and although it is less powerful than the Arduino it is a little like it is a mini, mini Arduino. It has connections to connect to sensors and or course it has built-in WifI capability. After a few hours of fiddling around I have now programmed this clever little device to be a small, web server. Not only that but it can also act as a web client accessing web pages from elsewhere on the network or the internet.

20150806-093556-20150806_093556
ESP8266 Wifi board
This is a real revelation. It seems that the ESP8266 might be able to replace the Arduino completely for simple, sensor functions and expose the data to the network which can then be read from other devices or the central control and reporting system.

So this is where I am at. I now feel I have a good handle on the Arduino, Raspberry Pi and the clever little ESP8266 and I feel I can now start to put together a plan. Another thing that I am surprised at is that these devices do not cost a fortune. There are different versions of each of them at different price levels but for the most part the Arduino costs about £5, the ESP8266 costs about £2 and the Raspberry Pi about £30 but we won't need more than one or two of those. So it is looking very promising that we might be able to do most, if not everything, that we might ever want to do with home automation and power management with just these three processing devices. Of course, there is a lot more to it all than just processors but they are the key to it. With cheap, easy to use, processors like these it makes the rest just detail.

So, where do I go to from here?

Today we took delivery of the basic components of the Open Energy Monitor system… an emonTX board and a RFM69Pi board. The emonTX is a board that connects to an Arduino & has some specialised connectors and some other special bits for the OEM. It allows connection of up to 4 current transformers and it transmits that data throught to the emonBase. The RFM69Pi is an add-on board that connects to a Raspberry Pi turning it into an emaonBase. It receives the data from the emonTX and uploads it to emonCMS which is the reporting server. Once the data is in emonCMS you can view it through a normal web browser.

Open Energy Monitor – Self Build Kit

20150806-144722-20150806_144722
Left to right – AC-AC adapter, 2 x CTs, Wifi for RPi, RFM69Pi and emonTX self-assemble kit

So I have to build (solder on the parts) the emonTX Arduino Shield (a "shield" is a board that connects to an Arduino using the standard GPIO connections).

I have to attach the RFM69Pi to my Raspberry Pi and set up the software to act as a emonBase.

I have to install the emonCMS software to my local server and get that going.

Then I will have to get all components working together as a full Open Energy Monitor system. Only then will I fit it all into boxes and deploy.

Along side the Open Energy Monitor, I am continuing my research into the ESP8266 and expanding on that knowledge in preparation of designing a full Home Automation system in the new house and integrating it is with the Open Energy Monitor.

Components for the future will be installing solar PV in the new house and adding that to OEM. Adding a home battery management system to store surplus solar PV and to allow its use when the sun is not shining.

Finally, adding a management system for the electric car to manage when it charges maximising the use of our surplus solar and off-peak grid power (we are on dual-rate Economy 7).

Should keep me off the streets!

I hope to be documenting as I go so stick around

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.